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

override bom quantity in subassembly

GeertvanderHeide
Advocate

override bom quantity in subassembly

GeertvanderHeide
Advocate
Advocate

hi, 

i want to override a certain rule in the BOM of a subassembly.

Dim AutoBOM As BOM = Subocc.Definition.BOM
Dim oBOMrow As BOMRow
For Each oBOMrow In AutoBOM.BOMViews.Item(1).BOMRows
	If oBOMrow.ComponentDefinitions.Item(1).Document.Propertysets.Item("Design Tracking Properties").Item("Part Number").Expression = 483385 Then
		oBOMrow.TotalQuantity = 5
		Exit For
	End If
Next

in this case i want to override the quantity of a part with partnumber 483385.

i thought when searching through BOM.Bomviews.item(1) "Unnamed"  it would make the changes in the model data tab of the BOM.

However, when i excecute this rule it doesn't seem to override anything and the quantity stays at 1.

 

anyone know how to do this? ilogic functions like thisbom.overridequantity cannot be used in subassemblies.

 

kind regards, 

 

Geert

0 Likes
Reply
248 Views
2 Replies
Replies (2)

WCrihfield
Mentor
Mentor

Hi @GeertvanderHeide.  The first detail that jumps out at me when reviewing your code is that the value of an iProperty's 'Expression' is always a String, and the value you are testing for is not quoted, which will fail.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

GeertvanderHeide
Advocate
Advocate

well, when the string is only a number it can compare to integers ,right?

code didn't bug out on it. the exit for also worked when using this.

 

edit:

okay, so i tested the code again, and somehow it does work now.. without any changes...

maybe inventor needs some motivation to work i guess..

 

thanks for the quick response anyway :slightly_smiling_face:

 

kind regards,

0 Likes