Hi friends,
i have one problem like conversion in this project involving things are converting total imperial dimensions in to metric while converting all the dimensions required in single presion like 15/16'' as .9375 mm but he need aproxxmate value like 1 . i have large assemblys how to mantain over all dimensions and how to change internal dimensions in simple ways.
any best and easy methods for this project plese let me know.
thanks in advance
Regards,
Linus kotte
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Tools>Document Settings Units & Precision.
Hi linuskotte,
Here's a link with an iLogic rule to change all parts in an assembly from metric to imperial or from imperial to metric. As written it does not modify the Precision, but it could be modified to do so.
http://inventortrenches.blogspot.com/2012/05/ilogic-rule-to-change-units-of-measure.html
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Here's a version that sets the units of length display precision:
'------- start of ilogic ------ question = MessageBox.Show("Are you sure you want to change the units of measure?", _ "iLogic",MessageBoxButtons.YesNo) if question = vbno then Return Else 'get input from user oUnit = InputRadioBox("Select a units of measure type", "Metric", "Imperial", True, "ilogic") 'create precision value list oPrecisionArray = new string(){0, 1, 2, 3, 4, 5} 'get input from user oPrecision = InputListBox("Select the number of decimal places to use for the units of length display.", _ oPrecisionArray, 3, "iLogic", "Decimal Places ") 'example UnitsTypeEnum Enumerators 'kCentimeterLengthUnits = 11268 'kMillimeterLengthUnits = 11269 'kInchLengthUnits = 11272 'kKilogramMassUnits = 11283 'kGramMassUnits = 11284 'kLbMassMassUnits = 11286 If oUnit = True then 'set to millimeter oUOM_1 = 11269 'set to kilogram oUOM_2 = 11283 Else 'set to inch oUOM_1 = 11272 'set to pounds mass oUOM_2 = 11286 End if 'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'set length units for the top level assembly openDoc.unitsofmeasure.LengthUnits = oUOM_1 'set mass units for the top level assembly openDoc.unitsofmeasure.MassUnits = oUOM_2 'set precision openDoc.unitsofmeasure.LengthDisplayPrecision = oPrecision 'Look at all of the files referenced in the open 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 length units docFile.unitsofmeasure.LengthUnits = oUOM_1 'set mass units docFile.unitsofmeasure.MassUnits = oUOM_2 'set precision docFile.unitsofmeasure.LengthDisplayPrecision = oPrecision Next End if '------- end of ilogic ------
Hi sir,
thankyou for ur reply.
but this ilogic rule not working properly.
This ilogic rule not converting sketch dimensions its converting constrain dimension into imperial or metric only in first part in browser tree. but ineed in whole assembly as weell as part level sketches dimension also.
please suggest me any solution for converting all imperial dimensions to metric dimensions in whole assembly constraint level and as well as part level sketch dimensions. Any macros or any ilogic rules?
Please help me
Regards,
Linus kotte
Hi linuskotte,
Technically it was working as written, it just wasn't updating the dimension display, but it was changing the units from metric to imperial or from imperial to metric.
Here is an updated version that updates the display of the sketch dims as well.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'------- start of ilogic ------ question = MessageBox.Show("Are you sure you want to change the units of measure?", _ "iLogic",MessageBoxButtons.YesNo) if question = vbno then Return Else 'get input from user oUnit = InputRadioBox("Select a units of measure type", "Metric", "Imperial", True, "ilogic") 'create precision value list oPrecisionArray = new string(){0, 1, 2, 3, 4, 5} 'get input from user oPrecision = InputListBox("Select the number of decimal places to use for the units of length display.", _ oPrecisionArray, 3, "iLogic", "Decimal Places ") 'example UnitsTypeEnum Enumerators 'kCentimeterLengthUnits = 11268 'kMillimeterLengthUnits = 11269 'kInchLengthUnits = 11272 'kKilogramMassUnits = 11283 'kGramMassUnits = 11284 'kLbMassMassUnits = 11286 If oUnit = True then 'set to millimeter oUOM_1 = 11269 'set to kilogram oUOM_2 = 11283 Else 'set to inch oUOM_1 = 11272 'set to pounds mass oUOM_2 = 11286 End if 'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'set length units for the top level assembly openDoc.unitsofmeasure.LengthUnits = oUOM_1 'set mass units for the top level assembly openDoc.unitsofmeasure.MassUnits = oUOM_2 'set precision openDoc.unitsofmeasure.LengthDisplayPrecision = oPrecision 'Look at all of the files referenced in the open 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 length units docFile.unitsofmeasure.LengthUnits = oUOM_1 'set mass units docFile.unitsofmeasure.MassUnits = oUOM_2 'set precision docFile.unitsofmeasure.LengthDisplayPrecision = oPrecision 'rebuild to update the display docFile.Rebuild Next End if 'update all iLogicVb.UpdateWhenDone = True '------- end of ilogic ------
Hi sir
thankyou for ur reply.
please i need one more help from you.
this ilogic run in part level converting sketch dimensions.
run in assembly level its convrting constraint dimensions only.
i need ilogic or macro once run in assembly level all the sub assemblies and part level sketch dimensions convert imperial to metric.
its possible?
if possible then help me.
Regards,
Linus kotte
Hi @Curtis_Waguespack ,
Iam trying to dual dimension a drawing with precision set to general tolerance based on the precision level.
Is it possible to tweak your iLogic code to automatically set selected dimensons based on the general tolerance defined.
for example:
Our primary dimension is set to mm and alternate units in brackets as inches.
Typically we set x[.y], x.x[y.yy], x.xx[y.yyy]
lets take Ø 397 [15.6] The imperial calculates to 15.63in which falls outside the +/- 0.5mm tolerance.
The ilogic code should be able to identify the actual precision level which makes the dimension out of the general tolerance range ( below screenshot) and adjust the precision level automatically.. can this be done? appreciate your valuable input. thanks!