Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

DIMENSION JOG 2

Status
Not open for further replies.

gparr

Electrical
Oct 20, 2004
10
I'm trying to find a different way to access the dimension jog other than RMB DIM -> DISPLAY OPTIONS -> JOG/UNJOG.

When trying to tidy up a drawing with hundreds of dims, the process mentioned above takes about 4 secs, not to mention too many mouse clicks.

I haven't come across a jog command button, keyboard shortcut or macro to help shorten this procedure. Any help would be appreciated.
thanks!
 
Replies continue below

Recommended for you

If you are trying to add the ability to jog dimensions, you could box-select all of them then do the RMB thing. This will allow every dimension to be jogged manually.

[cheers]
 
Thanks C.

The problem then is when zooming out to get a bird's eye view of what needs to be changed and multi-selecting each individual dimension is that I generally lose my ability to select accurately, thus causing other problems.

I've sent this as an enhancement request, but I'm sure it isn't at the top of the list.

Thanks for the feedback. Congrats on Tip King of the Week.
 
That's why I mentioned doing a box selection of ALL the dimensions. The ones that are already jogged will remain jogged, but the ones that weren't jogged will become joggable.

... and thanks for the congrats.

[cheers]
 
Here's a macro you can map to a keyboard shortcut. To use it, select an ordinate dimension and run the macro. It will toggle the jog state of the dimension. It currently only works for one dimension at a time. As posted it will notify the user with a message box if the selection set is inappropriate (more than one item selected, selection is not a dimension, dimension is not ordinate). If you don't want to see the notification, change the value of NOTIFY_ERRORS to "False".

Let me know if you want to be able to run this on multiple preselected dims.

Code:
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.ClearSelection2 True
swDoc.GraphicsRedraw2
End Sub
 
SSSSSWEEEET. That is exactly what I needed. Mapped to the handy "J" key and off I go. That's great.

If you have one already for a multi-select, I'll be glad to put it in the arsenal. "K" is sounding good about now. Otherwise, no worries. This first one should meet most of my needs.
Thanks a bunch. Been a great help.
 
I went ahead and wrote the multi-select version. It's actually a bit shorter. Any inappropriate selections will simply be ignored. Enjoy!

Code:
Dim swDoc As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDispDim As SldWorks.DisplayDimension
Dim i As Long

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

For i = 1 To swSelMgr.GetSelectedObjectCount
    If swSelMgr.GetSelectedObjectType3(i, Empty) = swSelDIMENSIONS Then
        Set swDispDim = swSelMgr.GetSelectedObject6(i, Empty)
        If swDispDim.GetType = swOrdinateDimension Then
            If swDispDim.Jogged Then
                swDispDim.Jogged = False
            Else
                swDispDim.Jogged = True
            End If
        End If
    End If
Next
swDoc.ClearSelection2 True
swDoc.GraphicsRedraw2
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor