albie0803
Alibre Super User
Code:
import time
ca=CurrentAssembly()
for i in range(len(ca.Parts)):
print 'Part Nr.:',i, 'named',ca.Parts[i].Name
for j in range(len(ca.Parts[i].Parameters)):
print 'Part',i, 'Param:', j, 'Name:', ca.Parts[i].Parameters[j], 'Value:', ca.Parts[i].Parameters[j].Value
ca.Parts[i].Parameters[j].Value = EParams[int(ca.Parts[i].Parameters[j].Name[1:3])]
I have this little block of code that writes the parameter value (kudos to one of you genius' who provided it for me). My parameters are named thus: G12_Bore and the code picks out the 12 amongst other things. The "12" becomes a variable number to read from a list in the last line. All well and good when I wanted every parameter.
I want to add more calculating parameters that I want ignored as the code goes through them. eg Teeth, which tries to evaluate ee and throws an error. I looked for and tried to use Try: Except but I can't get it right.
I want it to find the error and then skip to the next loop in the For statement, effectively ignoring any parameter that doesn't have a number in positions 2 and 3 of the name.
Hope that all makes sense.