Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

break alignment macro 1

Status
Not open for further replies.

generalpatton

Mechanical
Jul 15, 2009
62
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
 
Replies continue below

Recommended for you

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()
 
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. ;-)

-handleman, CSWP (The new, easy test)
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor