Hi,
I have a large collection of parts that are controlled from an exteranl rule. I need to make slight changes to the external rule, but for the changes to be successful I need two extra user parameters to be added to each of the parts. There are hundreds of parts, so going in and adding the two parameters to each would take days.
Is there a simple way of getting the external rule to add the two parameters?
Thanks in advance for yout help.
P.s. My VB skills are pretty limited, but my understanding of iLogic is pretty good.
GavoGarmo
Solved! Go to Solution.
Solved by GavoGarmo. Go to Solution.
I've managed to work it out (Through my cut and shut, hope and prey, programming skills)
I was using the code (This didn't work as an external rule. It put the paramters in the assemby, not the parts)
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
oParameter=oMyParameter.AddByValue("color", "red", UnitsTypeEnum.kTextUnits)
I looked at some other external rules and choped the front off the lines of code. THIS WORKS!
oMyParameter=ThisDoc.Doument.ComponentDefinition.Parameters.UserParameters
oParameter=oMyParameter.AddByValue("color", "red", UnitsTypeEnum.kTextUnits)
Hope this helps someone later one. IF anyone can offer any further advice I'd like to hear it.
A code to delete parameters would also be useful.
Thanks
GavoGarmo
Hi GavoGarmo,
My knowledge of rules/macros is quite limited, I try my hardest to follow the logic in the code but at the moment it's baffling me. I'll continue to persevere and hopefully it'll click one day. Could I ask you please:
I want to add 3 parameters to many many parts of an assembly, so as you said, editing each individual part would be a nightmare. These three parameters are Width, Length & THK.
What would I have to change in your code to have these parameters inserted?
Also, do you know anything that would make the parameters exportable (for a drawing BOM) - and change the custom property format?
I'd appreciate any advice you can give!!
Regards
Jazz