0 Replies Latest reply on May 20, 2014 12:25 AM by Yong Ning

    How to set center Dimension in drawingdoc with API?

    Yong Ning

      000.jpg

       

       

      Set SwDim = SwSelMgr.GetSelectedObject2(1)→ SwDim as Dimension → don't set center dimension.

       

       

       

      Private Sub ll0220()
        Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2, SwDraw As DrawingDoc
          Set SwApp = GetObject(, "SldWorks.Application")
          Set SwModel = SwApp.ActiveDoc
          Set SwDraw = SwModel
        Dim SwSelMgr As SelectionMgr, DispDim As DisplayDimension, SwDim As Dimension
          Set SwSelMgr = SwModel.SelectionManager
          Set SwDim = SwSelMgr.GetSelectedObject2(1)
          Debug.Print SwDim.FullName

         
          With SwDim
            
          End With
         
      End Sub

       

      ************************************************************

      Now can traverse displaydimen → DispDim.CenterText = True

       

      Private Sub lll0220()

        Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2, SwDraw As DrawingDoc, SwFeat As Feature

          Set SwApp = GetObject(, "SldWorks.Application")

          Set SwModel = SwApp.ActiveDoc

          Set SwDraw = SwModel

        Dim SwView As View

          Set SwView = SwDraw.GetFirstView

          'Set SwView = SwView.GetNextView

        Dim DispDim As DisplayDimension, SwDim As Dimension

          Set DispDim = SwView.GetFirstDisplayDimension

          Do While Not DispDim Is Nothing

             Set SwDim = DispDim.GetDimension

             DispDim.CenterText = True

             Set DispDim = DispDim.GetNext

          Loop

      End Sub