Notifications
Clear all

OpenSCAD help  

  RSS
3DPrints4me
(@3dprints4me)
Active Member
OpenSCAD help

I know this probably isn't the best place for this, but I haven't been able to find any openscad forums that seem active.  I am modifying someone else's openscad design.  I have it working except for one problem.  I want a hole at the bottom of the inner cylinder, I have tried a bunch of things but I cant seem to figure it out.

Here is a picture of the render and what the issue is.

I have temporarily solved the issue by adding a cylcindrical negative space in prusaslicer, which works but is a kludge.

I will warn you this has a super slow render.  As I said this was written by the most part by someone else.  The OpenSCAD file is attached

Any help would be appreciated.

Posted : 17/05/2023 12:49 am
3DPrints4me
(@3dprints4me)
Active Member
Topic starter answered:
RE: OpenSCAD help

I don't know why I don't see the attached file. Here it is as a link dessicantcontainer-overture V2

Posted : 17/05/2023 12:51 am
ntdesign
(@ntdesign)
Reputable Member
RE: OpenSCAD help

I only have a minute so cannot really fix that code 😉

But this should work:
1.) wrap everything between "// Code to draw the container" and "// Modules that will be used by above code" into a module:
module mymodule() {
...

2.) call the module (e.g. below the variable definitions), then it should render exactly like before (test this):
mymodule();

3.) now change the module call to:

difference() {
  mymodule();
  translate([0,0,-1]) cylinder(d=cdiameter, h=cheight);
}

(either define cdiameter and cheight as parameters or just put the values you need).

Good luck.

Posted : 17/05/2023 8:01 am
FoxRun3D
(@foxrun3d)
Famed Member
RE: OpenSCAD help

Expanding on @ntdesign's suggestion:

Instead of just cutting a hole, you probably want a nice rim around it as well.

I simply added a couple of parameters

cutoutID = 20;
cutoutOD = 24;
_min = 0.1;

and then modified the if(drawcontainer) block:

if(drawcontainer)
{    
    difference() 
    {
        union()
        {
            container();
            cylinder(d=cutoutOD, h=basethickness);
        }
	vgrate();  
        translate([0,0,-_min])
            cylinder(d=cutoutID, h=2*basethickness);
    }
}

Here's what it looks like:

 

Formerly known on this forum as @fuchsr -- until all hell broke loose with the forum software...

Posted : 17/05/2023 10:58 am
3DPrints4me
(@3dprints4me)
Active Member
Topic starter answered:
RE: OpenSCAD help

Thanks for your help!  That solved the problem.  So to better my understanding when you want to create negative volume you have to create it elsewhere and then do a difference with a translate?

Posted : 17/05/2023 4:22 pm
FoxRun3D
(@foxrun3d)
Famed Member
RE: OpenSCAD help

Correct. Difference() is one version of Boolean operations https://en.m.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling

Difference() subtracts one object from another. Union() combines two objects. It's usually implied but comes in handy like in this example when the Union is part of a Difference. And intersect() retains the common space occupied by two objects. 

Formerly known on this forum as @fuchsr -- until all hell broke loose with the forum software...

Posted : 17/05/2023 4:31 pm
3DPrints4me
(@3dprints4me)
Active Member
Topic starter answered:
RE: OpenSCAD help

The STL looks right but for some reason it has a print time of 6h24 instead of 5h28m.  Its not a settings issue, I deleted the existing STL out of a project and imported the new one.  The sizes of the STL are a bit different, but that is expected since the old one had a bottom that I got rid of in the slicer.

I am clueless why there would be such a big difference in the print times.

Posted : 17/05/2023 4:58 pm
Startrekfan2
(@startrekfan2)
New Member
RE: OpenSCAD help

Great news! OpenSCAD now has a measuring tool for length and angles. Download the latest development snapshot. I am using OpenSCAD-2024.01.03 In preferences select Manifold geometry engine, and create a full mesh render (F6). This video shows how to use the tool. 

Btw, it looks a lot like the measuring tool in PrusaSlicer !

Posted : 07/01/2024 3:21 am
Share: