discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Getting a human rendering time for a huge gear?

D
DarioPellegrini
Sun, Jun 23, 2019 3:47 PM

I would like to design a gear with a very large number of teeth, about 1000.
The problem is that the rendering time quickly becomes unpractical, even
using simple triangular teeth (and I would like to go involute).
Is there any smart trick to avoid the huge union?

Thanks in advance for any hint!

--
Sent from: http://forum.openscad.org/

I would like to design a gear with a very large number of teeth, about 1000. The problem is that the rendering time quickly becomes unpractical, even using simple triangular teeth (and I would like to go involute). Is there any smart trick to avoid the huge union? Thanks in advance for any hint! -- Sent from: http://forum.openscad.org/
AC
A. Craig West
Sun, Jun 23, 2019 3:58 PM

If you can write code to generate the shape of the gear as a polyhedron
directly, it would probably decrease the rendering time significantly. It
may also work to generate the shape in 2 dimensions using Union, and then
use linear_extrude to form the gear

On Sun, 23 Jun 2019, 11:47 DarioPellegrini, pellegrini.dario@gmail.com
wrote:

I would like to design a gear with a very large number of teeth, about
1000.
The problem is that the rendering time quickly becomes unpractical, even
using simple triangular teeth (and I would like to go involute).
Is there any smart trick to avoid the huge union?

Thanks in advance for any hint!

--
Sent from: http://forum.openscad.org/


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

If you can write code to generate the shape of the gear as a polyhedron directly, it would probably decrease the rendering time significantly. It may also work to generate the shape in 2 dimensions using Union, and then use linear_extrude to form the gear On Sun, 23 Jun 2019, 11:47 DarioPellegrini, <pellegrini.dario@gmail.com> wrote: > I would like to design a gear with a very large number of teeth, about > 1000. > The problem is that the rendering time quickly becomes unpractical, even > using simple triangular teeth (and I would like to go involute). > Is there any smart trick to avoid the huge union? > > Thanks in advance for any hint! > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
F
fred
Sun, Jun 23, 2019 4:05 PM

I had considered originally that the request was beyond my ability to contribute, but A. Craig West's answer caused my neurons to fire in a different direction. Inkscape has an extension (path to OpenSCAD) which generates points/faces from an SVG image. There are many gear generators which will output to SVG or similar.

I've found the version I have reduces the size of the created model, requiring to change the scale factor from 90/25.4 (or 25.4/90) to 1, but that's trivial.
If there are cavities in the original SVG, a polyhedron is created for each item, but not automatically subtracted from the primary mass. That's easily addressed. Identify the primary, move it to the top of the generated list and difference out all the rest.

On Sunday, June 23, 2019, 11:59:11 AM EDT, A. Craig West <acraigwest@gmail.com> wrote:  

If you can write code to generate the shape of the gear as a polyhedron directly, it would probably decrease the rendering time significantly. It may also work to generate the shape in 2 dimensions using Union, and then use linear_extrude to form the gear
On Sun, 23 Jun 2019, 11:47 DarioPellegrini, pellegrini.dario@gmail.com wrote:

I would like to design a gear with a very large number of teeth, about 1000.
The problem is that the rendering time quickly becomes unpractical, even
using simple triangular teeth (and I would like to go involute).
Is there any smart trick to avoid the huge union?

Thanks in advance for any hint!

--
Sent from: http://forum.openscad.org/


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


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

I had considered originally that the request was beyond my ability to contribute, but A. Craig West's answer caused my neurons to fire in a different direction. Inkscape has an extension (path to OpenSCAD) which generates points/faces from an SVG image. There are many gear generators which will output to SVG or similar. I've found the version I have reduces the size of the created model, requiring to change the scale factor from 90/25.4 (or 25.4/90) to 1, but that's trivial. If there are cavities in the original SVG, a polyhedron is created for each item, but not automatically subtracted from the primary mass. That's easily addressed. Identify the primary, move it to the top of the generated list and difference out all the rest. On Sunday, June 23, 2019, 11:59:11 AM EDT, A. Craig West <acraigwest@gmail.com> wrote: If you can write code to generate the shape of the gear as a polyhedron directly, it would probably decrease the rendering time significantly. It may also work to generate the shape in 2 dimensions using Union, and then use linear_extrude to form the gear On Sun, 23 Jun 2019, 11:47 DarioPellegrini, <pellegrini.dario@gmail.com> wrote: I would like to design a gear with a very large number of teeth, about 1000. The problem is that the rendering time quickly becomes unpractical, even using simple triangular teeth (and I would like to go involute). Is there any smart trick to avoid the huge union? Thanks in advance for any hint! -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
D
DarioPellegrini
Sun, Jun 23, 2019 4:10 PM

