change unit without go to tools-options

Discussion in 'SolidWorks' started by mwu, Feb 5, 2008.

  1. mwu

    mwu Guest

    does anyone know how to change the unit from "mm" to "inch" or from
    "inch" to "mm" without go to tools-options? Thanks! ~m
     
    mwu, Feb 5, 2008
    #1
  2. mwu

    Mark Guest

    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)...
     
    Mark, Feb 6, 2008
    #2
  3. mwu

    amouratis Guest

    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
     
    amouratis, Feb 6, 2008
    #3
  4. mwu

    mwu Guest

    Thank you so much! very handy! :)
     
    mwu, Feb 6, 2008
    #4
  5. mwu

    Larry767 Guest

    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?
     
    Larry767, Feb 7, 2008
    #5
  6. mwu

    Mark Guest

    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
     
    Mark, Feb 7, 2008
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.