Hello
I intend to use frequently the module ring() in the code below because it is
much faster than the difference() between cylinders or even ring2(). However
some anomalies happen in preview mode like those in the first picture.
After rendering, the results of test1() and test2() are OK. Using the slower
ring2() all goes well except that I miss the facility of using the option
SidesIn and SidesOut useful to generate nuts and bolts.
My problem is speed because I'm attaching a set of parts with lots of bolts
nuts and washers.
Can someone explain why this happens?
Preview:
http://forum.openscad.org/file/n16425/Capture1.jpg
After rendering:
http://forum.openscad.org/file/n16425/Capture2.jpg
Now the code:
DSides=48;
delta=0.01;
module tsl (x,y=0,z=0) {translate([x,y,z]) children();}
module rot (x,y=0,z=0) {rotate([x,y,z]) children();}
module ring(pos=[0,0,0], angl=[0,0,0], Hgt, Dout, Din, SidesOut, SidesIn)
{
translate(pos) rotate(angl)
linear_extrude(height=Hgt){
difference(){
circle( d=Dout, $fn=SidesOut);
circle( d=Din, $fn=SidesIn);
}
}
}
module ring2(pos=[0,0,0], angl=[0,0,0], Hgt, Dout, Din, Sides, Sector) //
"ring()" is faster
{
translate(pos) rotate(angl)
rotate_extrude(angle=Sector, convexity=2, $fn=DSides )
translate([Din/2,0,0])
square([(Dout-Din)/2,Hgt]);
}
module test1(){
difference(){
union(){
tsl(0, 0, 7.6) cylinder(h=5.9+7.6+7.6, d=14, $fn=DSides);
tsl(0, 0, 5.9+7.6+7.4) cylinder(h=20.6, d=16, $fn=DSides);
}
tsl(0,0,7.5) cylinder(h=19, d1=12, d2=7, $fn=DSides);
tsl(0,0,5.9+7.6+7.4+20.6-11) cylinder(h=11+delta, d=8, $fn=DSides);
tsl(-10, 7, 5.9+7.6+7.4+3.8) cube([20, 3, 8]);
tsl(-10, -7-3, 5.9+7.6+7.4+3.8) cube([20, 3, 8]);
}
}
module test2(){ //using ring()
tsl(30,0,0){
difference(){
union(){
tsl(0, 0, 7.6) cylinder(h=5.9+7.6+7.6, d=14, $fn=DSides);
//ring2([0, 0, 5.9+7.6+7.4], [0,0,0], 20.6, 16, 8, DSides);
ring([0, 0, 5.9+7.6+7.4], [0,0,0], 20.6, 16, 8, DSides, DSides, 80);
}
// All the following lines are problematic with preview
tsl(0,0,7.5) cylinder(h=19, d1=12, d2=7, $fn=DSides);
tsl(0,0,5.9+7.6+7.4+20.6-11) cylinder(h=11+delta, d=8, $fn=DSides);
tsl(-10, 7, 5.9+7.6+7.4+3.8) cube([20, 3, 8]);
tsl(-10, -7-3, 5.9+7.6+7.4+3.8) cube([20, 3, 8]);
}
}
}
test1();
test2();
Thanks
jpmendes
--
View this message in context: http://forum.openscad.org/Can-someone-explain-this-strange-behaviour-with-preview-tp16425.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 03/12/2016 01:35 AM, jpmendes wrote:
I intend to use frequently the module ring() in the code below because it is
much faster than the difference() between cylinders or even ring2(). However
some anomalies happen in preview mode like those in the first picture.
Looks like a case of that:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_are_some_parts_.28e.g._holes.29_of_the_model_not_rendered_correctly.3F
ciao,
Torsten.
you haven't added convexity into the linear-extrude in ring()
--
View this message in context: http://forum.openscad.org/Can-someone-explain-this-strange-behaviour-with-preview-tp16425p16427.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ooops! Basic mistake.
Thanks Neon22
--
View this message in context: http://forum.openscad.org/Can-someone-explain-this-strange-behaviour-with-preview-tp16425p16428.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
If you have lots of nuts, bolts and washers put render() in the modules
that generated them. Then only one of each size is converted to a mesh,
cached and reused. It makes viewing assemblies much faster.
In my designs all the vitamins have a render() and a color() at the top
level of their module. The plastic parts don't have render in their modules
but are rendered() where they are used in the assembly view. That is how I
can view a machine with hundreds of parts and pan and rotate it at high
frame rates. To work on a plastic part I show it in isolation and the F5
preview is then fast as it doesn't include a render.
On 12 March 2016 at 01:01, jpmendes jpmendes54@gmail.com wrote:
Ooops! Basic mistake.
Thanks Neon22
--
View this message in context:
http://forum.openscad.org/Can-someone-explain-this-strange-behaviour-with-preview-tp16425p16428.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Yes I already do that for parts that do not take much time to render, for
those that are slower to render I don't because of the lack of persistent
caching. Rendering a multicolored single part would be a good thing too.
Thanks
jpmendes
--
View this message in context: http://forum.openscad.org/Can-someone-explain-this-strange-behaviour-with-preview-tp16425p16442.html
Sent from the OpenSCAD mailing list archive at Nabble.com.