Hola, The suggestion is this, look at these examples, in the name of the detailed part in red
Component.Color("PartA:1")
iProperties.Value("part1:1", "Project", "Part Number")
Do not write the name of the file, extract it as property, for example if you have a file of part, place this rule, it will return the name of the file, and in the routines you should use oName for example, to establish the name of the file.
For example, if you know the location in the model tree from assembly, you can specify the occurrence through the item, as in the following case executing this rule in an assembly
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition
oDef = oDoc.ComponentDefinition
' Get the top level occurrence of an assembly
Dim oOcc As ComponentOccurrence
oOcc = oDef.Occurrences.Item(2)'Firt component occurrence
Dim oName As String
oName = oOcc.Name
MessageBox.Show(oName, "Title")
Change the item number from 2 forward to identify the type of occurrence displayed by the model browser in the assembly. By identifying by item you can rename and you will not have problems. 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