ISO Front-Right
ISO Right-Rear
ISO Rear-Left
ISO Left-Front
Simply run the macro and your ready to go.
Notes:
*) This macro can be played at any time in an assembly or part
*) You can run the macro with the "View Orientation" dialog
box open, however, you must close it and re-open it to
see the new views.
*) As your assembly or part changes in size, you can "reset"
the four iso views by deleting them and running the macro
again. The macro will do a zoom-to-fit, allowing you to
see the whole model.
*) Can be used with Animator to rotate your model
You can download the macro here...
http://www.mikejwilson.com/solidworks/api-macros/isoviews.zip
Or if you prefer, you can use this code...
' *************************************************************
' ISOViews.swp - macro recorded on 12/20/01 by Mike J. Wilson
' *************************************************************
' Special thanks to Dennis Kelley and Dan Hanger for tips
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.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView ("ISO Front-Right")
Part.ShowNamedView2 "*Right", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView ("ISO Right-Rear")
Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView ("ISO Rear-Left")
Part.ShowNamedView2 "*Left", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView ("ISO Left-Front")
End Sub
If anyone has suggestions or improvements,
let me know!
Mike Wilson
PS: Special thanks to Dennis Kelley and Dan Hanger
for tips.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
Check out our new Unlimited Server. No Download or Time Limits!
-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----
This is one I already had that does basically the same thing. I don't
know if this is an improvement, but there's less math up front. The
views are named differently, and I delete them if they exist before
trying to re-create them.
' ******************************************************************************
' macro recorded on 10/26/01 by mreimer
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim View As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
'delete existing views with these names if they exist
Part.DeleteNamedView ("Right Isometric")
Part.DeleteNamedView ("Rear Isometric")
Part.DeleteNamedView ("Left Isometric")
'Set the view to the standard Isometric view
Part.ShowNamedView2 "*Isometric", -1
' Get the view object
Set View = Part.ActiveView
'rotate the view, zoom to fit and save the view with the appropriate
name
View.RotateAboutAxis Atn(1) * 2, 0, 0, 0, 0, 1, 0
Part.ViewZoomtofit2
Part.NameView "Right Isometric"
'rotate the view, zoom to fit and save the view with the appropriate
name
View.RotateAboutAxis Atn(1) * 2, 0, 0, 0, 0, 1, 0
Part.ViewZoomtofit2
Part.NameView "Rear Isometric"
'rotate the view, zoom to fit and save the view with the appropriate
name
View.RotateAboutAxis Atn(1) * 2, 0, 0, 0, 0, 1, 0
Part.ViewZoomtofit2
Part.NameView "Left Isometric"
'Set the view to the standard Isometric view
Part.ShowNamedView2 "*Isometric", -1
Part.ViewZoomtofit2
End Sub
Thank You,Sincerly,Brian Brazeau
> Mike Wilson
>
> PS: Special thanks to Dennis Kelley ,Dan Hanger and Mike Wilson
> this macro!
Regards,
Mike Wilson
"Mike J. Wilson" <mwi...@sigmathree.com> wrote in news:3c21b445_1
@news.newsgroups.com:
Pardon my lack of experience with macro's but I tried running the .swp
file as well as copying the information you provided into a new .swb
and tried running that and got an error that would not let me
continue. (Error 168 in Line 14:Encountered: end of line expecting:.
-> Part.DeleteNamedView ("Right Isometric")) Is something out of
sinc here? It sounds like a nice feature that should be included in
SWX.
Anyway, Thanks for any help
Paul
You may want to take a look at some of my (german commented)
macros at http://solidworks.cad.de/mm_index.htm oder
http://swtools.cad.de/ (both german and english).
The macros are usually written as an example how to code a
special task, but there are some "productive" macros also.
If I have a little spare time left I will try to comment them in english
too. And yes, I have submitted them to for model library, but as you
read in the other posts ...
Stefan
--
unofficial german SolidWorks helpsite
http://solidworks.cad.de
tools and programs for SolidWorks
http://swtools.cad.de
Looks like you got an extra ")" at the end of that line somehow.
The line should read..
Part.DeleteNamedView ("Right Isometric")
Mark
One thing that I would add at the end is to release the Objects that
you set at the beginning. Put these two lines just before your end
sub.
Set Part = Nothing
Set swApp = Nothing
Thanks for the nice little macro.
dp
"Mike J. Wilson" <mwi...@sigmathree.com> wrote in message news:<3c21b...@news.newsgroups.com>...
I doubt that's how an isometric is supposed to be. I never noticed
that the standard SolidWorks Isometric view was slightly skewed like
that. My guess is that the standard SolidWorks isometric view has an
error in it and since my macro just rotates the SolidWorks Isometric
view to create the new views, the same problem is transferred to those
new views. I will use your method from now on.
I wonder if SolidWorks is aware of the problem or if they skewed it
slightly for a reason.
Mark
00. All macros in a file (except 09)
01. Delete all surface colors
02. Select mass of all model components
03. Start programs by macro
04. Use API calls in macros
05. Save all pages of a drawing as DXF
06. Fix all components in model
07. Measure texts enter
08. Copy document options
09. Fill out engineering drawing block
10. Feature list
Feature list as Excel solution
11. Automatically create center line crosses
12. German Visual basic 3 assistance file
Nice library!,
Mike Wilson
BTW, Changing Part.ViewZoomtofit to Part.ViewZoomtofit2 (note the
2 on the end) will zoom in closer.
This function differs from ViewZoomtofit only in that it will zoom in closer
to the geometry and have less of a border.
Cheers,
Kevin R. Krebs
Plano, Texas
"StarrRider" <Starr...@Hotmail.com> wrote in message
news:moWX7.9417$dG.54...@news1.rdc1.sdca.home.com...
> Mike - I liked your macro so much that I messed with it (after reading all
> the rest of these messages and incorporating them)
> I added:
> Deleting the original views
> Releasing the variables
> Added the Other 4 (Bottom) Iso views
> Renamed the views
> TRF-ISO & BRF-ISO
> TRR-ISO & BRR-ISO
> Ect
>
> Thanks again
> StarrRider
>
> ' *************************************************************
> ' ISOViews.swp - macro recorded on 12/20/01 by Mike J. Wilson
> ' *************************************************************
> ' Special thanks to Dennis Kelley and Dan Hanger for tips
>
> 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
>
>
>
>
Anybody ever notice how the default ISO view in SWX is NOT A TRUE ISO view??
Do this to test it...
1.) Create a 1x1x1 cube (or any perfect cube)
2.) Use the hidden lines view
3.) Go to the default ISO view
4.) Zoom in to the center corner on the screen....
The Front and back vertexes should be EXACTLY coincident, which they are
NOT.
Another way to test this flaw..
1.) Create a 1x1x1 cube
2.) Insert an ISO view (the SWX default) into a drawing and use PROJECTED
dimensioning
3.) Sketch a horizontal line starting at the bottom vertex.
4.) Place an angular dimension between the horizontal line you just created
and the bottom edge of the cube
The angle should read EXACTLY 30 deg. It does not.......
"Stefan Berlitz" <stefan.berlitz@[nospam]solidworks.cad.de> wrote in message
news:3c22e4de$0$187$4d4e...@read.news.de.uu.net...
It is only 29.997°, how could SWX be so sloppy.
Dave
Read my reply to Mark on 12/20/2001 at 10:24am ;^) ...
Mike Wilson