1 Reply Latest reply on Dec 8, 2016 7:16 PM by Yong Ning

    Space Tightly Across of Dimenstion with API

    Yong Ning

      2012 SOLIDWORKS Help - Align Toolbar  http://help.solidworks.com/2012/english/solidworks/sldworks/align_toolbar.htm



      Aligns annotations with the center of the topmost annotation, closely togethe

        • Re: Space Tightly Across of Dimenstion with API
          Yong Ning

          Follow code don't Space Across?



          2012 SOLIDWORKS API Help - Auto-arrange Dimensions (VBA)  http://help.solidworks.com/2012/english/api/sldworksapi/auto-arrange_dimensions_example_vb.htm



          ' Preconditions:

          ' 1. Open:

          '  <SolidWorks_install_dir>\samples\tutorial\advdrawings\foodprocessor.slddrw.

          ' 2. Box-select the dimensions in Drawing View1.


          ' Postconditions: The selected dimensions are auto-arranged.


          ' NOTE: Because the model is used elsewhere,

          ' do not save changes when closing it.



          Option Explicit

          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swModelDocExt As SldWorks.ModelDocExtension

          Dim swDrawingDoc As SldWorks.DrawingDoc

          Dim status As Boolean

          Dim errors As Long

          Sub main()

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swModelDocExt = swModel.Extension

          Set swDrawingDoc = swModel

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

          End Sub