Saturday, December 30, 2017

iLogic Delete Custom iProperties

iLogic Delete Custom iProperties


Issue:
You have some custom iProperties in your file that you want to remove. Because you have a lot of files that contain these custom iProperties, you find yourself doing this quite often. Youd like an iLogic rule that will help with this when you encounter these custom iProperties.


Solution:
Here are three rule variations to help with this.

Variation 1
Delete only the custom iProperties found in the list.



------- start of ilogic ------

define list of custom properties to delete
Dim MyArrayList As New ArrayList
MyArrayList.add("Hello World 001")
MyArrayList.add("Hello World 002")
MyArrayList.add("Hello World 003")

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
check property name against the list you want to delete
If MyArrayList.Contains(oCustProp.name)Then
delete the custom iProperty
oCustProp.Delete
Else
skip it
End If
Next

------- end of ilogic ------


Variation 2
Delete only the custom iProperties NOT found in the list.


Blog Archive