Notifications
Clear all

OpenSCAD Base Sizing  

  RSS
Lucas
(@lucas)
Eminent Member
OpenSCAD Base Sizing

I am doing some simple tests with PrusaSlicer and OpenSCAD exports. If I make a simple cube, say [20, 20, 1], when I import it into PrusaSlicer, the X and Y are correct, but the Z is 1mm taller than my defined Z. Is there a way to define .scad files to resolve to MM?

Posted : 14/04/2021 8:43 pm
FoxRun3D
(@foxrun3d)
Famed Member
RE: OpenSCAD Base Sizing

I've never seen this with OpenScad. All dimensions come across correct.  I just tested it, to be sure. Imports fine with 20 x 20 x 1. OpenScad file and 3mf attached.

Untitled

Maybe I'm missing something...

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

Posted : 14/04/2021 9:51 pm
Lucas
(@lucas)
Eminent Member
Topic starter answered:
RE: OpenSCAD Base Sizing
Posted by: @fuchsr

I've never seen this with OpenScad. All dimensions come across correct.  I just tested it, to be sure. Imports fine with 20 x 20 x 1. OpenScad file and 3mf attached.

Untitled

Maybe I'm missing something...

Looks like I was missing something. It's the use of the minkowski(), when I use it, in the context below, it seems to double the height? Maybe I misunderstand what/how it's working?

//Lip Size: Minkowski around the edge
lip_size=1;
// Width
x=20;
// Length
y=20;
// Height
z=1;

$fn=80;

module storage_base(lip_size=lip_size, x=x, y=y, z=z) {
minkowski() {
cylinder(r=lip_size, h=z);
cube(size=[x ,y, z]);
}
}
storage_base(lip_size=lip_size, x=x, y=y, z=z);

 

 

Posted : 14/04/2021 11:24 pm
FoxRun3D
(@foxrun3d)
Famed Member
RE: OpenSCAD Base Sizing

Ah, minkowski()... a little detail you didn't mention...

Your code definitely creates a square 2 mm in height. Has nothing do to with Prusaslicer -- it's a resulr of the code.

Full disclosure: I use OpenSCAD but I'm not an expert. I would use it more but I found its lack of a true filleting function so frustrating.

And it looks like you're trying to put fillets on your cube. An alternative to minkowski() (which I don't even pretend I understand) is to use this simple filleting module:

module cube_fillet(size, radius){

   x = size[0];
   y = size[1];
   z = size[2];

   linear_extrude(height=z)
      hull(){

      // place 4 circles in the corners, with the given radius

         translate([radius, y-radius, 0])
             circle(r=radius);

          translate([x-radius, radius, 0])
           circle(r=radius);

          translate([radius, radius, 0])
           circle(r=radius);

           translate([x-radius, y-radius, 0])
           circle(r=radius);
       }
}

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

Posted : 14/04/2021 11:36 pm
Diem
 Diem
(@diem)
Illustrious Member
RE: OpenSCAD Base Sizing

@lucas

minkowski() adds two shapes in all three dimensions; in your case you are only trying to modify two...

One crude workaround is to minkowski with a cylinder of negligable thickness, h=0.01 adds much less than a printable layer to the object so will not change the final part but this will catch you out eventually.

@fuchsr's method is better in this case.  You might find it easier to envisage if you hull() four cylinders of the final height and leave out the extrude.

Cheerio,

Posted : 15/04/2021 9:48 am
Lucas
(@lucas)
Eminent Member
Topic starter answered:
RE: OpenSCAD Base Sizing

Appreciate both your help, and the nice thing about OpenSCAD modules as an interface, is I just redid the implementation of what I had, in a better way.

 

@Diem the nice thing about the Mink was it is in addition to the XY values, as the XY should be the size of the inner part of the container, so I hacked it by duplicating the minkowski and doing a difference to shave off the top.

But I used @Fuchsr's code and did some simple translates if there's a lip size, which definitely makes it a bit more elegant overall.

module storage_base(lip_size=lip_size, radius=corner_radius, x=x, y=y, z=z) {
down(z)
if (lip_size) {
left(lip_size)
fwd(lip_size)
cube_fillet(size=[x, y, z], radius=corner_radius);
}
else {
cube(size=[x, y, z]);
}
}

storage_base(lip_size=lip_size, radius=corner_radius, x=x, y=y, z=z);
Posted : 15/04/2021 9:10 pm
Diem
 Diem
(@diem)
Illustrious Member
RE: OpenSCAD Base Sizing
Posted by: @lucas

so I hacked it by duplicating the minkowski and doing a difference to shave off the top.

And the bottom?It might be simpler with an intersection.

Cheerio,

Posted : 15/04/2021 10:16 pm
Share: