discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] My first design. Unable to export to STL

B
Bananapeel
Thu, Feb 5, 2015 12:31 AM

Floating point numbers are used. These have rounding errors. To combat that
you should try to make your shapes involved in the difference() operation a
little bit bigger.

// No
difference() {
cube(2);
cube(1.5);
}

translate([5, 0, 0])
// YES
difference() {
cube(2);
translate([-0.1, -0.1, -0.1]) cube(1.5+0.1);
}

And a cube shouldn't take $fn as a parameter.

I hope this solves your problem.

--
View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11464.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Floating point numbers are used. These have rounding errors. To combat that you should try to make your shapes involved in the difference() operation a little bit bigger. // No difference() { cube(2); cube(1.5); } translate([5, 0, 0]) // YES difference() { cube(2); translate([-0.1, -0.1, -0.1]) cube(1.5+0.1); } And a cube shouldn't take $fn as a parameter. I hope this solves your problem. -- View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11464.html Sent from the OpenSCAD mailing list archive at Nabble.com.
B
Bananapeel
Thu, Feb 5, 2015 12:57 AM

No, I don't think this is it. These are your problem:
*translate([0,.5,-6]) cylinder(1,d=20, center=true);
*translate([0,1.5,-3]) cylinder(1,d=20, center=true);
*translate([0,1.5,0]) cylinder(1,d=20, center=true);
*translate([0,1.5,3]) cylinder(1,d=20, center=true);
*translate([0,.5,6]) cylinder(1,d=20, center=true);

No idea why.

--
View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11465.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

No, I don't think this is it. These are your problem: *translate([0,.5,-6]) cylinder(1,d=20, center=true); *translate([0,1.5,-3]) cylinder(1,d=20, center=true); *translate([0,1.5,0]) cylinder(1,d=20, center=true); *translate([0,1.5,3]) cylinder(1,d=20, center=true); *translate([0,.5,6]) cylinder(1,d=20, center=true); No idea why. -- View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11465.html Sent from the OpenSCAD mailing list archive at Nabble.com.
B
Bananapeel
Thu, Feb 5, 2015 10:25 AM

c = 0.002;

fn_cyl=40;

difference() {
cube(20, center=true);
union() {
translate([0,-15,0])cube([21,20,21],center=true);
cylinder (21, d=16, center=true, $fn=100);
rotate([90,0,0]) translate([0,0,-6]) cylinder(12, d=16, center=true);

rotate([90,0,0]) translate([7.5,7.5,-11]) cylinder(6, d=2.5,d2=2,

$fn=fn_cyl);
rotate([90,0,0]) translate([-7.5,7.5,-11]) cylinder(6, d1=2.5,d2=2,
$fn=fn_cyl);
rotate([90,0,0]) translate([7.5,-7.5,-11]) cylinder(6, d1=2.5,d2=2,
$fn=fn_cyl);
rotate([90,0,0]) translate([-7.5,-7.5,-11]) cylinder(6, d1=2.5,d2=2,
$fn=fn_cyl);

translate([0,.5,-6]) cylinder(1,d=20+c, center=true); 
translate([0,1.5,-3]) cylinder(1,d=20+c, center=true); 
translate([0,1.5,0]) cylinder(1,d=20+c, center=true); 
translate([0,1.5,3]) cylinder(1,d=20+c, center=true); 
translate([0,.5,6]) cylinder(1,d=20+c, center=true);

}
}

The problem is that it's no longer precisely the same shape. There are small
holes in your walls. You could make the cylinders smaller instead of bigger,
but you'd get places where the walls are very thin, which would be a problem
for some materials.

--
View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11469.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

c = 0.002; fn_cyl=40; difference() { cube(20, center=true); union() { translate([0,-15,0])cube([21,20,21],center=true); cylinder (21, d=16, center=true, $fn=100); rotate([90,0,0]) translate([0,0,-6]) cylinder(12, d=16, center=true); rotate([90,0,0]) translate([7.5,7.5,-11]) cylinder(6, d=2.5,d2=2, $fn=fn_cyl); rotate([90,0,0]) translate([-7.5,7.5,-11]) cylinder(6, d1=2.5,d2=2, $fn=fn_cyl); rotate([90,0,0]) translate([7.5,-7.5,-11]) cylinder(6, d1=2.5,d2=2, $fn=fn_cyl); rotate([90,0,0]) translate([-7.5,-7.5,-11]) cylinder(6, d1=2.5,d2=2, $fn=fn_cyl); translate([0,.5,-6]) cylinder(1,d=20+c, center=true); translate([0,1.5,-3]) cylinder(1,d=20+c, center=true); translate([0,1.5,0]) cylinder(1,d=20+c, center=true); translate([0,1.5,3]) cylinder(1,d=20+c, center=true); translate([0,.5,6]) cylinder(1,d=20+c, center=true); } } The problem is that it's no longer precisely the same shape. There are small holes in your walls. You could make the cylinders smaller instead of bigger, but you'd get places where the walls are very thin, which would be a problem for some materials. -- View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11469.html Sent from the OpenSCAD mailing list archive at Nabble.com.
H
hashg
Thu, Feb 5, 2015 7:27 PM

Thanks for correcting the $fn to the right value as well. Now my cylinders
have nice continuous curve :)

--
View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11473.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks for correcting the $fn to the right value as well. Now my cylinders have nice continuous curve :) -- View this message in context: http://forum.openscad.org/My-first-design-Unable-to-export-to-STL-tp11463p11473.html Sent from the OpenSCAD mailing list archive at Nabble.com.