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
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