OK @max.baumann07. I have updated the code to match that information. It will check the String type value it gets from the cell in the PartsList against "0,000 g", and will also attempt to convert the numerical portion of it to a Double data type, then compare that value against zero. If any cell is matches those tests, it should show a message on your screen to let you know about it. However, you will need to run the rule for it to check those things. You can either run it manually, or maybe use the 'Event Triggers' dialog and put it under an event in the 'This Document' tab (only effect this one drawing), or put this rule under an event in the 'Drawings' tab (to have it effect all drawings).
Sub Main
'<<< make sure we have a Drawing >>>
Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
If oDDoc Is Nothing Then
Logger.Debug("The rule named '" & iLogicVb.RuleName & "' exited (no DrawingDocument obtained)!")
'MsgBox("The rule named '" & iLogicVb.RuleName & "' exited (no DrawingDocument obtained)!", vbCritical, "iLogic")
Return
End If
'<<< get first PartsList on the active sheet >>>
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
If oSheet.PartsLists.Count = 0 Then
Logger.Debug("No PartsLists on active sheet. Exiting routine.")
'MsgBox("No PartsLists on active sheet. Exiting routine.", vbExclamation, "iLogic")
Return
End If
Dim oPList As PartsList = oSheet.PartsLists.Item(1)
'<<< find the column for Mass >>>
Dim oMassCol As PartsListColumn = Nothing
Dim oCols As PartsListColumns = oPList.PartsListColumns
For Each oCol As PartsListColumn In oCols
If oCol.PropertyType = PropertyTypeEnum.kMassPartsListProperty Then
oMassCol = oCol
Exit For
End If
Next 'oCol
'<<< it it was not found, report it, then exit routine >>>
If oMassCol Is Nothing Then
Logger.Debug("No 'Mass' column found in PartsList!")
'MsgBox("No 'Mass' column found in PartsList!", vbExclamation, "iLogic")
Return
End If
'<<< iterate through rows and check for zero Mass value >>>
Dim oRows As PartsListRows = oPList.PartsListRows
For Each oRow As PartsListRow In oRows
If oRow.Visible = False Then Continue For 'skip to next row
If oRow.Custom = True Then Continue For 'skip to next row
'cell Value Data Type is always a String (not Numeric, Boolean, or other)
'get value from cell in Mass column of this row, as a String value
Dim sMass As String = oRow.Item(oMassCol).Value
If sMass = "0,000 g" OrElse _
Conversion.Val(sMass) = 0 Then
MsgBox("A PartsList Row has zero Mass!", vbExclamation, "iLogic")
End If
Next 'oRow
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)