You are on page 1of 7

FreeCAD

 Board index  Development  Developers corner 

involute gear generator preview

Post Reply  Search this topic…


  130 posts  1 2 3 4 5 … 13 


neondata

involute gear generator preview 

Tue Mar 05, 2013 1:19 pm
P
I have modified the gear macro in FreeCad0.13\Mod\PartDesign\Scripts in different ways

The Gui is modular and the gear body is now created as an extrusion of the circumference.

This is the first version that created a gear, so it is not cleaned up. Needs some further optimization.

Enjoy, if possible!

Code: Select all


Involute Gears Generation Script
#by Marcin Wanczyk (dj_who)
#(c) 2011 LGPL

# Changes: NeonData
#
import FreeCAD, FreeCADGui, Part, Draft, math, MeshPart, Mesh
from PyQt4 import QtGui,QtCore
App=FreeCAD
Gui=FreeCADGui

def MakeCircle(Name, Radius, StartAngle, StopAngle):
    bCircle = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",Name)

jmaustpc

Re: involute gear generator preview 

Tue Mar 05, 2013 1:38 pm
P
Hi neondata

I needed to add a "#" on the first line to make it work.

Obviously a work in progress, but I did indeed get a gear! And a few flat circular faces etc.

Jim

neondata
Re: involute gear generator preview 

Tue Mar 05, 2013 5:49 pm
P
I made some changes, the gears look nice. For now.

As always: little things make a large difference. The teeth were unevenly spaced: reason: the rotational

matrix angle was calculated:

Code: Select all

        angle = math.radians((tooth*360)/N)

After changing to

Code: Select all

        angle = math.radians((tooth*360.)/N)

it works much better! As it should be.

This is the code so far. Creating larger number of teeth, the runtime is quite long. It should be better to

do the calculation completely in python and not to use the features to speed up the process.

Code: Select all


#Involute Gears Generation Script
#by Marcin Wanczyk (dj_who)
#(c) 2011 LGPL

# Changes: NeonData, 2013/03/5, still not good! but creates closed stl and step output.
#                               known issue: base diameter can be less than root diamet
er.
#                               input parameters should be changed to follow DIN, whate
ver that means.
#

# known issue: the hide() doesnt work if the number of teeth is 68, but macro can be re
started anyway (windowsXP professional, Vers FreeCad 0.13stable

NormandC

Re: involute gear generator preview 

Wed Mar 06, 2013 2:13 am
P
Congrats, this gives a much nicer gear than the previous script which generated a billion faces on its top

and bottom planar surfaces.

But I wonder why the teeth must be made of small straight line segments instead of a true arc or curve?

And what if, instead of producing a very complex face to extrude, you started with a cylinder, created a

"tooth cut" and patterned it along the cylinder, would that make the gear script faster?

I have almost no python experience, see attached primitive and non-functional gear modeled in the GUI

to see what I mean.

Attachments

 primitive_gear.fcstd
this is no way a real gear, just an example to show the suggested method of building the gear.
(35.33 KiB) Downloaded 82 times

jmaustpc

Re: involute gear generator preview 

Wed Mar 06, 2013 3:18 am
P
Hi

It produced the following out put in red, so I thought it was an error message, but according to Google

translate it is "new calculation".

Neue Berechnung......

tooth height 1.320031098..

addendum diameter 42.000989482..

pitch diameter 40.800961211..

base diameter 39.4107021712..

root diameter 39.3609272859..

It is very slow, but it does make a gear.

Jim

neondata
Re: involute gear generator preview 

Wed Mar 06, 2013 9:38 am
P
Hi,

I also was surprised that computation takes so long, that is the reason why I think about creating the

profile completely by program. But that will take time. I am not involved in gear shaping, so I just

streamlined the original software. The output in red is just to dump the internal values. It happens that

the base diameter is less than the root diameter, depending on input parameters. That is not realistic and

I tried to identify this behavior.

But whatever: it creates a nice gear, rather fast when teeth number is low, and you can output a step

which again can be the base for a fully specified gear with center bore etc. Works nicely, I printed one

with my 3-d printer


jmaustpc

Re: involute gear generator preview 

Wed Mar 06, 2013 10:49 am
P

“ neondata wrote:

Works nicely, I printed one with my 3-d printer

Well that's the ultimate proof that it works!


eslavko

Re: involute gear generator preview 

Thu Apr 11, 2013 8:56 am
P
I'm new to FreeCAD and can't start this script.

Is there need to be installed or what.

I just paste it to python console and got errors...

>>> h = 2*y*m+c #tooth height

File "<input>", line 1


File "<input>", line 1

h = 2*y*m+c #tooth height

IndentationError: unexpected indent

>>>

neondata

Re: involute gear generator preview 

Thu Apr 11, 2013 9:04 am
P
When doing copy and paste it may happen that indentations are disturbed. Create a macro, paste to the

editor and run the macro, that's much saver and allows to debug without unnecessary problems. Also:

never mix tabs and blank for indentation, that sometimes happens when old code is modified

eslavko

Re: involute gear generator preview 

Thu Apr 11, 2013 9:49 pm
P
Se where to get that macro/file. I see just on this page and can only copy/paste or what?

Display posts from previous: All posts Sort by Post time Ascending Go

Post Reply   2 3 4 5 … 13 

130 posts 1

 Board index  Development  Developers corner


Powered by phpBB® Forum Software © phpBB Limited

You might also like