Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Rule - Change the Linear Units in the Active Standard?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
tdswanson
1021 Views, 2 Replies

iLogic Rule - Change the Linear Units in the Active Standard?

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!

 

 

2 REPLIES 2
Message 2 of 3

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

Message 3 of 3

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report