Hello
If there is a drawing view on the sheet with one of the iAssembly members, the following VBA could work.
Option Explicit
Private Sub iAssPartsLists()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oView As DrawingView
Set oView = oSheet.DrawingViews(1)
Dim oRefedDoc As AssemblyDocument
Set oRefedDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oCompDef As AssemblyComponentDefinition
Set oCompDef = oRefedDoc.ComponentDefinition
Dim oPoint As Point2d
Dim i As Integer
Dim aMemberFiles()
Dim oIAssFactory As iAssemblyFactory
If oCompDef.IsiAssemblyMember Then
Set oIAssFactory = oCompDef.iAssemblyMember.Row.Parent
Dim oFileNameColumn As iAssemblyTableColumn
Set oFileNameColumn = oIAssFactory.FileNameColumn
ReDim Preserve aMemberFiles(oFileNameColumn.Count - 1)
For i = 0 To oFileNameColumn.Count - 1
aMemberFiles(i) = oFileNameColumn.item(i + 1).Value
Next
For i = 0 To UBound(aMemberFiles) - 1
Set oPoint = insertpartslist(oSheet, oView, aMemberFiles(i), oPoint) 'oCell.Value, oPoint)
Next
End If
End Sub
Private Function insertpartslist(ByVal oSheet As Sheet, ByVal oView As DrawingView, ByVal sMembername As String, Optional ByVal oPoint As Point2d = Nothing) As Point2d
If oPoint Is Nothing Then Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width - 1, oSheet.Height - 1)
Dim oLevel As PartsListLevelEnum
oLevel = kStructuredAllLevels 'kFirstLevelComponents, kPartsOnly, kStructured
Dim aMembers(0) As String
aMembers(0) = sMembername
Dim oPartsList As PartsList
Set oPartsList = oSheet.PartsLists.Add(oView, oPoint, oLevel)
oPartsList.MembersToInclude = aMembers
oPoint.Y = oPoint.Y - oPartsList.RangeBox.MaxPoint.Y + oPartsList.RangeBox.MinPoint.Y
Set insertpartslist = oPoint
End Function
R. Krieg
RKW Solutions
www.rkw-solutions.com