CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 3569 

CAD tip CAD tip # 11211:

Question CAD 
 %  platform  category 
Q - question

Mass change of units in the whole Inventor assembly.

A - answer With the following iLogic macro (rule) you can easily change length and mass units in all parts of the current Inventor assembly - e.g. to mm and grams:

sureq = MessageBox.Show("Do you really want to change units in the whole assembly?", "iLogic", MessageBoxButtons.YesNo)
if sureq = vbYes then

' preset units
 oUOM1 = UnitsTypeEnum.kMillimeterLengthUnits ' or UnitsTypeEnum.kCentimeterLengthUnits
 oUOM2 = UnitsTypeEnum.kGramMassUnits ' or UnitsTypeEnum.kKilogramMassUnits
 oPrecision = 3

 dim openDoc as document
 openDoc = ThisDoc.Document
 openDoc.unitsofmeasure.LengthUnits = oUOM1 
 openDoc.unitsofmeasure.MassUnits = oUOM2
 openDoc.unitsofmeasure.LengthDisplayPrecision = oPrecision

 dim docFile as document 
 For Each docFile In openDoc.AllReferencedDocuments 
  ' parts only
   If docFile.DocumentType = kPartDocumentObject Then 
     dim FNamePos as long
     FNamePos = InStrRev(docFile.FullFileName, "\", -1)                         
     dim docFName as string  
     docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)       

     docFile.unitsofmeasure.LengthUnits = oUOM1
     docFile.unitsofmeasure.MassUnits = oUOM2
     docFile.unitsofmeasure.LengthDisplayPrecision = oPrecision

     docFile.Rebuild
   End If
 Next     
 iLogicVb.UpdateWhenDone = True

end if
Inventor
100% *  CAD 
6.12.2016    1264×  
Comments   Tell a friend
applies to: Inventor ·

See also:
Tip 11111:Inventor drawing diplays flipped, mirrored (as from underside)
Tip 9952:iLogic rule - check whether iProperties are overridden.
Tip 8986:Material density as a custom iProperty in Inventor.


Back   All CAD Tips All CAD tips&tricks

Directional copying of AutoCAD drawing objects. « | » Largest number of versions among Vault documents.

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Link your AutoCAD texts with Excel tables/sheets. Export. Change. Import.
Try DwgText 2015 More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist