• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    New Member
    Posts: 1
    Registered: ‎04-24-2012
    Accepted Solution

    Use grams in Bill of Materials

    180 Views, 2 Replies
    04-24-2012 12:41 PM

    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

    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,933
    Registered: ‎03-08-2006

    iLogic to change the Mass Unit for each part in an assembly

    04-24-2012 02:11 PM in reply to: shockerty

    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

     

     



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

    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,933
    Registered: ‎03-08-2006

    Re: Use grams in Bill of Materials

    04-25-2012 07:37 AM in reply to: shockerty

    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

     



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

    Please use plain text.