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

Get Item Weight From Partslist

Hi , I'm new with ilogic code. I'm recently working on a code to automatic sort the Partslist inside a IDW.

 

The Partslist doesn't have a mass column. but in order to sort it i need the weight for each row. so i write following code.

 

SyntaxEditor Code Snippet

On Error Resume Next 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)

Dim oRow As PartsListRow

Dim oAssyDoc As AssemblyDocument

Dim Mass As Double

For Each oRow In oPartsList1.PartsListRows

MessageBox.Show(oRow.ReferencedFiles.Item(1).DocumentType)

oAssyDoc = oRow.ReferencedFiles.Item(1)
oAssyDoc.ComponentDefinition.MassProperties.Accuracy = k_Medium
Mass = oAssyDoc.ComponentDefinition.MassProperties.Mass

MessageBox.Show(Mass)

Next

 

I can see the referenced file type 12290 (ipt) and 12291 (iam). but the weight is always 0.

 

can anyone help me with that ?

 

Thanks