Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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: 

Rule to delete Predefined Set of Custom Parameters

1 REPLY 1
SOLVED
Reply
Message 1 of 2
vkulikajevas
319 Views, 1 Reply

Rule to delete Predefined Set of Custom Parameters

Looking for a way to delete predefined custom parameters with a rule.

I have Custom Parameters called:
"Ilgis"

"Storis"
"Plotis"

which i need to delete.

 

This rule can be used as a base, but instead of deleting all props, it could delete predefined set?

 

 

On Error Resume Next
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
'look at each property in the collection
For Each oCustProp In oCustomPropertySet
'delete the custom iProperty
oCustProp.Delete
Next

 

 

 

vkulikajevas_0-1638614764357.png

 

Tags (3)
1 REPLY 1
Message 2 of 2
JelteDeJong
in reply to: vkulikajevas

Does this work for you?

Dim doc As Document = ThisDoc.Document
Dim predefinedSet As New List(Of String)
predefinedSet.Add("Ilgis")
predefinedSet.Add("Storis")
predefinedSet.Add("Plotis")

Dim oCustomPropertySet As PropertySet = doc.PropertySets.Item("Inventor User Defined Properties")

For Each oCustProp As [Property] In oCustomPropertySet
    If (predefinedSet.Contains(oCustProp.Name)) Then
        oCustProp.Delete()
    End If
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

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

Post to forums  

Autodesk Design & Make Report