Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Use grams in Bill of Materials
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Solved! Go to Solution.
iLogic to change the Mass Unit for each part in an assembly
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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/creat
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

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Use grams in Bill of Materials
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

