Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
Reply
Message 1 of 2
rbertoletti
135 Views, 1 Reply

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

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.

1 REPLY 1
Message 2 of 2
A.Acheson
in reply to: rbertoletti

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report