02-19-2019
11:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-19-2019
11:28 PM
Yes, there is no direct Inventor API to split PartsList. But there is a way to copy or add new PartsList. Then, possible PartsListRow can be made invisible based on "Ship" values. As per sample PartsList, 6th column is considered as "Ship" column. Based on this, below VBA code can be used to create new partslist and hide respective "Ship" values.
Sub Split_PartsList()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet
Dim oPartsList1 As PartsList
Set oPartsList1 = oSheet.PartsLists.Item(1)
Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(oPartsList1.RangeBox.MaxPoint.X, oPartsList1.RangeBox.MinPoint.Y)
Dim oPartsList2 As PartsList
Set oPartsList2 = oSheet.PartsLists.Add(oPartsList1.ReferencedDocumentDescriptor.ReferencedDocument, oPoint)
'For "UNIT" Ship
Dim oRow As PartsListRow
For Each oRow In oPartsList1.PartsListRows
If oRow.Item(6).Value = "LOOSE" Then
oRow.Visible = False
End If
Next
'For "LOOSE" Ship
For Each oRow In oPartsList2.PartsListRows
If oRow.Item(6).Value = "UNIT" Then
oRow.Visible = False
End If
Next
End Sub
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network
