Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Add parameter to drawing file through ilogic

johnster100
Collaborator

Add parameter to drawing file through ilogic

johnster100
Collaborator
Collaborator

Hi there,

I'm trying to add some user parameters to a Inventor .dwg file through ilogic. I'd like to be able to add user parameter some of which will be string and some will be numbers.

 

I can't seem to find any help on the web or on the forums for this.

 

Could someone help me please?

 

thanks,

John

0 Likes
Reply
Accepted solutions (1)
2,661 Views
4 Replies
Replies (4)

LukeDavenport
Collaborator
Collaborator
Accepted solution

 

Hi John,

 

You can add a user text parameter like this.

 

If you want it to be a multi-value parameter you'll need to create a new arraylist and add the arraylist itself as the value of the new parameter (replacing "InitialValue" in the example below:

 

Regards,

Luke

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oDrawParams As UserParameters = oDrawDoc.Parameters.UserParameters

Dim TestParam As UserParameter = oDrawParams.AddByValue("TestParam" , "InitialValue", UnitsTypeEnum.kTextUnits)

johnster100
Collaborator
Collaborator
Thanks a lot Luke, that's brilliant!

Thanks,
John
0 Likes

masureb
Autodesk
Autodesk

Great tip. But how can we delete it or rename it?

 

Cheers,

-Bertrand

“https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgb-black-small_forum.png”
0 Likes

Owner2229
Advisor
Advisor

Like this:

 

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oParams As UserParameters = oDoc.Parameters.UserParameters

Dim TestParam As UserParameter = oParams.Item("TestParam")
TestParam.Expression = "NewText"
TestParam.Name = "NewName" TestParam.Delete()
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes