jcdammeyer
Senior Member
I've updated my copy of the GearGenerator Script so that I can use module instead of Pitch Diameter. I'd also like to be able to specify internal or external gears like FreeCAD can.
Here's the python code with the changes.
Where do I find documentation on AddGearNP(...)? Is one of the other parameters for inner or outer?
Thanks
John
Here's the python code with the changes.
# Gear Generator Script
# Used as a demonstration of how to create a custom utility
# for use with Alibre Design
# 18DEC2021 -- John Dammeyer
# -- Added Module parameter
Units.Current = UnitTypes.Millimeters
# default settings
NumberofTeeth = 20
Module = 1.0
PitchDiameter = 0
PressureAngle = 20
Thickness = 3
Win = Windows()
ScriptName = 'Gear Generator'
# create dialog window and show to user
Options = []
Options.append([None, WindowsInputTypes.Image, 'GearGenerator.png', 170])
Options.append(['Number of Teeth', WindowsInputTypes.Integer, NumberofTeeth])
Options.append(['Module (mm)', WindowsInputTypes.Real, Module])
Options.append(['Pitch Diameter (mm)', WindowsInputTypes.Real, PitchDiameter])
Options.append(['Pressure Angle', WindowsInputTypes.Real, PressureAngle])
Options.append(['Thickness (mm)', WindowsInputTypes.Real, Thickness])
Values = Win.OptionsDialog(ScriptName, Options, 170)
if Values == None:
sys.exit()
print "Working..."
# get user inputs
NumberofTeeth = Values[1]
Module = Values[2]
PitchDiameter = Values[3]
PressureAngle = Values[4]
Thickness = Values[5]
# get current part
MyPart = CurrentPart()
# get the plane to create the gear on
GearPlane = MyPart.XYPlane
if (PitchDiameter==0):
PitchDiameter = NumberofTeeth * Module;
else:
if (NumberofTeeth != 0):
Module = PitchDiameter/NumberofTeeth;
# create the sketch then extrude it
ProfileSketch = MyPart.AddGearNP("Profile", NumberofTeeth, PitchDiameter, PressureAngle, 0, 0, False, GearPlane)
Gear = MyPart.AddExtrudeBoss("Gear", ProfileSketch, Thickness, False)
print "Done"
Where do I find documentation on AddGearNP(...)? Is one of the other parameters for inner or outer?
Thanks
John