Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I need some help to get this code to work. It was originally created to delete iProperties, but I want to add them instead. The rule runs, but no iPropeties are created.
I would like to understand how I can get line 21 to works.
What I want this rule to do:
Check if the Custom iProperty (Found in the Array List) exists, if so, leave it alone, if not create it.
I can get this all to work by creating a "separate" rule for each iProperty, but the code gets to long and complicated. But doing it this way, by using an Array list, it keeps the code nice and clean. And it will make it easier to add or remove custom iProperties down the line.
Any help would be greatly appreciated!
' Set of Required iProperties
Dim MyArrayList As New ArrayList
MyArrayList.Add("AssyMat")
MyArrayList.Add("AutoCAD tek")
MyArrayList.Add("BomStructure")
MyArrayList.Add("Nav_Code")
MyArrayList.Add("Nav_Description")
MyArrayList.Add("Verdor Code")
MyArrayList.Add("Coating")
'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 don't want to delete
If MyArrayList.Contains(oCustProp.name)Then
'skip it
Else
'add the custom iProperty
oCustProp.Add
End If
Next
Solved! Go to Solution.