discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

sweeping over a list of objects?

BB
Bruno Boettcher
Wed, Apr 22, 2020 9:12 AM

hello!
and thanks a lot for the help with the iaito, that one went really well!

this gave me the impulsion to try another one of my projects, i want to
make a hook, but at the moment i hit a performance problem....
i just started and i have preview rendering times of several minutes.....

i heavily suspect that there is a more efficient way to achieve this?
the sweep function needs polygons, but polygons, are, well, pointy.....
that's why i tried it with the 2D shapes and hull... but as is, dev on it
is very complicated..... and other than to buy a more powerful comp.....

this is what i tried:

radius = 15;
step = 5;
//quers(d1 = 2, d2 = 1.5*2, 2, maxb = 5);

for(angle = [0:step:110])
{
hull()
{
rotate([angle,0,0])
translate([0,radius,0])
linear_extrude(height = .1)quers(d1 = minrad(angle), d2 =
1.5minrad(angle), minrad(angle), maxb = 5);
rotate([angle+step,0,0])
translate([0,radius,0])
linear_extrude(height = .1)quers(d1 = minrad(angle+step), d2 =
1.5
minrad(angle+step), minrad(angle+step), maxb = 5);
}
}

function minrad(alpha) = -1/30alpha +5;
module quers(d1 = 2, d2 = 4, h= 2, maxb = 0)
{
$fn = 200;
hull()
{
if(maxb > 0)
{
difference()
{
union()
{
translate([0,h/2,0]) circle(d = d2);
translate([0,-h/2,0]) circle(d = d1);
}
union()
{
translate([1.9
h,-h/2,0])
rotate([0,0,-atan((d2-d1)/h)/2])color("red") square(3h,h,center = true);
translate([-1.9
h,-h/2,0])
rotate([0,0,atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true);
}
}
}
else
{
translate([0,h/2,0]) circle(d = d2);
translate([0,-h/2,0]) circle(d = d1);
}
}
}//module quers(d1 = 2, d2 = 4 )

--
ciao
Bruno

---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr

hello! and thanks a lot for the help with the iaito, that one went really well! this gave me the impulsion to try another one of my projects, i want to make a hook, but at the moment i hit a performance problem.... i just started and i have preview rendering times of several minutes..... i heavily suspect that there is a more efficient way to achieve this? the sweep function needs polygons, but polygons, are, well, pointy..... that's why i tried it with the 2D shapes and hull... but as is, dev on it is very complicated..... and other than to buy a more powerful comp..... this is what i tried: radius = 15; step = 5; //quers(d1 = 2, d2 = 1.5*2, 2, maxb = 5); for(angle = [0:step:110]) { hull() { rotate([angle,0,0]) translate([0,radius,0]) linear_extrude(height = .1)quers(d1 = minrad(angle), d2 = 1.5*minrad(angle), minrad(angle), maxb = 5); rotate([angle+step,0,0]) translate([0,radius,0]) linear_extrude(height = .1)quers(d1 = minrad(angle+step), d2 = 1.5*minrad(angle+step), minrad(angle+step), maxb = 5); } } function minrad(alpha) = -1/30*alpha +5; module quers(d1 = 2, d2 = 4, h= 2, maxb = 0) { $fn = 200; hull() { if(maxb > 0) { difference() { union() { translate([0,h/2,0]) circle(d = d2); translate([0,-h/2,0]) circle(d = d1); } union() { translate([1.9*h,-h/2,0]) rotate([0,0,-atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true); translate([-1.9*h,-h/2,0]) rotate([0,0,atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true); } } } else { translate([0,h/2,0]) circle(d = d2); translate([0,-h/2,0]) circle(d = d1); } } }//module quers(d1 = 2, d2 = 4 ) -- ciao Bruno =========================================== http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/, <http://bboett.free.fr> http://aikido.zorn.free.fr
NH
nop head
Wed, Apr 22, 2020 9:49 AM

It only takes six second to preview with OpenSCAD 2019.05. I had to fix the
missing [ ] in the square calls first. I.e.

