Parametric hyperbolic worm gear scripts

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Parametric hyperbolic worm gear scripts

Rob321456
I'm trying to use OpenSCAD to make a worm gear, I've realised that making a
worm gear in software like OpenSCAD where you can do it with parameters you
can easily change is going to be much easier than trying to make such a
complex shape (curvature in all 3d dimensions at once if I'm not mistaken)
in a normal GUI and tool based CAD package. But I've been looking around
online and while I've found some scripts for normal worm gears I couldn't
find any for hyperbolic ones, the difference being that a hyperbolic one has
more loops of the worm pushing on more teeth of the gear at once hence
reduces the chance of tooth breakage on the toothed gear or snapping of
loops on the worm gear when they are both made with weak materials. I found
some hyperbolic worm gear designs online but couldn't find scripts which
produced them, they may have been mainly done in GUI and tool based CAD
packages rather than command line controlled things like OpenSCAD. Below I
attach two links showing what a hyperbolic worm gear looks like:

https://cdn.thingiverse.com/renders/b9/5f/25/80/c4/IMAG0407_c_preview_featured.jpg

http://cxkg.net/wp-content/uploads/2014/10/Screen-Shot-2014-10-18-at-18.34.17.png

There was one page I found on thingiverse
https://makerware.thingiverse.com/thing:2170559 but this only seems to
generate the hyperbolic worm gear, not the toothed gear which will be driven
by it, and I really need a script which will generate both and have them in
their relevant positions as I can't work out how to build a proper involute
gear, much less one which can interlock with a specific worm gear. I did
find https://www.thingiverse.com/thing:8821/#files but it is not hyperbolic
so won't handle the stresses that my design needs to take as all the force
will be concentrated on only one or two teeth at once. In many ways that
non-hyperbolic script is exactly what I need, I can easily customise the
number of teeth and the size of the gear and worm, plus the gear and worm
are both genrated in the appropriate positions, except ofcourse it isn't
hyperbolic. I also found this
http://cxkg.net/hyperbolic-worm-gear-in-openjscad/ which seems to make the
right shape, but it wouldn't run when I pasted it into openSCAD's text box,
instead giving an error in syntax on line 2. So I'm hoping someone can point
me towards a script which generates hyperebolic worm gears, plus the toothed
gears they interlock with, and works out the spacing between the worm and
toothed gear for relative positioning, and has parameters a user can easily
edit, just like the non-hyperbolic worm gear script has. Or otherwise I'm
hoping someone can help me debug the cxkg.net script for a hyperbolic worm
gear. I'm brand new to OpenSCAD but know that if I can find some scripts
which produce the tricky forms (worm gears, properly involute cogs...) then
OpenSCAD will be a really great tool to generate stl files of parts which I
can then import into other software to refine and add things like holes on
the axis or design mounts that the gars can fit to.

Thank you



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parametric hyperbolic worm gear scripts

Neon22
Use inkscape to make the toothed gear - you can adjust all useful
parameters.
Then export to OpenSCAD.
- https://github.com/ssentinel/inkscape-gears-dev/
- https://www.thingiverse.com/thing:1065500


On 12/15/2017 3:17 AM, Rob321456 wrote:

> I'm trying to use OpenSCAD to make a worm gear, I've realised that making a
> worm gear in software like OpenSCAD where you can do it with parameters you
> can easily change is going to be much easier than trying to make such a
> complex shape (curvature in all 3d dimensions at once if I'm not mistaken)
> in a normal GUI and tool based CAD package. But I've been looking around
> online and while I've found some scripts for normal worm gears I couldn't
> find any for hyperbolic ones, the difference being that a hyperbolic one has
> more loops of the worm pushing on more teeth of the gear at once hence
> reduces the chance of tooth breakage on the toothed gear or snapping of
> loops on the worm gear when they are both made with weak materials. I found
> some hyperbolic worm gear designs online but couldn't find scripts which
> produced them, they may have been mainly done in GUI and tool based CAD
> packages rather than command line controlled things like OpenSCAD. Below I
> attach two links showing what a hyperbolic worm gear looks like:
>
> https://cdn.thingiverse.com/renders/b9/5f/25/80/c4/IMAG0407_c_preview_featured.jpg
>
> http://cxkg.net/wp-content/uploads/2014/10/Screen-Shot-2014-10-18-at-18.34.17.png
>
> There was one page I found on thingiverse
> https://makerware.thingiverse.com/thing:2170559 but this only seems to
> generate the hyperbolic worm gear, not the toothed gear which will be driven
> by it, and I really need a script which will generate both and have them in
> their relevant positions as I can't work out how to build a proper involute
> gear, much less one which can interlock with a specific worm gear. I did
> find https://www.thingiverse.com/thing:8821/#files but it is not hyperbolic
> so won't handle the stresses that my design needs to take as all the force
> will be concentrated on only one or two teeth at once. In many ways that
> non-hyperbolic script is exactly what I need, I can easily customise the
> number of teeth and the size of the gear and worm, plus the gear and worm
> are both genrated in the appropriate positions, except ofcourse it isn't
> hyperbolic. I also found this
> http://cxkg.net/hyperbolic-worm-gear-in-openjscad/ which seems to make the
> right shape, but it wouldn't run when I pasted it into openSCAD's text box,
> instead giving an error in syntax on line 2. So I'm hoping someone can point
> me towards a script which generates hyperebolic worm gears, plus the toothed
> gears they interlock with, and works out the spacing between the worm and
> toothed gear for relative positioning, and has parameters a user can easily
> edit, just like the non-hyperbolic worm gear script has. Or otherwise I'm
> hoping someone can help me debug the cxkg.net script for a hyperbolic worm
> gear. I'm brand new to OpenSCAD but know that if I can find some scripts
> which produce the tricky forms (worm gears, properly involute cogs...) then
> OpenSCAD will be a really great tool to generate stl files of parts which I
> can then import into other software to refine and add things like holes on
> the axis or design mounts that the gars can fit to.
>
> Thank you
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
> ---
> This email has been checked for viruses by AVG.
> http://www.avg.com
>
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parametric hyperbolic worm gear scripts

Parkinbot
In reply to this post by Rob321456
There are 2 viable solutions.

The first one is the easiest, uses the least code, but uses a lot of CPU
time. It carves out the worm gear by cycling a rotating gear around a
cylinder - just like a tool would craft it.  
Here is some code which uses a spur gear and my *gears* library. Follow the
link to download it and get a description how it works - actually it follows
the same idea. For best results, you should use an appropriate helical gear
also for carving (caution: very slower render, especially in F6!)


> include
> <gears.scad>
>  // https://www.thingiverse.com/thing:636119
>
> steps = 30; // refinement of carving
> dw = 360/steps;
> verbose = false;
> z=40;  // # of teeth
>
> difference() // the worm
> {
>   rotate([90,0,0])  cylinder(r = 15, h= 100, center = true);
>   for(i=[0:steps])
>     rotate([0, 360/steps*i, 0])  // cycle around
>     translate([50, 0, 0]) rotate([0, 0, i*dw/z]) gear(z=z, m=2);  // shift
> and rotate the gear
> }
> translate([50, 0, 0]) gear(z=z, m=2);  // the gear

<http://forum.openscad.org/file/t887/worm.png>

the second approach is more sophisticated and will give you way better and
faster results. It uses hulling on the basis of a series of objects that
results from code like this:


> use
> <gears.scad>
> // ...  
> linear_extrude(height = .001)
> difference()
> {
>   translate([0, -12])
>   square([100, 20], center = true);
>   translate([0, -55])
>   rotate([0, 0, dw])
>   gear2D(m=2, z=40);
> }

The most sophisticated approach is also the fastest and uses sweep() or
skin(). The problem is that this modules expect affine descriptions of a
series of 2D-polygons (a list of a list of 3D-points), which my code does
not deliver, as OpenSCAD hasn't support for this. To get it try either:

1. find code to generate your involute gear in an affine way. There is a
library coming with OpenSCAD for that and many others in thingiverse.  
2. use my union-two-half-sweeps technique (described in
https://www.thingiverse.com/thing:1659079 ) to do a 360/z degrees twisted
ring.
3. difference the twisted ring from your rod.






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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parametric hyperbolic worm gear scripts

Parkinbot
Found some more time, so I can further elaborate on the second and third
approach.  
The second approach I mentioned, "hulling", does not use hull(). It is a
union of a series of slices that creates a hull and is best extruded using
rotate_extrude(), currently only available in dev snapshots. In the
following code I also skewed it a bit using a trial and error value in favor
of a smoother slope approximation. F6-Rendering took 16 minutes and produced
a valid result.

use <gears.scad>
z=40;
step = 6;
skew_val = -0.06;
skewZ = [ [ 1  , 0  , 0  , 0   ],
      [ 0  , 1  , 0, 0   ],  // skew value; pushed along the y axis
      [ 0  , skew_val  , 1  , 0   ],
      [ 0  , 0  , 0  , 1   ] ] ;

for(dw=[0:step:359])
{
  rotate([0, 0, dw])
  multmatrix(skewZ)             // skew transformation
  rotate_extrude(angle = step+.001) // little overlapping to avoid CGAL
problems
  rotate([0, 0, 90])
    difference()
    {
      translate([0, -12])
      square([100, 20], center = true);
      translate([0, -55])
      rotate([0, 0, dw/z])
      gear2D(m=2, z=z);
    }
}

<http://forum.openscad.org/file/t887/worm1.png>


The third approach can also done with my lib code, but is a little more
tricky, as it involves a trival export/import loop with OpenSCAD and an
editor (or an external script). First we render our gear in 2D

use <gears.scad> // https://www.thingiverse.com/thing:636119
 gear2D(m=2, z=40);

and save it in SVG format (dev snapshot required).
The SVG can be easily converted into a scad file using an editor.

1. delete the first 5 lines
2. replace "M" -> "mygear = [[" in first line
3. delete the last 2 lines
4. replace "z" -> "]];" in last line
5. search and replace all "L" -> "],["
6. save as .scad file e.g. as mygear.scad

Now you have an affine definition of the gear, which can be easily included
into OpenSCAD and used to compose the trajectory data consumed by sweep().
See the following code which uses another library of mine defining a sweep()
module and a bunch of valuable affine transformations - like Tx_ and Rz_ -
for translation and rotation along/around an axis.
While it can have some ugly F5-result, F6 workes well (with valid result).
F6-Rendering took 2.5 minutes on my machine with most of the time consumed
by the two Boolean operations. Note that I used a different radius and
cylinder but the same gear as before.  

use <naca_sweep.scad> // https://www.thingiverse.com/thing:900137
include <mygear.scad> // converted SVG, defines the variable mygear

z = 40;

Half1 = [for(i = [0:6:180]) Rz_(-i, Rx_(90, Tx_(50, Rz_(i/z,
vec3D(mygear)))))];
Half2 = [for(i = [180:6:360]) Rz_(-i, Rx_(90, Tx_(50, Rz_(i/z,
vec3D(mygear)))))];

difference()
{
  cylinder(r = 15, h= 100, center = true);
  sweep(Half1);  
  sweep(Half2);  
}
<http://forum.openscad.org/file/t887/worm2.png>






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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parametric hyperbolic worm gear scripts

Rob321456
In reply to this post by Parkinbot
ParkinBot 11:14 post, thanks for your pieces of code, the first one makes
exactly what I want, however it seems to be a very high polygon count object
which will make it trickier to import into other programs for assembly into
larger structures of parts. It took a while to compile but that wasn't a
problem, however it was also very freezy to navigate around the viewport and
look at the object once the compiling was done. Your second script only made
a a small cross-sectional slice through a worm gear, an error was thrown
about the variable "dw" being undefined. You might have missed something out
from earlier in the code?

Parkinbot 2:22am post, I'm really new to openSCAD could you just explain
those export and import, especially the it about what to do after editing
the exported file in a text editor and saving as mygear.scad, steps again
with slightly clearer detail. The first piece of code you included in this
post generates a worm gear but it doesn't look anything like the one in your
image. Thanks



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parametric hyperbolic worm gear scripts

Parkinbot
Rob
sorry, I was some days in the "outback". The second piece of code in my
first post was not meant to be complete. It showed just the core part of the
second approach. An hour later or so I read your post again and thought you
might be confused about this, so I wrote the remaining pieces of code in a
fully functional way and posted it a bit in a hurry because I had to catch
my plane ...  
So here are some hints:

1. Please make sure you are using a newer development snapshot. Get it at
http://www.openscad.org/downloads.html after scrolling down to the section
"Development Snapshots".
2. try the code again. The second approach should work now because
rotate_extrude has been revised some time ago to accept an angle paramter.
3. Now after F6 you should also be able to export the two lines defining the
gear2D as SVG. Save it into some (project) folder and follow the
instructions.
4. the last piece of code is a fully functional program which includes the
SCAD file you saved after your edit. It is important to also save it into
the same (project) folder otherwise F5 or F6 will report errors. (OpenSCAD
needs to know the folder to resolve the filename if no path is given).

let me know if this helped ...




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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org