Read the real value of overriden (static) PartsListCell

Read the real value of overriden (static) PartsListCell

Maxim-CADman77
Advisor Advisor
644 Views
6 Replies
Message 1 of 7

Read the real value of overriden (static) PartsListCell

Maxim-CADman77
Advisor
Advisor

I need to know the best (fastest) method to get the real (set in IAM's BOM) value of PartsListCell that are overriden (with value of <Static> property = True).

Of course I can start the transaction; set Static property of the cell to False; Read Cell.Value and finally abort the transaction ... but I believe there should be some easier way, right?

Thanks in advance.

 

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
645 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

I have some code for that, unfortunately I am far from my desk. As soon as I am back I will post it here, ok?

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

bradeneuropeArthur
Mentor
Mentor

Maybe this will help you already a bit further with it.

https://forums.autodesk.com/t5/inventor-customization/bom-row-static-quantity-programatically/m-p/82...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @Maxim-CADman77

 

Here is a quick Ilogic example.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

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
			oOverride = oRow.Item(oColumn).Value 'get static value
			oRow.Item(oColumn).Static = False 'set to not static
			oValue = oRow.Item(oColumn).Value 'get real value
			MessageBox.Show("Real value is: " & vbLf & oValue, "iLogic")
			oRow.Item(oColumn).Static = True 'set back to static
			oRow.Item(oColumn).Value = oOverride 'set back to static value
		End If	
    Next oColumn
Next oRow

EESignature

0 Likes
Message 5 of 7

Maxim-CADman77
Advisor
Advisor

Thank you but I need only read the value (without modifing the document).

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 6 of 7

marcin_otręba
Advisor
Advisor

You can go trough DrawingBOM to row reference document and then read corresponding value from document definition...

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 7 of 7

DRoam
Mentor
Mentor

@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.

0 Likes