Use grams in Bill of Materials

Use grams in Bill of Materials

Anonymous
Not applicable
2,103 Views
2 Replies
Message 1 of 3

Use grams in Bill of Materials

Anonymous
Not applicable

Hi everyone,

 

Sorry this is really nooby, but how can I change the mass in the Bill of Materials to g instead of kg?

 

Cheers

0 Likes
Accepted solutions (2)
2,104 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi

 

You can change the units of mass for each file by going to the Tools tab > Document Settings button > Units tab. If you do this in your template then all of the files you create going foward that use that template will automatically have the mass units set to Gram.

 

However if you're wanting to do this for existing files, as you want to do when trying to updat the BOM, you would be required to open each file (since this is set in the document settings). This can be quite a chore though, so I've included an ilogic rule here to do this.

 

You can use this link to learn about setting up an ilogic rule if you've not done it before:

http://inventortrenches.blogspot.com/2012/01/creating-basic-ilogic-rule-with-event.html

 

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

 

 

question = MessageBox.Show("Are you sure you want to change the units of mass?", "iLogic",MessageBoxButtons.YesNo)
if question = vbno then
Return
Else

	oUnit = InputRadioBox("Select a unit of mass", "Gram", "Kilogram", True, "ilogic")

	'kKilogramMassUnits = 11283
	'kGramMassUnits = 11284
	'kSlugMassUnits = 11285
	'kLbMassMassUnits = 11286
	'kOunceMassUnits = 11287
	
		If oUnit = True then 
		'set to gram
		oUOM = 11284	
		Else 
		'set to kilogram
		oUOM = 11283	
		End if

	'Define the open document
	Dim openDoc As Document
	openDoc = ThisDoc.Document
	Dim docFile As Document 

	For Each docFile In openDoc.AllReferencedDocuments		
		'format  file name		
		Dim FNamePos As Long
		FNamePos = InStrRev(docFile.FullFileName, "\", -1)		         
		Dim docFName As String	
		docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)       
		'set mass units as gram
		docFile.unitsofmeasure.massunits = oUOM 
	Next	
End if

 

 

Message 3 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi shockerty,

 

Just a quick update. Here's another version with a listbox that allows you to select a unit of mass.

 

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


question = MessageBox.Show("Are you sure you want to change the units of mass?", 

"iLogic",MessageBoxButtons.YesNo)
if question = vbno then
Return
Else

oStringArray = new string(){"Kilogram", "Gram", "Slug", "Pound", "Ounce"}

oUnit = InputListBox("Select a unit of Mass", oStringArray, "Kilogram", "iLogic", "Mass Units")

	'kKilogramMassUnits = 11283
	'kGramMassUnits = 11284
	'kSlugMassUnits = 11285
	'kLbMassMassUnits = 11286
	'kOunceMassUnits = 11287
	
	If oUnit = "Kilogram" then 
	oUOM = 11283
	Else If oUnit = "Gram" then 
	oUOM = 11284	
	Else If oUnit = "Slug" then 
	oUOM = 11285
	Else If oUnit = "Pound" then 
	oUOM = 11286
	Else If oUnit = "Ounce" then 
	oUOM = 11287
	Else
	End if

	'Define the open document
	Dim openDoc As Document
	openDoc = ThisDoc.Document
	Dim docFile As Document 

'	'kAssemblyDocumentObject = 12291 
'	If openDoc.DocumentType = 12291 Then

	'Iterate though the files in the assembly
		For Each docFile In openDoc.AllReferencedDocuments		
		'format  file name		
		Dim FNamePos As Long
		FNamePos = InStrRev(docFile.FullFileName, "\", -1)		         
		Dim docFName As String	
		docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)       
		            	            	
		'set mass units as gram
		docFile.unitsofmeasure.massunits = oUOM 
		Next	
'	Else	
'	MessageBox.Show("This is not an assembly file.", "iLogic")
'		
'	End If
End if

 

0 Likes