×
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

break alignment macro

break alignment macro

break alignment macro

(OP)
Dear Experts:

Below is a recorded macro for jog/unjog of a dimension. I'd love to have a break alignment macro, but the macro won't record break alignment for some reason.  Is there an easy way to modify below to achieve this?  It's for swx 2006.

Const NOTIFY_ERRORS As Boolean = True

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDim As SldWorks.Dimension
Dim swDispDim As SldWorks.DisplayDimension

Sub JoggleToggle()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swSelMgr = swDoc.SelectionManager

If swSelMgr.GetSelectedObjectCount <> 1 Then
    If NOTIFY_ERRORS Then MsgBox "Select a single dimension and run again"
    Exit Sub
ElseIf swSelMgr.GetSelectedObjectType3(1, Empty) <> swSelDIMENSIONS Then
    If NOTIFY_ERRORS Then MsgBox "Select one dimension and run again"
    Exit Sub
End If

Set swDispDim = swSelMgr.GetSelectedObject6(1, Empty)
If swDispDim.GetType <> swOrdinateDimension Then
    If NOTIFY_ERRORS Then MsgBox "Dimension was not ordinate"
    Exit Sub
End If

If swDispDim.Jogged Then
    swDispDim.Jogged = False
Else
    swDispDim.Jogged = True
End If

swDoc.GraphicsRedraw2
End Sub

RE: break alignment macro

Don't know about SW2006, but the SW2010 API Help section shows...

Visual Basic (Declaration);   

CODE

Sub BreakDimensionAlignment()
 

Visual Basic (Usage);

CODE

Dim instance As IModelDoc2
 
instance.BreakDimensionAlignment()
 

RE: break alignment macro

Here you go:

CODE

Sub IwannaBreakSomeDimensionAlignments()
  Application.SldWorks.ActiveDoc.BreakDimensionAlignment
End Sub

By the way, that's not a recorded macro you've got there.  I know, 'cuz I wrote it.  winky smile

-handleman, CSWP (The new, easy test)

RE: break alignment macro

(OP)
Thanks guys.  Yep, I realized after I posted, going through the code, that it wasn't recorded.  I couldn't remember where I got it from, though, so I figured the owner would correct me.  =)  And you did!  So thanks again.  It's been very useful.

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