AnsweredAssumed Answered

Looking For an auto arrange dimensions macro

Question asked by Justin Pires on Sep 25, 2019
Latest reply on Sep 26, 2019 by Justin Pires

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?

from Insert Auto Arrange Dimensions Macro? I've got this line

status = swModelDocExt.AlignDimensions(swAlignDimensionType_e.swAlignDimensionType_AutoArrange, 0.001)

 

and the select all dims from this post Select and center all dimensions on a drawing 

 

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!

Outcomes