discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] i am crazy of openscad but openscad makes me crazy

P
Parkinbot
Thu, May 25, 2017 11:01 PM
  1. It is always the better (and faster) to start a design like this in 2D
    (and stay in xy) and do all the nasty operations like hull, minkowsky and
    boolean operations before extrusion.
  2. Avoid difference operations where the second operand exactly matches one
    or two "borders" (matching vertices, edges, and so on)  of the first
    operand. Usually the second operand can be easily enlarged. Similar rules
    apply for all boolean operations.
  3. try to avoid rotations before going into boolean operations having
    operands with matching borders. At best avoid unnessecary rotations.

Following these guidelines will change your code into:

$fn= 90;
rotate([90,0,0])
linear_extrude(2)
difference()
{
hull()
{
translate ([-47,5])  circle(5);
translate ([47,5])  circle(5);
translate ([42,22]) square(10);
translate ([-52,22]) square(10);
}
hull()
{
translate ([-20,17])  circle(5);
translate ([20,17])  circle(5);
translate ([-25,23]) square(10);
translate ([15,23]) square(10);
}
}

--
View this message in context: http://forum.openscad.org/i-am-crazy-of-openscad-but-openscad-makes-me-crazy-tp21571p21575.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

1. It is always the better (and faster) to start a design like this in 2D (and stay in xy) and do all the nasty operations like hull, minkowsky and boolean operations before extrusion. 2. Avoid difference operations where the second operand exactly matches one or two "borders" (matching vertices, edges, and so on) of the first operand. Usually the second operand can be easily enlarged. Similar rules apply for all boolean operations. 3. try to avoid rotations before going into boolean operations having operands with matching borders. At best avoid unnessecary rotations. Following these guidelines will change your code into: > $fn= 90; > rotate([90,0,0]) > linear_extrude(2) > difference() > { > hull() > { > translate ([-47,5]) circle(5); > translate ([47,5]) circle(5); > translate ([42,22]) square(10); > translate ([-52,22]) square(10); > } > hull() > { > translate ([-20,17]) circle(5); > translate ([20,17]) circle(5); > translate ([-25,23]) square(10); > translate ([15,23]) square(10); > } > } -- View this message in context: http://forum.openscad.org/i-am-crazy-of-openscad-but-openscad-makes-me-crazy-tp21571p21575.html Sent from the OpenSCAD mailing list archive at Nabble.com.
S
steam30
Fri, May 26, 2017 9:18 AM

thanks parkinbot for your advice.

In addition this code is more readable and faster to rendering.

--
View this message in context: http://forum.openscad.org/i-am-crazy-of-openscad-but-openscad-makes-me-crazy-tp21571p21576.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

thanks parkinbot for your advice. In addition this code is more readable and faster to rendering. -- View this message in context: http://forum.openscad.org/i-am-crazy-of-openscad-but-openscad-makes-me-crazy-tp21571p21576.html Sent from the OpenSCAD mailing list archive at Nabble.com.