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!

Creates 8 ISO Views

API and Macros

Creates 8 ISO Views

by  Heckler  Posted    (Edited  )
This is an update to the macro originally posted. 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 SWx2005 - I have not tried it with SWx2006

' ******************************************************
' ISOViews.swp û Recorded on 12/20/01 by Mike J. Wilson
' ISOViews.swp û Updated on 6/7/05 by Heckler
' ******************************************************

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

Set swApp = Application.SldWorks
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