jnweiger / inkscape-gears-dev Goto Github PK
View Code? Open in Web Editor NEWEnhanced version of the well known gears extension, allows spokes, center cross, metric module, best evolute shape ...
Enhanced version of the well known gears extension, allows spokes, center cross, metric module, best evolute shape ...
I see numerous rules about profile shifting appearing when pressure angles and Teeth get below a certain ratio.
E.g. "Gears that are smaller than 32 teeth for a 14.5° Pressure Angle, or 18 teeth for a 20° Pressure Angle, have a Root Circle smaller than the Base Circle, resulting in the teeth being undercut."
This doc shows how to determine if undercut will occur. Pitch shift can be both positive (usual) and negative(rare).
Negative looks cool - I expect it weakens the gear tooth so undesireable but does look interesting. pg 604 ( doc starts at 595).
Should we detect undercut and auto shift or just annotate and ask (and maybe add a page about undercut to the tabs) ?
I want to generate inner gears. . I have adapted existing code that generates outer?? gears through intuition. I am not a mechanical engineer and cant seem to find theory for inner gears either. Can someone with understanding of the theory validate the adapted code? It seems to do what I want, though.
Thank you so much for your time!
def involute_intersect_angle(Rb, R):
Rb, R = float(Rb), float(R)
return (sqrt(Rb**2 - R**2) / (R)) - (acos(R / Rb))
def effect(self):
teeth = self.options.teeth
pitch = self.unittouu( str(self.options.pitch) + self.options.unit)
angle = self.options.angle # Angle of tangent to tooth at circular pitch wrt radial line.
centerdiameter = self.unittouu( str(self.options.centerdiameter) + self.options.unit)
# print >>sys.stderr, "Teeth: %s\n" % teeth
two_pi = 2.0 * pi
# Pitch (circular pitch): Length of the arc from one tooth to the next)
# Pitch diameter: Diameter of pitch circle.
pitch_diameter = float( teeth ) * pitch / pi
pitch_radius = pitch_diameter / 2.0
# Base Circle
base_diameter = 2 * pitch_diameter - pitch_diameter * cos( radians( angle ) )
base_radius = base_diameter / 2.0
# Diametrial pitch: Number of teeth per unit length.
pitch_diametrial = float( teeth )/ pitch_diameter
# Addendum: Radial distance from pitch circle to outside circle.
addendum = 1.0 / pitch_diametrial
# Inner Circle
inner_radius = pitch_radius - addendum
inner_diameter = inner_radius * 2.0
# Tooth thickness: Tooth width along pitch circle.
tooth = ( pi * pitch_diameter ) / ( 2.0 * float( teeth ) )
# Undercut?
undercut = (2.0 / ( sin( radians( angle ) ) ** 2))
needs_undercut = teeth < undercut
# Clearance: Radial distance between top of tooth on one gear to bottom of gap on another.
clearance = 0.0
# Dedendum: Radial distance from pitch circle to root diameter.
dedendum = addendum + clearance
# Root diameter: Diameter of bottom of tooth spaces.
root_radius = pitch_radius + dedendum
root_diameter = root_radius * 2.0
half_thick_angle = two_pi / (4.0 * float( teeth ) )
pitch_to_base_angle = involute_intersect_angle( base_radius, pitch_radius )
pitch_to_inner_angle = involute_intersect_angle( base_radius, inner_radius ) - pitch_to_base_angle
centers = [(x * two_pi / float( teeth) ) for x in range( teeth ) ]
points = []
for c in centers:
# Angles
pitch1 = c - half_thick_angle
base1 = pitch1 - pitch_to_base_angle
inner1 = pitch1 + pitch_to_inner_angle
pitch2 = c + half_thick_angle
base2 = pitch2 + pitch_to_base_angle
inner2 = pitch2 - pitch_to_inner_angle
# Points
b1 = point_on_circle( base_radius, base1 )
p1 = point_on_circle( pitch_radius, pitch1 )
i1 = point_on_circle( inner_radius, inner1 )
b2 = point_on_circle( base_radius, base2 )
p2 = point_on_circle( pitch_radius, pitch2 )
i2 = point_on_circle( inner_radius, inner2 )
if root_radius < base_radius:
pitch_to_root_angle = pitch_to_base_angle - involute_intersect_angle(base_radius, root_radius )
root1 = pitch1 - pitch_to_root_angle
root2 = pitch2 + pitch_to_root_angle
r1 = point_on_circle(root_radius, root1)
r2 = point_on_circle(root_radius, root2)
p_tmp = [r1,p1,i1,i2,p2,r2]
else:
r1 = point_on_circle(root_radius, base1)
r2 = point_on_circle(root_radius, base2)
p_tmp = [r1,b1,p1,i1,i2,p2,b2,r2]
points.extend( p_tmp )
path = points_to_svgd( points )
How difficult do you think it would be to make it able to draw internal (ring) gears ?
Where the teeth are all on the inside.
Hi... I don't know what is going on but as far as I can see Inkscape can't 'see' this extension. I tried putting the extracted files in the normal extensions folder and that didn't work. I also tried putting them in the exact peculiar place that this github entry suggests and that also didn't work. I am using Windows 7 Home Professional 64 bit and Inkscape 0.92 64 bit. Where is this extension supposed to appear? In the extensions menu? Any help would be appreciated.
What's involved in adding an option to draw cycloids instead of involutes. I know cycloids are not as good for high speed gears as they slide.
But for pin gears they work well, especially for gears with a very small number of teeth (where involutes do not work as well).
I'm inspired by Mattias's video for his excellent program:
V1 walkthrough: https://www.youtube.com/watch?v=Hf9NoDT5nDk&feature=youtu.be
V3 features: https://www.youtube.com/watch?v=9MycFQKnZkA
(wish he exported svg)
The rack plugin was a simple linear ramp and not involutes on an infinite radius sphere. Also calc is not right for tooth width.
Seems like the math would simplify with an infinite radius sphere...?
[later]
Haha - it does simplify to a linear ramp :)
Found a gear theory pd here: http://www.micro-machine-shop.com/gear_theory.pdf
and it says that involute racks have straight sides. So if we can just get the pitch calc right and make teeth the right size - we're done.
[later]
Well almost done the bottom of the tooth should be curved - stronger I guess.
Any ideas on that ?
Should we add as an option to have curve or straight bottom ?
Hi, my second issue is that sometimes I want to generate gears which are solid except for the mounting hole. This involves not having spokes, only the centre hole. But when I set "Number of holes" to zero (this setting affects the number of holes in the body of the gear, not the mounting hole), the mounting hole also is not generated. The expected behaviour should be for the mounting hole to remain there for as long as its diameter is set above zero.
edit: Hm, this doesn't seem to always happen. Will investigate some more.
I changed gear-dev.py
as follows:
It is intended to work with http://openscad.org/ and http://www.cammill.org/
Source code and shell scripts: https://github.com/koppi/involute-gear-collection
Have fun!
Do you think we should try to get it into the 0.91 release - now in chill ?
Will you continue(re-raise) your discussion on dev list ?
I'm not an expert, but it seems to me that gear teeth should mesh 'rounded top-to-rounded top'.
Is this proper for an internal gear ... ? http://i1260.photobucket.com/albums/ii564/BitHead77/ring_teeth_zps3bxx8sjb.jpg
....
I had an idea. When we've got it working. How about refactoring it so effect() calls a routine to print a gear with given parameters.
If we did that then we could have the UI define a number of gears and do a gear train. One tab for each gear (another tab for the common settings). We can then also annotate the ratios of driven to other gears and show the simple spur gear calculations.
The user could then choose to cut each out and mount then in any way (stacked or chained edge to edge, etc) but because we did the calcs - they would know reduction ratios etc.
I'm thinking something like seen in this:
http://uqu.edu.sa/files2/tiny_mce/plugins/filemanager/files/4280336/machines/GEARS%20Lec-12.pdf
Where the user defines for each tab whether gear is locked to previous tab or meshes with previous. First tab is driver.
We'd make (4 or 6) tabs and let user use only those they needed (probably just first two for classic pinion/spur).
Visually - layout each gear non meshing (so they can be printed,laser cut, whatever..) but maybe draw a simple representation of stacked or meshed layout with just circles as a layout guide.
What do you think of this idea.
To attach a gear to a shaft is frequently done with a slotted keyway instead of a single hole.
In metric there is a preferred slot size based on shaft diameter. Most of the time this resolves to a single value for a given diameter of shaft. (py 737 in doc referenced in profile shifting issue #9).
I don't know what happens for US imperial inch based systems.
So we could modify the hole to add a keyway as an option (basically cutting a rectangle slot).
What do you think...?
Do you know if imperial also has a table we can lookup for preferred key slots sizes ?
inkscape 1.2 unter WIN10/64
von https://github.com/jnweiger/inkscape-gears-dev
habe ich das .zip herunter geladen, entpackt und die Dateien gears-dev. inx sowie gears-dev.py nach
C:/Program Files/ Inkscape/share/inkscape/extensions kopiert.
Leider bekomme ich beim Aufruf folgende Fehlermeldung:
C:\Program Files\Inkscape\bin\pythonw.exe: can't find 'main' module in 'C:\Program Files\Inkscape'
Was habe ich falsch gemacht oder vergessen?
Unter Erweiterungen/Rendern sind zwei Einträge Gear-dev ... zu finden. Jeder produziert diese Fehlermeldung
in der https://inkscape.org/gallery findet sich leider kein gears
Danke für jeden Tipp
Hi and thx for this useful tool, :)
I used it with an older version of Inkscape but it doesn't show up in Inkscape menu in version .91 anymore, any idea, workaround or fix for it? as I remember it was under Extensions/render/gear menus, right?
Regards,
mim
Gears with low tooth count and small pressure angles can cause undercut.
Since commit b0f3707 we produce undercut warnings. The gear we generate does not handle the undercut at all. We should attempt to draw the undercut correctly, if the user chosses to use the gear despite the warning.
(... and we should implement profile shift too, see #9 )
Using Inkscape 1.1.2 (1:1.1+202202050950+0a00cf5339), and anything I try to do (live preview, apply) that would change the drawing leads to this set of messages.
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "gears-dev.py", line 723, in <module>
e = Gears()
File "gears-dev.py", line 404, in __init__
self.arg_parser.add_argument("", "--clearance",
File "/usr/lib/python3.8/argparse.py", line 1366, in add_argument
kwargs = self._get_optional_kwargs(*args, **kwargs)
File "/usr/lib/python3.8/argparse.py", line 1496, in _get_optional_kwargs
if not option_string[0] in self.prefix_chars:
IndexError: string index out of range
I have minimal understanding of how all this works, but I did notice that this appears to be the first self.arg_parser.add_argument line in the .py file that has an empty string as the first arg. A quick search suggests that argparse barfing on empty strings was fixed 10 years ago, but nevertheless?
thanks.
my math is faulty. :(
In generate_spokes_path()
I test for overlapping spokes at mount_radius.
If overlapping, I increase mount_radius.
My test is:
if spoke_width * spoke_count +0.5 >= two_pi * mount_radius:
My intention was to calculate the circumference assuming mount_radius and check to see if calculated spoke circumference was larger.
But I think a better calc is to calc angle subtended by N spokes (3 spokes=120 deg) vs calculated angle if isoceles tri had base of spoke_width.
i.e. radius = 2a cos(alpha) where a = spoke_width
but for low spoke_counts angle is > 90 so my math skills fail. (too tired - sad really...)
Also having failed the test - it seems like it should be possible to calculate by how much the mount radius should be increased so that the spokes do not overlap.
Can you help ?
Using Inkscape 0.91pre4 r13712 on Windows generates the following error:
Traceback (most recent call last):
File "gears-dev.py", line 742, in
e.affect()
File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect
self.effect()
File "gears-dev.py", line 532, in effect
unit_factor = self.calc_unit_factor()
File "gears-dev.py", line 492, in calc_unit_factor
dialog_units = inkex.uutounit(1.0, self.options.units)
AttributeError: 'module' object has no attribute 'uutounit'
In the inx file the second line is an id line
<id>org.ekips.filter.gears-dev</id>
This format (looking at the others - seems to be a reverse namespace order.
There is an ekpis.org and they guy there has a github account.
Perhpas the id should be something like
com.github.jnweiger.gears-dev
in inkscape the tendency is to convert units using the builtin functions.
In 0.91 (coming soon) its:
self.width = inkex.unittouu( str(self.options.width) + self.options.units )
where self.options.units = "mm" (say)
then do calcs in the units specified.
docs:
It would be worth checking that the existing inkscape G-code export plugins generate the right thing with these gears...
The guy who makes this program on idle amusements - might be interested in helping us make this part work.
http://www.idleamusements.com/?page_id=54
This plugin does a great job of unordinary gears.
It simply rotates the curve in a swept angle and performs a boolean op to union all the intersections of the resulting swept curves.
http://www.cnc-club.ru/forum/viewtopic.php?f=33&t=433
There is no current way in inkscape to call the boolean ops from a plugin. I've been trying to get a method for years but to no avail (almost worked with dbus implementation but only available on linux).
So this manual method is all that is available - but it does work quite well.
Problem with this empirical approach is you need to set the number of sample curves up to a very high number to avoid 'bumps' in the result.
My question is can we do a similar job by tracking that line like it was a string caught between the gears and doing it differently.
Especially if we were calculating that value by using the tangent and normal equations so getting an 'exact' sample.
As an example - which shows this working visually but has no available code - look at this program:
link in comment: https://onedrive.live.com/?cid=f76d3d4757659a50&id=F76D3D4757659A50!172
https://www.youtube.com/watch?v=cjCT9E0Wh1w
Its pretty cool but you must enter the gear shape with an equation like:
sin(3t)+3 or sin(5t) + cos(2t) + 3 or by adding a sin function on top with a small radius to simulate a gear profile - as seen in the youtube videos.
A hand drawn gear (like the dolphin below done in first program above) would be nice to also simulate.
Any ideas ?
Hey, I've been having two issues (I'll report the second one separately).
When I create many (dozens of) gears, Inkscape's memory usage becomes obscenely high. Eventually, I cannot create more because of the "Can't Spawn!!! spawn returns: Failed to fork (Cannot allocate memory)" error message. I'm using Inkscape 0.48 from the Ubuntu repositories, on Linux Mint 13. The problem resolves itself if I restart Inkscape.
The clearance factor adds to the dedendum but in Ring gears this encroaches on inner surface which prevents gear mesh.
I am using mm on both the document and the gears-dev settings.
The annotation text has the correct dimensions in mm, but everything is drawn much to small. I re-introduced my old hack of multiplying everything (unit_factor) by 90/25.4 so that the gear is drawn to scale.
My assumption is that the inkscape svg code always uses a unit of 90dpi, even when the user asks for document units of mm. Seen with inkscape 0.48.4
Hi,
I downloaded the two files gears-dev.inx and gears-dev.py to my computer
But in the menu extensions-render the menu-item gear-dev is not shown.
So I did a rollback to a earlier version of gear-dev but then I got the error from issue 24
AttributeError: 'module' object has no attribute 'uutounit'
If I combined the new fixed gears-dev.py with the old gears-dev.inx I got another error
something about wrong doctype html don't remember exactly
So finally I googled for the error AttributeError: 'module' object has no attribute 'uutounit'
and did the fix manually again.
Anyway the written instruction
"Copy the two files gears-dev.inx and gears-dev.py to your computer:"
does not work. the file gears-dev.inx need to be revised to create a menu-item "dev-gear" in InkScape
And the instructions should be improved by adding with something like
"a new menu-Item named "Gear-Dev" will show up under
extensions-render
It is very important to give a description of the WHOLE click-path where to find the function.
Imagine a new user knowing almost nothing about InkScape and the instructions just say
click on "dev-gear". The new user will not know where to find it.
best regards
Stefan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.