Add Total Mass to part list (as total of all items)

Add Total Mass to part list (as total of all items)

rbertoletti
Enthusiast Enthusiast
207 Views
1 Reply
Message 1 of 2

Add Total Mass to part list (as total of all items)

rbertoletti
Enthusiast
Enthusiast

There's a way to add the total mass last row for a part list in drawings?

Here below i show a picture of what i mean exactly.

 

rbertoletti_0-1715328711018.png

Thanks in advance.

0 Likes
208 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

Hi @rbertoletti 

You will need to loop through the part list row of a specific column and sum the value of the cell. You will need to use the Inventor API for this. First find the part lists object in the list of objects. Usually there is samples associated with the big objects.  See partlist query sample here written in vba

 

Here it is converted to VB.Net for use in the ilogic environment. This won’t be exactly what you need but a starting point in how to return values from the partlist. If you try and filter for the column you need then you will be working towards your solution. Post up your attempts here with questions and I will be happy to help. 

Sub Main
    PartListQuery
End Sub

Public Sub PartListQuery()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the first parts list on the active sheet.
    ' This assumes that a parts list is on the active sheet.
    Dim oPartList As PartsList
    oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
    
    ' Iterate through the contents of the parts list.
    Dim i As Integer
    For i = 1 To oPartList.PartsListRows.Count
        ' Get the current row.
        Dim oRow As PartsListRow
        oRow = oPartList.PartsListRows.Item(i)
        
        ' Iterate through each column in the row.
        Dim j As Integer
        For j = 1 To oPartList.PartsListColumns.Count
            ' Get the current cell.
            Dim oCell As PartsListCell
            oCell = oRow.Item(j)
            
            ' Display the value of the current cell.
            Logger.Info( "Row: " & i & ", Column: " & oPartList.PartsListColumns.Item(j).Title & " = "; oCell.Value)
        Next
    Next
End Sub

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan