×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Toggle broken-view macro

Toggle broken-view macro

Toggle broken-view macro

(OP)
Very often I will go to a page that has a broken view and the view is not broken.  By that I mean the view still has the broken-view lines, but there is no clear gap between the lines.  

See pic: http://paul-flores.com/solidworks_screenshots/broken_view.jpg


I have to right-click the view, pick "un-break view", then break the again.

I thought instead of doing this several times a day, a broken-view toggle would be the better way to do this.

Preconditions: view is pre-selected
1. Un-break view
2. Break view

CODE

' ******************************************************************************
' macro recorded on 06/18/08
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.1035512874926, 0.06293938349189, -1999.382179705, False, 0, Nothing, 0)
Part.UnBreakView
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.09800694802044, 0.06776054825029, -1999.382179705, False, 0, Nothing, 0)
Part.BreakView
Part.ClearSelection2 True
End Sub

The problem is that it only works with the original view.   It doesn't work with different views on different pages.

Can anybody help correct this problem?

Flores

RE: Toggle broken-view macro

You might want to check and see if Break and Un-Break are always the same shortcut letter in the right-click menu.  For example, I almost wrote something to make a shortcut for Select Other, but then I realized that it's always the S key in the right-click menu.  So (since I always roll with left hand on keyboard), I can always access Select Other almost as instantly as a single click.  I often don't even see the right-click menu open.

That being said, in this case your macro recorder has recorded the location of your selections.  That's why it only works on the first view.  If you'll get rid of all the code dealing with selections, the macro will work on whatever view you have pre-selected.

CODE

Dim swDwg As SldWorks.DrawingDoc

Sub main()
    Set swDwg = Application.SldWorks.ActiveDoc
    swDwg.UnBreakView
    swDwg.BreakView
End Sub

-handleman, CSWP (The new, easy test)

RE: Toggle broken-view macro

(OP)
Thank you much Handleman, you've been a big help as always.   This "broken-view becoming un-broken" has been around a long time, but now that you helped me with a toggle, it looks like they fixed it.

Because of the non-disclosure agreement I don't think I can post the text of the SPR fixes, but I think my problem may have been fixed with SPR# 391246 in SP4.0

Flores

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources