Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

IsoViews - All 8 of them

API and Macros

IsoViews - All 8 of them

by  StarrRider  Posted    (Edited  )
The following macro was found on Comp.Cad.SolidWorks. I am not sure if I really have the right to post it here but I doubt if Mike Wilson will object. I did modify it so that it creates all 8 Iso Views. It can be ran repeatedly so that each view has the correct Zoom value.
This macro works with SW2001+ - I have not tried it with SW2003

' ******************************************************
' ISOViews.swp - 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

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
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search