Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Scott.Hallmark
437 Views, 2 Replies

Parts List Break based on "Ship" change

I have a Parts List that contains a custom property called "SHIP" and the only 2 values that should show up in this Parts List is either "UNIT" or "LOOSE".  I would like to see if there is a way thru iLogic to break the parts list into 2 tables based on that change automatically.  It currently sorts based on that property first, then the part number, so that the "LOOSE" items show up at the bottom of the parts list.

 

This is what I get now:

partslist_ship1.png

 

This is what I would like to get:

partslist_ship2.png

** If my reply resolves this issue, please choose Accept Solution **
Scott Hallmark, Design Specialist | Fluor Corporation
Inventor and AutoCAD Certified Professional, Autodesk Certified Instructor | My Plant3D Notes | AU Speaker | ROLL TIDE!
JaneFan
in reply to: Scott.Hallmark

Hi @Scott.Hallmark , 

As I know splitting PartsList table is not supported in API and iLogic for now that we can only do that via manual operation.




Jane Fan
Inventor QA Engineer

@Scott.Hallmark ,

 

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