I'm looking for a macro that will grab all dimension and use Auto arrange.
Ive found the below two snip its of code, is it as simple as take the line from one and replace the center dimension line?
status = swModelDocExt.AlignDimensions(swAlignDimensionType_e.swAlignDimensionType_AutoArrange, 0.001)
and the select all dims from this post
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
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
insert my line here? status = swModelDocExt.AlignDimensions(swAlignDimensionType_e.swAlignDimensionType_AutoArrange, 0.001)
Set swDispDim = swDispDim.GetNext5
Wend
Set swView = swView.GetNextView
Wend
End Sub
Thanks for your time!
SolidworksApi/macros
Hello, try this:
Thanks again Fifi!
I think the Auto Arrange function moves the dimensions at the edge of the view. That's why the 3/16" moves away.
That worked pretty darn well! As is that's a vast improvement, there is one dim that actually moved further away and I suspect that's a limitation of the Auto Arrange feature not the macro. Am I correct?
Before
and after
And I see that the code wasn't as simple as I thought, no cut and paste haha.