create a thousand separator in mass parameter

create a thousand separator in mass parameter

anuj16797
Contributor Contributor
413 Views
2 Replies
Message 1 of 3

create a thousand separator in mass parameter

anuj16797
Contributor
Contributor

hii

 

I need to add a comma in the BOM in the mass of the part.

 

like if the mass of a part in an assembly is 5055 lbs then I need it to be shown as 5,055 lbs in the BOM.

 

@Curtis_Waguespack 

0 Likes
414 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant

Hi @anuj16797 

 

I don't know of a way to do this with built in Inventor settings, but I suppose you could create some custom code for this. 

 

Here is a past post concerning creating a custom iProeprty to handle a format change for the mass.  

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/custom-properties/m-p/4808383#M48457

 

The syntax to add the thousands separator would be something like this:

 

Dim oValue As Double = 88888888888888

If oValue > 999 Then
	oMsg = oValue.ToString("###,###")
End If

MsgBox(oMsg)

 

If you have questions about how to implement this via code, I would suggest creating a new post on the customization forum and asking those questions,  and linking back to this topic for reference.

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/bd-p/120

 

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

EESignature

Message 3 of 3

anuj16797
Contributor
Contributor

it solved half of my problem but i still need your help.

 

As shown in the below image I need to calculate the unit weight of each part with a thousand separators and "NA" if the mass is less than one which is done.

but now I need the extended weight which is (UNIT WT * QTY) with a thousand separators and "NA" if the mass is less the one in unit wt.

 

anuj16797_0-1671083801946.png

.

 

If iProperties.Mass > 999 Then
	iProperties.Value("Custom", "Totalmass") = iProperties.Mass.ToString("###,###")
	iProperties.Value("Custom", "UNIT WT") = iProperties.Mass.ToString("###,###") 
Else  
	iProperties.Value("Custom", "UNIT WT") = Round(iProperties.Mass, 0)
End If

If iProperties.Mass < 1 Then
	 iProperties.Value("Custom", "UNIT WT") = "NA" 
	 iProperties.Value("Custom", "EXT WT") = "NA"
End If
0 Likes