Hi @pg47328 . This code writes in the description of the detail the name of the subassembly to which it is included. Do you need a list of subassemblies that include a part?
Sub main
Dim oDoc As Document = ThisApplication.ActiveDocument
If TypeOf oDoc Is AssemblyDocument Then
Dim oADoc As AssemblyDocument = oDoc
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oTM As TransactionManager = ThisApplication.TransactionManager
Dim newTM As Transaction = oTM.StartTransaction(oADoc, "CreatPropertyNameParent")
Call WritaNameForPart(oADef.Occurrences)
newTM.End()
Else
MessageBox.Show("Active document is not AssemblyDocument.", "Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If
End Sub
Private Function WritaNameForPart(ByVal oOccs As ComponentOccurrences)
For Each oOcc As ComponentOccurrence In oOccs
If Not oOcc.Suppressed Then
If TypeOf oOcc.Definition.Document Is PartDocument Then
Dim oOccDoc As PartDocument = oOcc.Definition.Document
If oOccDoc.IsModifiable Then
oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value = oOcc.ParentOccurrence.Name
End If
Else
Call WritaNameForPart(oOcc.SubOccurrences)
End If
End If
Next
End Function