Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add user parameters to parts using external rules.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
GavoGarmo
989 Views, 2 Replies

Add user parameters to parts using external rules.

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

2 REPLIES 2
Message 2 of 3
GavoGarmo
in reply to: GavoGarmo

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

 

 

 

 

 

Message 3 of 3
jaredhowell1337
in reply to: 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

---------------------------------------------------------------------------

Inventor 2012

Windows 7 64-Bit SP1

Intel(R) Xeon(R) CPU X5570 @ 2.93GHz

NVIDIA Quadro FX 3800 (Avail. Graphics Memory 4067MB - Ded. 1024 MB)

12 GB RAM

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report