Unfortunately this gear is not supposed to have cylindrical symmetry as it is
actually carved on a 3d surface. But thinking about this made me remember
about the toothed_belt example of list_comprehension_demos. I am going to
try that as it is potentially pretty quick!

I am also familiar with the procedure of pre-computing the data to feed to a
polyhedron, although this is my last option since it will basically be:
/"code it yourself and then just use OpenSCAD to render"/

--
Sent from: http://forum.openscad.org/

Unfortunately this gear is not supposed to have cylindrical symmetry as it is actually carved on a 3d surface. But thinking about this made me remember about the toothed_belt example of list_comprehension_demos. I am going to try that as it is potentially pretty quick! I am also familiar with the procedure of pre-computing the data to feed to a polyhedron, although this is my last option since it will basically be: /"code it yourself and then just use OpenSCAD to render"/ -- Sent from: http://forum.openscad.org/
AC
A. Craig West
Sun, Jun 23, 2019 4:15 PM

What type of shape does it have? Linear_extrude has a fair amount of
flexibility with scaling, although that would be difficult to do for
sections that vary non-linearily, such as a sphere

On Sun, 23 Jun 2019, 12:11 DarioPellegrini, pellegrini.dario@gmail.com
wrote:

Unfortunately this gear is not supposed to have cylindrical symmetry as it
is
actually carved on a 3d surface. But thinking about this made me remember
about the toothed_belt example of list_comprehension_demos. I am going to
try that as it is potentially pretty quick!

I am also familiar with the procedure of pre-computing the data to feed to
a
polyhedron, although this is my last option since it will basically be:
/"code it yourself and then just use OpenSCAD to render"/

--
Sent from: http://forum.openscad.org/


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

What type of shape does it have? Linear_extrude has a fair amount of flexibility with scaling, although that would be difficult to do for sections that vary non-linearily, such as a sphere On Sun, 23 Jun 2019, 12:11 DarioPellegrini, <pellegrini.dario@gmail.com> wrote: > Unfortunately this gear is not supposed to have cylindrical symmetry as it > is > actually carved on a 3d surface. But thinking about this made me remember > about the toothed_belt example of list_comprehension_demos. I am going to > try that as it is potentially pretty quick! > > I am also familiar with the procedure of pre-computing the data to feed to > a > polyhedron, although this is my last option since it will basically be: > /"code it yourself and then just use OpenSCAD to render"/ > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RD
Revar Desmera
Sun, Jun 23, 2019 4:57 PM

If it helps any, the new gear code I put in BOSL2 (which as a library is still very alpha, not yet ready for release) renders a 1000 toothed spur gear or rack in about a second.  It takes 5 seconds for a 1000 tooth bevel gear. You can swipe code from it if it helps.

https://github.com/revarbat/BOSL2/blob/master/involute_gears.scad

  • Revar

On Jun 23, 2019, at 9:10 AM, DarioPellegrini pellegrini.dario@gmail.com wrote:

Unfortunately this gear is not supposed to have cylindrical symmetry as it is
actually carved on a 3d surface. But thinking about this made me remember
about the toothed_belt example of list_comprehension_demos. I am going to
try that as it is potentially pretty quick!

I am also familiar with the procedure of pre-computing the data to feed to a
polyhedron, although this is my last option since it will basically be:
/"code it yourself and then just use OpenSCAD to render"/

--
Sent from: http://forum.openscad.org/


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

