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: 

Delete userparameter with ilogic

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
theo.bot
5234 Views, 2 Replies

Delete userparameter with ilogic

Dear,

 

I know how to add user parameters with ilogic, but i would like to dete them as well. I've tried to use the delete option as mentioned in the API help but I cann't get it working in ilogic.

 

any one a suggestion, this is how i create a parameter:


Format:HTML Format
Version:1.0
StartHTML: 165
EndHTML: 3855
StartFragment: 314
EndFragment: 3823
StartSelection: 314
EndSelection: 314

DimoDocAsPartDocument=ThisDoc.Document'of : oDoc as AssemblyDocumment = ThisDoc.Document

'nummerieke parameter
Try
prop=oDoc.ComponentDefinition.Parameters.UserParameters?.item("nummer")
Catch
newprop=oDoc.ComponentDefinition.Parameters.UserParameters?.AddByExpression("nummer", "100", "mm")
EndTry

greetings, 

 

theo

Tags (2)
2 REPLIES 2
Message 2 of 3
theo.bot
in reply to: theo.bot

Found the solution:

 

Format:HTML Format
Version:1.0
StartHTML: 165
EndHTML: 1602
StartFragment: 314
EndFragment: 1570
StartSelection: 314
EndSelection: 314

DimparamAsParameter 
param=oDoc.ComponentDefinition.Parameters.Item("G_L")
param.Delete

 

Maybe it's intresting for other users!

 

Kind regards,

 

Theo

Message 3 of 3
Guthery1
in reply to: theo.bot

For users on newer versions.  Here is an updated script that works in 2023:

 

Dim doc = ThisDoc.Document
Dim param As Parameter 
param = doc.ComponentDefinition.Parameters.Item("PARAMETER NAME") 
param.Delete

Just replace "PARAMETER NAME" with the actual parameter name you want to delete and you are all set. 

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

Post to forums  

Autodesk Design & Make Report