Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change unit without go to tools-options

310 views
Skip to first unread message

enjoyl...@gmail.com

unread,
Feb 5, 2008, 3:19:36 PM2/5/08
to m...@mc.com
does anyone know how to change the unit from "mm" to "inch" or from
"inch" to "mm" without go to tools-options? Thanks! ~m

Mark

unread,
Feb 6, 2008, 9:06:32 AM2/6/08
to
On Feb 5, 3:19 pm, "m...@mc.com" <enjoylife....@gmail.com> wrote:
> does anyone know how to change the unit from "mm" to "inch" or from
> "inch" to "mm" without go to tools-options? Thanks! ~m

Not that much help, but - the Grid button at least gets you into the
document properties tab of tools-options in a single click, then it's
just one more click to the units section. Maybe somebody has a macro
that will help you (if not, maybe I'll write one when I have some free
time, because it'd be useful for me too)...

amou...@gmail.com

unread,
Feb 6, 2008, 10:34:12 AM2/6/08
to
On Feb 5, 2:19 pm, "m...@mc.com" <enjoylife....@gmail.com> wrote:
> does anyone know how to change the unit from "mm" to "inch" or from
> "inch" to "mm" without go to tools-options? Thanks! ~m

handleman posted a macro on 27 Aug 07 at http://www.eng-tips.com/viewthread.cfm?qid=195871&page=34.

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

enjoyl...@gmail.com

unread,
Feb 6, 2008, 12:36:21 PM2/6/08
to
On Feb 6, 7:34 am, amoura...@gmail.com wrote:
> On Feb 5, 2:19 pm, "m...@mc.com" <enjoylife....@gmail.com> wrote:
>
> > does anyone know how to change the unit from "mm" to "inch" or from
> > "inch" to "mm" without go to tools-options? Thanks! ~m
>
> handleman posted a macro on 27 Aug 07 athttp://www.eng-tips.com/viewthread.cfm?qid=195871&page=34.

>
> 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

Thank you so much! very handy! :-)

Larry767

unread,
Feb 7, 2008, 9:07:39 AM2/7/08
to
On Feb 6, 9:34 am, amoura...@gmail.com wrote:
> On Feb 5, 2:19 pm, "m...@mc.com" <enjoylife....@gmail.com> wrote:
>
> > does anyone know how to change the unit from "mm" to "inch" or from
> > "inch" to "mm" without go to tools-options? Thanks! ~m
>
> handleman posted a macro on 27 Aug 07 athttp://www.eng-tips.com/viewthread.cfm?qid=195871&page=34.

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?

Mark

unread,
Feb 7, 2008, 12:48:25 PM2/7/08
to

Modification of the above macro...I'm just cutting and pasting, I
don't have access to a SW computer right now so I haven't tested it,
correct me if I'm wrong.
-Mark


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(swUnitsMassPropMass)


If CurUnits = swUnitsMassPropMass_Kilograms Then
swDoc.SetUserPreferenceIntegerValue swUnitsMassPropMass,
swUnitsMassPropMass_Pounds
ElseIf CurUnits = swUnitsMassPropMass_Pounds Then
swDoc.SetUserPreferenceIntegerValue swUnitsMassPropMass,
swUnitsMassPropMass_Kilograms
End If

End sub

0 new messages