When lines get cluttered on drawings, sometimes drafters will hide one side of dimension and extension lines.
For myself, I have encountered a lot of drawings involving half sections or cropped section views, where usually one side of dimension/extension lines are sufficient.
Just want to share the code below to help with this issues.
I create two macro buttons, for left and right hand side. As most users won't be able to remember which side is it, you can just click the other button again to switch to the other side. Kinda like toggling.
This code also turn off "foreshortened" dimension and "center text" by default, as I find it to be problematic most of the time.
You can modify the code to suit your needs.
Left Hand Side
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDispDim As SldWorks.DisplayDimension
Dim swSelMgr As SldWorks.SelectionMgr
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Dim i As Integer
For i = 1 To swSelMgr.GetSelectedObjectCount2(-1)
Set swDispDim = swSelMgr.GetSelectedObject6(i, -1)
swDispDim.CenterText = False
swDispDim.Foreshortened = False
swDispDim.WitnessVisibility = 1
swDispDim.LeaderVisibility = 1
Next i
swModel.GraphicsRedraw2
End Sub
Right Hand Side
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDispDim As SldWorks.DisplayDimension
Dim swSelMgr As SldWorks.SelectionMgr
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Dim i As Integer
For i = 1 To swSelMgr.GetSelectedObjectCount2(-1)
Set swDispDim = swSelMgr.GetSelectedObject6(i, -1)
swDispDim.CenterText = False
swDispDim.Foreshortened = False
swDispDim.WitnessVisibility = 2
swDispDim.LeaderVisibility = 2
Next i
swModel.GraphicsRedraw2
End Sub