Hi @BRLMCHKD
You can use something like the first example to get the 9 right most characters of the assembly file name and then write that value to a custom iproperty in each occurrence file.
If the part number is not always 9 characters then we could use the ")" character to find the start point of the part number, as in the 2nd example.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim HasDrawing_List As New ArrayList
' Get the active document. This assumes it is a part document.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
oPN = Right(ThisDoc.FileName(False),9)
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
oDDoc = oOccurrence.Definition.Document
iProperties.Value(oOccurrence.Name, "Custom", "Detail Dwg") = oPN
Next
Dim HasDrawing_List As New ArrayList
' Get the active document. This assumes it Is a part document.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oName As String
oName = ThisDoc.FileName(False) 'without extension
'Get length Of file name
oLen = Len(oName)
'find the postion Of the last ) In the name
oPos = InStrRev(oName, ")",-1)
'Get middle part Of String starting at
'position Of ), +1
oPN = Mid(oName,oPos+1,(oLen - oPos) )
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
oDDoc = oOccurrence.Definition.Document
iProperties.Value(oOccurrence.Name, "Custom", "Detail Dwg") = oPN
Next