does anyone know how to change the unit from "mm" to "inch" or from "inch" to "mm" without go to tools-options? Thanks! ~m
- posted
15 years ago
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)...
handleman posted a macro on 27 Aug 07 at
Dim swApp As SldWorks.SldWorks Dim swDoc As SldWorks.ModelDoc2 Dim CurUnits As Integer
Set swApp =3D Application.SldWorks Set swDoc =3D swApp.ActiveDoc
CurUnits =3D swDoc.GetUserPreferenceIntegerValue(swUnitsLinear)
If CurUnits =3D swMM Then swDoc.SetUserPreferenceIntegerValue swUnitsLinear, swINCHES ElseIf CurUnits =3D swINCHES Then swDoc.SetUserPreferenceIntegerValue swUnitsLinear, swMM End If
End Sub
Thank you so much! very handy! :-)
at
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 =3D Application.SldWorks Set swDoc =3D swApp.ActiveDoc
CurUnits =3D swDoc.GetUserPreferenceIntegerValue(swUnitsMassPropMass)
If CurUnits =3D swUnitsMassPropMass_Kilograms Then swDoc.SetUserPreferenceIntegerValue swUnitsMassPropMass, swUnitsMassPropMass_Pounds ElseIf CurUnits =3D swUnitsMassPropMass_Pounds Then swDoc.SetUserPreferenceIntegerValue swUnitsMassPropMass, swUnitsMassPropMass_Kilograms End If
End sub
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.