Hey everyone:
Within an IDW file, you can go to the Styles Editor, then click on a standard. On the General tab, there's a drop down for the unit of length.
Can someone provide the code so that I can change this setting from Inches to mm with an iLogic rule?
Thanks!
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi tdswanson,
Here is a quick example:
Dim MyArrayList As New ArrayList MyArrayList.add("Centimeter") MyArrayList.add("Millimeter") MyArrayList.add("Meter") MyArrayList.add("Inch") MyArrayList.add("Foot") MyArrayList.add("Yard") oLinUnit = InputListBox("Select a unit.", MyArrayList, MyArrayList.Item(0), "iLogic", "Linear Units") oIDW = ThisApplication.ActiveDocument Dim oDimStyle As DrawingStandardStyle oDimStyle = oIDW.StylesManager.ActiveStandardStyle If oLinUnit = "Centimeter" Then oDimStyle.LinearUnits = UnitsTypeEnum.kCentimeterLengthUnits Else If oLinUnit = "Millimeter" Then oDimStyle.LinearUnits = UnitsTypeEnum.kMillimeterLengthUnits Else If oLinUnit = "Meter" Then oDimStyle.LinearUnits = UnitsTypeEnum.kMeterLengthUnits Else If oLinUnit = "Inch" Then oDimStyle.LinearUnits = UnitsTypeEnum.kInchLengthUnits Else If oLinUnit = "Foot" Then oDimStyle.LinearUnits = UnitsTypeEnum.kFootLengthUnits Else If oLinUnit = "Yard" Then oDimStyle.LinearUnits = UnitsTypeEnum.kYardLengthUnits Else End If
Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Chris:
Once again, thanks for providing your expertise. I've got a larger piece of code that actually asks the detailer to choose a dimensioning style. Within the same standard, I've got a few Dim Styles and Object Default groups set up. So once the user chooses their desired style, I just needed the background code to change the units for the style.
So these lines were all I actually used:
oIDW = ThisApplication.ActiveDocument Dim oDimStyle As DrawingStandardStyle oDimStyle = oIDW.StylesManager.ActiveStandardStyle oDimStyle.LinearUnits = UnitsTypeEnum.kMillimeterLengthUnits
That last line is pasted into a "Select Case" section, and obviously there's a corresponding one to change the units back to Inches, should the user be in a metric style and change back to English.
Again, thanks for your help! This was just what I needed.