Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

View orientation in Macro 1

Status
Not open for further replies.

CycloneWade

Automotive
Apr 1, 2005
76
I'm trying to switch to a predefined view in a part before the body of the macro executes. Here is the start of the macro.

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager


boolstatus = Part.Extension.SelectByID2("Sketch2", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Sketch2", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.FeatureManager.FeatureExtrusion2 True, False, False, 0, 0, 0.1524, 0.01, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1, 0, 0, False
Part.SelectionManager.EnableContourSelection = 0



I'm using this command
Part.ShowNamedView2 "LogoView3", -1

I've placed this directly after Set SelMgr, but the macro reverts back to another view. I then place this after the creation of the first body and it switches views. My question is how can I have the view switch before I start creating bodies?

Thanks.
 
Replies continue below

Recommended for you

It looks like this macro was generated by the recorder. The issue is probably that when you create your first extrusion feature in a part, the display automatically reorients to show an isometric type view of the extrusion. There may be a way to create the extrude feature in a different way that doesn't do the reorientation. However, what's the problem with putting your named view orientation after the creation of the first feature?

-handleman, CSWP (The new, easy test)
 
I'm trying to capture the macro events in a movie and would like the entire macro to run at the predefined view.
 
handleman,
I love the new signature, I thought of doing the same thing.

-Dustin
Professional Engineer
Certified SolidWorks Professional
 
If all you care about is the movie, just manually create some extrusion somewhere out off the screen, then run your macro.

-handleman, CSWP (The new, easy test)
 
Oh, and thanks, Dustin! :) It just doesn't feel right not qualifying the "CSWP" when some people took the test back when it really meant something.

-handleman, CSWP (The new, easy test)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor