I use this macro to CENTER all linear dimensions in a Drawing if they are not already centered via Right Click>DisplayOptions>CenterDimension. The trouble is the view needs to be updated via Scroll Button, Zoom to Fit, or Rebuild before the display will actually update and show the dimensions have been centered... I assign this macro to a toolbar button, so when i click the button and nothing visually happens I get concerned that the macro didn't work... I don't know how all this code is built, i typically just copy and paste things from this forum and everything i've searched for and tried so far doesn't seem to function if I add it to this code. I'm working on Solidworks 2017 x64 SP4.1
------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swDwg As SldWorks.DrawingDoc
Dim swDispDim As SldWorks.DisplayDimension
Dim swView As SldWorks.View
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swDwg = swDoc
Set swView = swDwg.GetFirstView
While Not swView Is Nothing
Set swDispDim = swView.GetFirstDisplayDimension5
While Not swDispDim Is Nothing
swDispDim.CenterText = True
Set swDispDim = swDispDim.GetNext5
Wend
Set swView = swView.GetNextView
Wend
End Sub
------------------------------------------------------------
thanks for any help
jim
SolidworksApi macros