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)...
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
Thank you so much! very handy! :-)
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?
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