2 Replies Latest reply on Jun 11, 2015 2:54 PM by Solidworks Selim

    Align dimension

    Solidworks Selim

      Aligning macro dimension

       

      1.JPG

        • Re: Align dimension
          Oleg Bezyaev
          Dim swApp As SldWorks.SldWorks
          Dim swModel As SldWorks.ModelDoc2
          Dim swDrawingDoc As SldWorks.DrawingDoc
          Dim swModelDocExt As SldWorks.ModelDocExtension
          Dim swDisplayDim As SldWorks.DisplayDimension
          Dim boolstatus As Boolean
          Dim swDispDim As SldWorks.DisplayDimension
          Dim swAnn As SldWorks.Annotation
          
          Sub main()
              Set swApp = Application.SldWorks
              Set swModel = swApp.ActiveDoc
              Set swModelDocExt = swModel.Extension
              Set swDrawingDoc = swModel
              Set swView = swDrawingDoc.GetFirstView
              
              Do While Not swView Is Nothing
                  Set swDispDim = swView.GetFirstDisplayDimension
                  Do While Not swDispDim Is Nothing
                      Set swAnn = swDispDim.GetAnnotation
                      boolstatus = swAnn.Select(True)
                      Set swDispDim = swDispDim.GetNext5
                  Loop
                  Set swView = swView.GetNextView
              Loop
              Status = swModelDocExt.AlignDimensions(swAlignDimensionType_e.swAlignDimensionType_AutoArrange, 0.001)
              swModel.GraphicsRedraw2
              swModel.ClearSelection2 (True)
          End Sub