@Maxim-CADman77 wrote:
Thank you but I need only read the value (without modifing the document).
@Maxim-CADman77, if you're still looking for a solution for this, here's an implementation of @marcin_otręba's suggestion, plugged into Curtis's code:
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oPartsList As Partslist
oPartsList = oSheet.PartsLists(1)
Dim oRow As PartsListRow
Dim oColumn As PartsListColumn
For Each oRow In oPartsList.PartsListRows
For Each oColumn In oPartsList.PartsListColumns
If oRow.Item(oColumn).Static = True Then
Dim oDoc As Inventor.Document = oRow.ReferencedRows(1).BOMRow.ComponentDefinitions(1).Document
Dim oValue As Object
If oColumn.PropertyType = PropertyTypeEnum.kFileProperty Then
Dim oPropSetId As String
Dim oPropId As String
oColumn.GetFilePropertyId(oPropSetId, oPropId)
oValue = oDoc.PropertySets(oPropSetId).ItemByPropId(oPropId).Value
Else If oColumn.PropertyType = PropertyTypeEnum.kCustomProperty Then
Dim oPropName As String = oColumn.CustomPropertyName
oValue = oDoc.PropertySets("Inventor User Defined Properties").Item(oPropName).Value
End If
MessageBox.Show("Real value is: " & vbLf & oValue, "iLogic")
End If
Next oColumn
Next oRow
Not super straightforward, but it's probably the fastest way. There doesn't seem to be a way to directly get the non-static value of the Parts List cell itself. Instead, you have to query the iProperty that's referenced by the cell.
To do this, you first have to get the document associated with the cell's row, and then the property associated with the cell's column (which is handled differently depending on if it's a built-in or custom property). Then you can finally query the property's true value.
Hope this works for you.