albie0803
Alibre Super User
Create a 24 dia cylinder > 20 long and run this script, selecting an end and the shaft.
why is line 67 not true when i[0] = 24.0 ?
Please, what am I missing?

why is line 67 not true when i[0] = 24.0 ?
Please, what am I missing?
Python:
Win = Windows()
Units.Current = UnitTypes.Millimeters
P = CurrentPart()
P.Regenerate()
Clip = [
# dia,width,ID
[10.0,1.1,9.6],
[11.0,1.1,10.5],
[12.0,1.1,11.5],
[13.0,1.1,12.4],
[14.0,1.1,13.4],
[15.0,1.1,14.3],
[16.0,1.1,15.2],
[17.0,1.1,16.2],
[18.0,1.3,17],
[19.0,1.3,18],
[20.0,1.3,19],
[21.0,1.3,20],
[22.0,1.3,21],
[23.0,1.3,22],
[24.0,1.3,22.9],
[25.0,1.3,23.9],
[26.0,1.3,24.9],
[27.0,1.3,25.6],
[28.0,1.6,26.6],
[29.0,1.6,27.6],
[30.0,1.6,28.6],
[31.0,1.6,26.6],
[33.0,1.6,31.3],
[34.0,1.6,32.3],
[35.0,1.6,33.0],
[36.0,1.85,34],
[38.0,1.85,36],
[40.0,1.85,37.5],
[42.0,1.85,39.5],
[45.0,1.85,42.5],
[46.0,1.85,43.5],
[47.0,1.85,44.5],
[48.0,1.85,45.5],
[50.0,2.15,47],
]
loop = 1
while loop == 1:
Options = []
Options.append(["Choose Shaft End", WindowsInputTypes.Face, None]) #[0]
Options.append(['Choose Shaft Diameter Face', WindowsInputTypes.Face, None]) #[1]
Options.append(["Dist from Edge", WindowsInputTypes.Real, 10]) #[2]
# Options.append([None, WindowsInputTypes.Image, 'HKey.png', 150])
Values = Win.OptionsDialog("Circlip Groove Generator", Options, 110)
if Values == None:
sys.exit()
else:
loop = 0
end = Win.GetInputValue(0)
sha = Win.GetInputValue(1)
dis = Win.GetInputValue(2)
shaE = sha.GetEdges()
dia = shaE[0].Diameter
print 'dia = ', dia
for i in Clip:
if dia == i[0]:
WD = i[1]
ID = i[2]
if dia != i[0]:
print dia, i[0]
print 'WD = ',WD, 'ID = ',ID
S = P.AddSketch('Circlip', P.AddPlane('CirclipPlane', end, -dis))
S.AddCircle(0,0,dia+1,False)
S.AddCircle(0,0,ID,False)
P.AddExtrudeCut('Circlip %' % (dia), S, WD , True)