Hi, I think that once I faced something similar, I have a drawing with many sheets, each sheet with different views of parts of an assembly. This rule creates a custom property in each part, which indicates the sheet in which it is located in the drawing.
I have simplified the rule so that it is easy to interpret.
You can modify the values to identify the drawing file
Dim oDoc As DrawingDocument = ThisDoc.Document
oSheets = oDoc.Sheets
myparam = InputBox("Defines the location location on a sheet", "Location on a sheet", "H")
For Each oSheet As Sheet In oDoc.Sheets
For Each oView As DrawingView In oSheet.DrawingViews
oViewModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
oModelName = oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
Dim SheetNumber As String = Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1)
Dim customPropSet As PropertySet = oViewModelDoc.PropertySets.Item("Inventor User Defined Properties")
On Error Resume Next
customPropSet.Item(myparam).Value = SheetNumber
If Err.Number <> 0 Then
customPropSet.Add(SheetNumber, myparam)
End If
Next
Next I hope to be clear and that this will help solve your problem.
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