Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'd like to set a custom iProperty for all the parts I've highlighted in an assembly, but I can't get it to work. Here's what I have so far:
Public Sub SetiProperties(ipropertyval As String, ipropertyname As String) Try 'set reference to inventor Dim ThisApplication As Inventor.Application ThisApplication = GetObject(, "Inventor.Application") 'Make a ref to active doc Dim oDoc As Document oDoc = ThisApplication.ActiveDocument 'selected components collection Dim oSelected As ObjectCollection oSelected = ThisApplication.TransientObjects.CreateObjectCollection For Each part In oDoc.SelectSet Dim invCustomPropertySet As PropertySet invCustomPropertySet = part.PropertySets.Item("Inventor User Defined Properties") Dim invProperty As Inventor.Property invProperty = invCustomPropertySet.Add(ipropertyval, ipropertyname) Next Catch MessageBox.Show("Error Setting iProperties", "Error") End Try End Sub
It seems to have trouble at this line:
invCustomPropertySet = part.PropertySets.Item("Inventor User Defined Properties")
Any ideas? Thanks in advance for any help
Solved! Go to Solution.