If it helps any, the new gear code I put in BOSL2 (which as a library is still very alpha, not yet ready for release) renders a 1000 toothed spur gear or rack in about a second. It takes 5 seconds for a 1000 tooth bevel gear. You can swipe code from it if it helps. https://github.com/revarbat/BOSL2/blob/master/involute_gears.scad - Revar > On Jun 23, 2019, at 9:10 AM, DarioPellegrini <pellegrini.dario@gmail.com> wrote: > > Unfortunately this gear is not supposed to have cylindrical symmetry as it is > actually carved on a 3d surface. But thinking about this made me remember > about the toothed_belt example of list_comprehension_demos. I am going to > try that as it is potentially pretty quick! > > I am also familiar with the procedure of pre-computing the data to feed to a > polyhedron, although this is my last option since it will basically be: > /"code it yourself and then just use OpenSCAD to render"/ > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
D
DarioPellegrini
Sun, Jun 23, 2019 7:34 PM

I am "toothing" a polygonal-section-moebius ring (that's why it has so many
teeth).

I have found the list-comprehension-demos/toothed-belt.scad perfectly suited
for the case, handling thousands of teeth along whatever path in a matter of
seconds both in preview and rendering.

Thanks to all for the discussion!

--
Sent from: http://forum.openscad.org/

I am "toothing" a polygonal-section-moebius ring (that's why it has so many teeth). I have found the list-comprehension-demos/toothed-belt.scad perfectly suited for the case, handling thousands of teeth along whatever path in a matter of seconds both in preview and rendering. Thanks to all for the discussion! -- Sent from: http://forum.openscad.org/
D
DarioPellegrini
Tue, Jun 25, 2019 4:46 PM

And here is the result:

http://forum.openscad.org/file/t2340/Screenshot_from_2019-06-25_18-42-47.png

And the unbelievably simple and compact code which renders in just 2 seconds
on my machine:

use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <list-comprehension-demos/skin.scad>

// Moebius Parameters
p = 3;
q = 1;
R = 80;
r = 10;

// Belt parameters
teeth = 800;
belt_width = r*sqrt(3);
tooth_height = 1;
belt_thickness = 3;

path_moeb = [for(t = linspace(0,360,teeth4))
rotation(axis=[0,0,t
p])translation(v=[R,0,0])
rotation(axis=[0,t,0])*translation(v=[-r/2,0,0])
];

belt_moeb = [ for (i=[0:len(path_moeb)-1]) let(tooth=floor(i/2)%2)
transform(path_moeb[i] *
rotation(axis=[0,0,180]) *

scaling([tooth?((belt_thickness-tooth_height)/belt_thickness):1,1,1]) *
translation([belt_thickness/2,0,0])*
rotation(axis=[90,0,0]),
rectangle_profile([belt_thickness,belt_width])
)
];

skin(belt_moeb);

////////////////

function linspace(start,stop, n) = let (step=(stop-start)/n)
concat( [ for (i = [0:1:n-0.1]) start+i*step], stop);

--
Sent from: http://forum.openscad.org/

And here is the result: <http://forum.openscad.org/file/t2340/Screenshot_from_2019-06-25_18-42-47.png> And the unbelievably simple and compact code which renders in just 2 seconds on my machine: use <scad-utils/transformations.scad> use <scad-utils/shapes.scad> use <list-comprehension-demos/skin.scad> // Moebius Parameters p = 3; q = 1; R = 80; r = 10; // Belt parameters teeth = 800; belt_width = r*sqrt(3); tooth_height = 1; belt_thickness = 3; path_moeb = [for(t = linspace(0,360,teeth*4)) rotation(axis=[0,0,t*p])*translation(v=[R,0,0])* rotation(axis=[0,t,0])*translation(v=[-r/2,0,0]) ]; belt_moeb = [ for (i=[0:len(path_moeb)-1]) let(tooth=floor(i/2)%2) transform(path_moeb[i] * rotation(axis=[0,0,180]) * scaling([tooth?((belt_thickness-tooth_height)/belt_thickness):1,1,1]) * translation([belt_thickness/2,0,0])* rotation(axis=[90,0,0]), rectangle_profile([belt_thickness,belt_width]) ) ]; skin(belt_moeb); //////////////// function linspace(start,stop, n) = let (step=(stop-start)/n) concat( [ for (i = [0:1:n-0.1]) start+i*step], stop); -- Sent from: http://forum.openscad.org/