ISO View Macro

Discussion in 'SolidWorks' started by fredg, Jun 9, 2004.

  1. fredg

    fredg Guest

    Does anybody know what changes are needed in the formula to make this
    work with Diametric Views?

    (BTW this is a great macro, thanks for those who took the time to
    write / develop it!!)

    ' *************************************************************
    ' ISOViews.swp - macro recorded on 12/20/01 by Mike J. Wilson
    ' *************************************************************
    ' Special thanks to Dennis Kelley and Dan Hanger for tips
    ' Modified to include all 8 Iso Views by Lee Bell

    Dim swApp As Object
    Dim Part As Object
    Dim boolstatus As Boolean
    Dim longstatus As Long
    Dim Annotation As Object
    Dim Gtol As Object
    Dim DatumTag As Object
    Dim FeatureData As Object
    Dim Feature As Object
    Dim Component As Object

    Sub main()

    Set swApp = CreateObject("SldWorks.Application")
    Set Part = swApp.ActiveDoc

    pi = 4 * Atn(1)
    z = Tan(30 * pi / 180)
    x = Atn(z / Sqr(-z * z + 1))
    y = -45 * pi / 180

    Part.DeleteNamedView ("TRF-ISO")
    Part.DeleteNamedView ("TRR-ISO")
    Part.DeleteNamedView ("TLF-ISO")
    Part.DeleteNamedView ("TLR-ISO")

    Part.DeleteNamedView ("BRF-ISO")
    Part.DeleteNamedView ("BRR-ISO")
    Part.DeleteNamedView ("BLF-ISO")
    Part.DeleteNamedView ("BLR-ISO")


    Part.ShowNamedView2 "*Front", -1
    Part.ActiveView().RotateAboutCenter x, y
    Part.ViewZoomtofit
    Part.NameView ("TRF-ISO")

    Part.ShowNamedView2 "*Right", -1
    Part.ActiveView().RotateAboutCenter x, y
    Part.ViewZoomtofit
    Part.NameView ("TRR-ISO")

    Part.ShowNamedView2 "*Back", -1
    Part.ActiveView().RotateAboutCenter x, y
    Part.ViewZoomtofit
    Part.NameView ("TLR-ISO")

    Part.ShowNamedView2 "*Left", -1
    Part.ActiveView().RotateAboutCenter x, y
    Part.ViewZoomtofit
    Part.NameView ("TLF-ISO")


    Part.ShowNamedView2 "*Front", -1
    Part.ActiveView().RotateAboutCenter -x, y
    Part.ViewZoomtofit
    Part.NameView ("BRF-ISO")

    Part.ShowNamedView2 "*Right", -1
    Part.ActiveView().RotateAboutCenter -x, y
    Part.ViewZoomtofit
    Part.NameView ("BRR-ISO")

    Part.ShowNamedView2 "*Back", -1
    Part.ActiveView().RotateAboutCenter -x, y
    Part.ViewZoomtofit
    Part.NameView ("BLR-ISO")

    Part.ShowNamedView2 "*Left", -1
    Part.ActiveView().RotateAboutCenter -x, y
    Part.ViewZoomtofit
    Part.NameView ("BLF-ISO")

    Set Part = Nothing
    Set swApp = Nothing

    End Sub
     
    fredg, Jun 9, 2004
    #1
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.