×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Measure Macro

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

I have not seen a macro for this. Someone may have one somewhere. It would be a good Enhancement Request to show both units.
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

(OP)
I COULD DIM AND THEN DELETE, BUT THAT'S NOT WHAT I AM LOOKING FOR. I AM LOOKING TO UPGRADE MY ABILITY TO MEASURE.

RE: Measure Macro

There is no API access to the measure tool in SW 2007.  However, you can toggle your document units back and forth between inches and mm with the following macro:

CODE

Sub DocUnitToggle()

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

A better ER might be for a simpler toggle (less mouse clicks), within the Measure dialogue box, to switch units. I guess that might be awkward though because there are 11 units to choose from. Maybe having a primary (default) and secondary unit pre-selection option (same as dual dimensions) could be incorporated.

cheers

RE: Measure Macro

I like handleman's solution best.  I don't think the measure dialog box is the right place to be quickly switching units.  

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

(OP)
So how do we give Solidworks an Enhancement Request?

RE: Measure Macro

The ER form can be accessed from the Customer Portal.

cheers

RE: Measure Macro

I have a similar situation.  I created a bunch of part models in a template setup with metric units.  I'm now creating drawings but the company has decided that the drawings are to be in imperial units.  My drawing template is setup to display pounds but the value it pulls from the model is a kg value.  Example, a part which has a mass of 3.2 kg shows on the imperial drawing template as weighing 3.2 pounds. There does not seem to be a way to pull the mass units in and even if there was I don't want kg on my imperial template.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources