5 Replies Latest reply on Nov 5, 2016 12:02 AM by Deepak Gupta

    Ordinate Dimension Jog Toggle Macro Update?

    Daen Hendrickson

      I am using SW2014 SP5.


      I have been using the Jog Toggle macro for a number of years. I do not see any author's credentials in the code so I am not sure who deserves credit. I have this assigned to both a keyboard shortcut and a soft key on my SpacePilot.


      I use this often. However, it has been "unstable" for a while. If I get in too much of a hurry and launch the macro a second time before it has COMPLETELY ran the previous time it crashes SW. Perhaps this is a quirk with my SpacePilot, but it only shows up with this macro... This bit me yesterday so I decided to try to fix it.


      Since this code has been around for a long time, I suspect there are some outdated processes written into it that could be update. This is not my strong point. Would someone be willing to suggest any updates to this relatively simple bit of code?






      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Dim swSelMgr As SldWorks.SelectionMgr

      Dim swDispDim As SldWorks.DisplayDimension

      Dim i As Long


      Sub JoggleToggleMulti()

      Set swApp = Application.SldWorks

      Set swModel = swApp.ActiveDoc

      Set swSelMgr = swModel.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


                      swDispDim.Jogged = True

                  End If

              End If

          End If


      swModel.ClearSelection2 True


      End Sub