Measure Macro
Measure Macro
(OP)
I am constantly changing between in. and mm. in my measure tool. Does anyone know of a macro that will automaticly open the measure tool in inches, and a second macro that will open the measure tool in mm? Maybe macro is not the way to go...I'm not sure how to address this issue, any suggestions?






RE: Measure Macro
You can dimension to show both units, then delete the dim.
Chris
SolidWorks 07 4.0/PDMWorks 07
AutoCAD 06
ctopher's home (updated 04-21-07)
RE: Measure Macro
RE: Measure Macro
CODE
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim CurUnits As Integer
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
CurUnits = swDoc.GetUserPreferenceIntegerValue(swUnitsLinear)
If CurUnits = swMM Then
swDoc.SetUserPreferenceIntegerValue swUnitsLinear, swINCHES
ElseIf CurUnits = swINCHES Then
swDoc.SetUserPreferenceIntegerValue swUnitsLinear, swMM
End If
End Sub
This has the exact same effect as going to Tools->Options, Document Properties tab, Units category and changing "Length Units" back and forth between inches and millimeters. As long as the Measure tool's options (the in/mm button on the measure tool) is set to "Use Document setting" rather than "Use custom setting" this will work. The only slightly hairy thing is that the change of units will not be reflected on any current measurement. The set of selections must be changed to force Measure to recalculate the measurement. For example, say you select two faces and then bring up the measure tool. The distance is shown as 25.4mm, but you want to know inches. If you run the unit toggle macro, the measure tool won't immediately show 1". You would have to change the selection set by deselecting and reselecting a face or something similar.
RE: Measure Macro
RE: Measure Macro
I also like CBL's suggestion about having duals units in the measure dialog. I would support that ER.
Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
sw.fcsuper.com
Co-moderator of Solidworks Yahoo! Group
RE: Measure Macro
RE: Measure Macro
RE: Measure Macro
The obvious solution to this is to go through each part file and change the mass units from kg to pounds before I make the drawing. Is there a macro to toggle the mass units or can someone think of a more elegant solution?
Larry Jorgenson, P.Eng (Mechanical - U of S, 1994)
Prairie Agricultural Machinery Institute (PAMI)
Humboldt, SK Canada
www.pami.ca