BOM Cell Value - Decimal Places

BOM Cell Value - Decimal Places

RoyWickrama_RWEI
Advisor Advisor
983 Views
6 Replies
Message 1 of 7

BOM Cell Value - Decimal Places

RoyWickrama_RWEI
Advisor
Advisor

I need to find the total weight from the items listed in visible rows in parts list.

 

BOM - Decimal Places.png

 

However, I find that the cell value for unit weight (see below) rounds up to an integer. I tried all possible options, but no success.

 

SyntaxEditor Code Snippet

oWeight_UNIT = oPartsList.PartsListRows.Item(i).Item("UNIT WT. (LB)").Value

 

Could someone help me. Thanks!

 

 

 

0 Likes
Accepted solutions (1)
984 Views
6 Replies
Replies (6)
Message 2 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@RoyWickrama_RWEI,

 

Can you please send sample files to test?

 

Please make sure that files are non confidential.

 

In my system, Decimal places are displaying properly. For more details, refer below images.

 

Row 1Row 1Row 2Row 2Row 3Row 3

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 7

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Is it possible that the precision in the model file (ipt or iam) is like (0) 226

and that the precision in the Partlist is different like (2) 226.50?

 

Than change the model precision...

 

Regards,

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

Message 4 of 7

RoyWickrama_RWEI
Advisor
Advisor

Thanks. You are right. Even, I got the decimal places when I used this rule some times ago. I forgot it. I will check for the units precision for the weight.

0 Likes
Message 5 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@RoyWickrama_RWEI,

 

Check the units for weight.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 6 of 7

RoyWickrama_RWEI
Advisor
Advisor

Thanks for responding back. Thai is fine by now.

 

I am trying to retrieve the model units of measure from withing the drawing document (please see the part of coding below). But it does not go through!

 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
oUOM_Mass = oModelDoc.unitsofmeasure.MassUnits

Last row of the above is wrong. Could I get this fixed? Thanks.

 

0 Likes
Message 7 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@RoyWickrama_RWEI,

 

Try below iLogic code to get mass unit of Model document from Drawing document.

 

doc = ThisDrawing.ModelDocument

Dim oUnit As Inventor.UnitsTypeEnum  
oUnit = doc.unitsofmeasure.MassUnits

Select Case oUnit 
	
Case UnitsTypeEnum.kGramMassUnits 
	
	messagebox.Show("Gram mass", "Mass unit")
Case Unitstypeenum.kLbMassMassUnits 
	
	messagebox.Show("Lbs mass", "Mass unit")
Case UnitsTypeEnum.kKilogramMassUnits 
	
	messagebox.Show("Kg mass", "Mass unit") 
Case UnitsTypeEnum.kSlugMassUnits 

	messagebox.Show("Slug mass", "Mass unit")
End Select

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network