      translate([1.9*h,-h/2,0])

rotate([0,0,-atan((d2-d1)/h)/2])color("red") square([3h,h],center = true);
translate([-1.9
h,-h/2,0])
rotate([0,0,atan((d2-d1)/h)/2])color("red") square([3*h,h],center = true);

F6 takes 1 minute 53 seconds, which doesn't seem bad for something with
$fn = 200.

On Wed, 22 Apr 2020 at 10:13, Bruno Boettcher bboett@gmail.com wrote:

hello!
and thanks a lot for the help with the iaito, that one went really well!

this gave me the impulsion to try another one of my projects, i want to
make a hook, but at the moment i hit a performance problem....
i just started and i have preview rendering times of several minutes.....

i heavily suspect that there is a more efficient way to achieve this?
the sweep function needs polygons, but polygons, are, well, pointy.....
that's why i tried it with the 2D shapes and hull... but as is, dev on it
is very complicated..... and other than to buy a more powerful comp.....

this is what i tried:

radius = 15;
step = 5;
//quers(d1 = 2, d2 = 1.5*2, 2, maxb = 5);

for(angle = [0:step:110])
{
hull()
{
rotate([angle,0,0])
translate([0,radius,0])
linear_extrude(height = .1)quers(d1 = minrad(angle), d2 =
1.5minrad(angle), minrad(angle), maxb = 5);
rotate([angle+step,0,0])
translate([0,radius,0])
linear_extrude(height = .1)quers(d1 = minrad(angle+step), d2 =
1.5
minrad(angle+step), minrad(angle+step), maxb = 5);
}
}

function minrad(alpha) = -1/30alpha +5;
module quers(d1 = 2, d2 = 4, h= 2, maxb = 0)
{
$fn = 200;
hull()
{
if(maxb > 0)
{
difference()
{
union()
{
translate([0,h/2,0]) circle(d = d2);
translate([0,-h/2,0]) circle(d = d1);
}
union()
{
translate([1.9
h,-h/2,0])
rotate([0,0,-atan((d2-d1)/h)/2])color("red") square(3h,h,center = true);
translate([-1.9
h,-h/2,0])
rotate([0,0,atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true);
}
}
}
else
{
translate([0,h/2,0]) circle(d = d2);
translate([0,-h/2,0]) circle(d = d1);
}
}
}//module quers(d1 = 2, d2 = 4 )

--
ciao
Bruno

---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

It only takes six second to preview with OpenSCAD 2019.05. I had to fix the missing [ ] in the square calls first. I.e. translate([1.9*h,-h/2,0]) rotate([0,0,-atan((d2-d1)/h)/2])color("red") square([3*h,h],center = true); translate([-1.9*h,-h/2,0]) rotate([0,0,atan((d2-d1)/h)/2])color("red") square([3*h,h],center = true); F6 takes 1 minute 53 seconds, which doesn't seem bad for something with $fn = 200. On Wed, 22 Apr 2020 at 10:13, Bruno Boettcher <bboett@gmail.com> wrote: > hello! > and thanks a lot for the help with the iaito, that one went really well! > > this gave me the impulsion to try another one of my projects, i want to > make a hook, but at the moment i hit a performance problem.... > i just started and i have preview rendering times of several minutes..... > > i heavily suspect that there is a more efficient way to achieve this? > the sweep function needs polygons, but polygons, are, well, pointy..... > that's why i tried it with the 2D shapes and hull... but as is, dev on it > is very complicated..... and other than to buy a more powerful comp..... > > this is what i tried: > > radius = 15; > step = 5; > //quers(d1 = 2, d2 = 1.5*2, 2, maxb = 5); > > for(angle = [0:step:110]) > { > hull() > { > rotate([angle,0,0]) > translate([0,radius,0]) > linear_extrude(height = .1)quers(d1 = minrad(angle), d2 = > 1.5*minrad(angle), minrad(angle), maxb = 5); > rotate([angle+step,0,0]) > translate([0,radius,0]) > linear_extrude(height = .1)quers(d1 = minrad(angle+step), d2 = > 1.5*minrad(angle+step), minrad(angle+step), maxb = 5); > } > } > > function minrad(alpha) = -1/30*alpha +5; > module quers(d1 = 2, d2 = 4, h= 2, maxb = 0) > { > $fn = 200; > hull() > { > if(maxb > 0) > { > difference() > { > union() > { > translate([0,h/2,0]) circle(d = d2); > translate([0,-h/2,0]) circle(d = d1); > } > union() > { > translate([1.9*h,-h/2,0]) > rotate([0,0,-atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true); > translate([-1.9*h,-h/2,0]) > rotate([0,0,atan((d2-d1)/h)/2])color("red") square(3*h,h,center = true); > } > } > } > else > { > translate([0,h/2,0]) circle(d = d2); > translate([0,-h/2,0]) circle(d = d1); > } > } > }//module quers(d1 = 2, d2 = 4 ) > > > -- > ciao > Bruno > > =========================================== > http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/, > <http://bboett.free.fr> > http://aikido.zorn.free.fr > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Wed, Apr 22, 2020 9:51 AM

On 22.04.20 11:12, Bruno Boettcher wrote:

i just started and i have preview rendering times of
several minutes.....

Are we talking about the exact code below? That's
finishing preview in 3 seconds. I guess actual render
will be quite slow due to the high $fn count.

Just using a general already quite high resolution of
$fa = 2; $fs = 0.2; at the top of the script instead
of the $fn = 200; previews in 0 seconds and renders
in 19 though.

Note that the slightly strange warning is due to
square([3*h,h],center = true); missing the [ ] so
the 2nd h is where the positional argument center
is.

ciao,
Torsten.

On 22.04.20 11:12, Bruno Boettcher wrote: > i just started and i have preview rendering times of > several minutes..... Are we talking about the exact code below? That's finishing preview in 3 seconds. I guess actual render will be quite slow due to the high $fn count. Just using a general already quite high resolution of $fa = 2; $fs = 0.2; at the top of the script instead of the $fn = 200; previews in 0 seconds and renders in 19 though. Note that the slightly strange warning is due to square([3*h,h],center = true); missing the [ ] so the 2nd h is where the positional argument center is. ciao, Torsten.
BB
Bruno Boettcher
Wed, Apr 22, 2020 1:07 PM

indeed....
adding the brackets i am down to 34s.....
no error message though.....

i have still 2019.01-RC2 , the one shipped with my distro....

and missing the long awaited svg import :( still waiting....

still, if there are suggestions on how to achieve this in a better way, i
take them :D

ciao

Bruno

Am Mi., 22. Apr. 2020 um 11:52 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de

:

On 22.04.20 11:12, Bruno Boettcher wrote:

i just started and i have preview rendering times of
several minutes.....

Are we talking about the exact code below? That's
finishing preview in 3 seconds. I guess actual render
will be quite slow due to the high $fn count.

Just using a general already quite high resolution of
$fa = 2; $fs = 0.2; at the top of the script instead
of the $fn = 200; previews in 0 seconds and renders
in 19 though.

Note that the slightly strange warning is due to
square([3*h,h],center = true); missing the [ ] so
the 2nd h is where the positional argument center
is.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

indeed.... adding the brackets i am down to 34s..... no error message though..... i have still 2019.01-RC2 , the one shipped with my distro.... and missing the long awaited svg import :( still waiting.... still, if there are suggestions on how to achieve this in a better way, i take them :D ciao Bruno Am Mi., 22. Apr. 2020 um 11:52 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de >: > On 22.04.20 11:12, Bruno Boettcher wrote: > > i just started and i have preview rendering times of > > several minutes..... > > Are we talking about the exact code below? That's > finishing preview in 3 seconds. I guess actual render > will be quite slow due to the high $fn count. > > Just using a general already quite high resolution of > $fa = 2; $fs = 0.2; at the top of the script instead > of the $fn = 200; previews in 0 seconds and renders > in 19 though. > > Note that the slightly strange warning is due to > square([3*h,h],center = true); missing the [ ] so > the 2nd h is where the positional argument center > is. > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- ciao Bruno =========================================== http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/, <http://bboett.free.fr> http://aikido.zorn.free.fr
TP
Torsten Paul
Wed, Apr 22, 2020 1:23 PM

On 22.04.20 15:07, Bruno Boettcher wrote:

i have still 2019.01-RC2, the one shipped with my distro....

You can also check out the AppImage or install via flatpak.

ciao,
Torsten.

On 22.04.20 15:07, Bruno Boettcher wrote: > i have still 2019.01-RC2, the one shipped with my distro.... You can also check out the AppImage or install via flatpak. ciao, Torsten.