OpenScad noob alert, sanity check please smiling smiley
March 11, 2014 10:20AM
First post here, usually lurking in the Ormerod section winking smiley

I need to learn 3d modelling to gain source files for my printer and openscad seems the defacto way to go for many things.

After getting over the shock of not being mouse controlled drag and drop, i knuckled down and gained a headache and my first project, a back cover for Nema23 stepper motors.

After four hours of reading and playing i came up with this code...

difference(){

difference(){
minkowski(){
sphere(r=2.5);//corner radius
//Outer box
cube(size=[56,56,30], center=true); //corner rad is added to each wall
}
//Inner box
translate([0,0,2.5]) //move up 2.5mm wall thickness
cube(size=[56,56,30],center = true);//actual size of cavity
}

//create the cable cutout
hull(){
rotate(a=[0,90,0])
translate([-10.25,0,25])
cylinder(h=10, r=6);//bottom cylinder

rotate(a=[0,90,0])
translate([-30,0,25])
cylinder(h=10, r=6);//top cylinder
}

}

What i want is a cube with rounded corners and a cable cutout in one side, the internal cavity must be 56x56x30mm and i wanted a wall thickness of 2.5mm.
I'm nearly there and it all renders nicely but the Z dimension is showing as 34.62mm in slic3r whereas I presumed it would be 35mm.

I think I am right in my assumption the Minkowski magic, adds the sphere radius to each wall of the object?

Any idea why the measurement is 34.62??

Thanks

Dave

Edited 1 time(s). Last edit at 03/11/2014 10:21AM by Davek0974.


Another RS Ormerod Mk1 meets the world smiling smiley

Retired now but I used to make....
CNC Machined Mk1 aluminium bed support plates for the Ormerod
CNC machined X-plates and ribs for Mk1 & Mk2 Ormerods
CNC machined bed support arms for the Mk2 Ormerod.
Dual Hot-End heatsink blocks.
Re: OpenScad noob alert, sanity check please smiling smiley
March 11, 2014 02:26PM
Yes, the minkowski adds the sphere size to each side.

The resolution of the sphere also affects the size. Adding $fn to the sphere as in sphere(r=2.5,$fn=20):
$fn=20 it's 61x61x34.94 in size.
$fn=50 it's 61x61x34.99

The higher the $fn is, the longer it takes the code to compile.

Edited 1 time(s). Last edit at 03/11/2014 02:26PM by stephenrc.
Re: OpenScad noob alert, sanity check please smiling smiley
March 11, 2014 02:32PM
I'm an even bigger noob than you, but I liked the idea of Minkowski, so I googled around a bit. Found this:
https://github.com/openscad/openscad/issues/610

From what they say, it looks like upping the resolution of your sphere makes the dimensions more accurate.

I tried it with your code, putting in "sphere(r=2.5, $fn=20);" to define the sphere, and measured something much closer to 35.

Edit: Ha! Someone who actually knows something beat me to it!

Edited 1 time(s). Last edit at 03/11/2014 02:33PM by maso.
Re: OpenScad noob alert, sanity check please smiling smiley
March 11, 2014 03:43PM
Brilliant,

The mk1 trial is printing now, just to see if the concept works, something very satisfying about designing something and watching it materialise in 3d smiling smiley

I will add the $fn argument tomorrow and go with that I think! it's the inside that's important anyway! just wanted to know why the figures didn't match what I thought they should.

I'm quite impressed with my efforts so far, I've added supports in the corners to stop the cap going on too far and even dabbled with adding raised text on one side smiling smiley

Thanks


Another RS Ormerod Mk1 meets the world smiling smiley

Retired now but I used to make....
CNC Machined Mk1 aluminium bed support plates for the Ormerod
CNC machined X-plates and ribs for Mk1 & Mk2 Ormerods
CNC machined bed support arms for the Mk2 Ormerod.
Dual Hot-End heatsink blocks.
Re: OpenScad noob alert, sanity check please smiling smiley
March 12, 2014 04:46AM
Well it almost worked, the walls were expected to be 2.5mm thick and only measured 2.2mm but the base came in at 4.7mm which is much too thick.

If this is caused by the Minkowski then maybe that's not the best option for it??

The inside cavity was perfect and fitted the motor 100%.

Is there a better way to create rounded corners?



Edit.
Sorted it, it was my fault the base was too thick, next print should be ideal.

Edited 1 time(s). Last edit at 03/12/2014 06:22AM by Davek0974.


Another RS Ormerod Mk1 meets the world smiling smiley

Retired now but I used to make....
CNC Machined Mk1 aluminium bed support plates for the Ormerod
CNC machined X-plates and ribs for Mk1 & Mk2 Ormerods
CNC machined bed support arms for the Mk2 Ormerod.
Dual Hot-End heatsink blocks.
Re: OpenScad noob alert, sanity check please smiling smiley
September 18, 2014 11:56AM
Here's an idea for a module to make rounded boxes - (it centers the box):

// Invoke the "RoundBox" module with parameters
// length,width,height,radius (of corners)
// No dimension may be less than 2*radius

$fn=50;

// e.g.
RoundBox(56,56,30,2.5);
// Gives a box 56 X 56 X 30 with corners rounded to a 2.5mm radius

module RoundBox(L,W,H,R){
hull()
{
translate([+(L/2-R),+(W/2-R),-(H/2-R)])
sphere(r=R);
translate([+(L/2-R),-(W/2-R),-(H/2-R)])
sphere(r=R);
translate([-(L/2-R),+(W/2-R),-(H/2-R)])
sphere(r=R);
translate([-(L/2-R),-(W/2-R),-(H/2-R)])
sphere(r=R);
translate([+(L/2-R),+(W/2-R),+(H/2-R)])
sphere(r=R);
translate([+(L/2-R),-(W/2-R),+(H/2-R)])
sphere(r=R);
translate([-(L/2-R),+(W/2-R),+(H/2-R)])
sphere(r=R);
translate([-(L/2-R),-(W/2-R),+(H/2-R)])
sphere(r=R);
}}


Dave
Sorry, only registered users may post in this forum.

Click here to login