Hi, here you have an ilogic code, I think it could work.
I try to simplify it a bit by taking the information from your original code.
Dim oDerPro As Inventor.Property
Dim oDerived As Inventor.Document = ThisApplication.ActiveDocument
If oDerived.ReferencedDocuments.Count = 0 Then Exit Sub
Dim oReferenced As Inventor.Document = oDerived.ReferencedDocuments(1)
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Inventor Summary Information")
Try
oDerived.PropertySets.Item("Inventor Summary Information")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Inventor Document Summary Information")
Try
oDerived.PropertySets.Item("Inventor Document Summary Information")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Design Tracking Properties")
Try
oDerived.PropertySets.Item("Design Tracking Properties")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
If you want this code combined with your previous code, you could try this new code
Dim oDerPro As Inventor.Property
Dim oDerived As Inventor.Document = ThisApplication.ActiveDocument
If oDerived.ReferencedDocuments.Count = 0 Then Exit Sub
Dim oReferenced As Inventor.Document = oDerived.ReferencedDocuments(1)
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Inventor Summary Information")
Try
oDerived.PropertySets.Item("Inventor Summary Information")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Inventor Document Summary Information")
Try
oDerived.PropertySets.Item("Inventor Document Summary Information")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Design Tracking Properties")
Try
oDerived.PropertySets.Item("Design Tracking Properties")(oRefPro.Name).Value = oRefPro.Value
Catch
End Try
Next
Dim oDerProps As PropertySet = oDerived.PropertySets.Item("Inventor User Defined Properties")
Dim oProList() As String = {"*", "OTHER_iPRO" }
For Each oRefPro As Inventor.Property In oReferenced.PropertySets.Item("Inventor User Defined Properties")
'Check for existing, add if not existing
Dim oSkip As Boolean = True
For Each ProName As String In oProList
'Ucase ignores upper/lower case in names
If UCase(ProName) <> UCase(oRefPro.Name) And ProName <> "*" Then Continue For
oSkip = False
Exit For
'Copy from derived properties to current properties
Next
If oSkip Then Continue For
Try
oDerPro = oDerProps(oRefPro.Name)
Catch
oDerPro = oDerProps.Add("", oRefPro.Name)
End Try
oDerPro.Value = oRefPro.Value
Next
I hope this helps with your problem. Regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn