1 Reply Latest reply on Sep 26, 2013 5:14 PM by Keith Rice

    Tool for rearrange the dimension lable position

    Mahesh Revanwar

      Hello,

       

      Please tell me, is there any API to rearrange the dimension lable position through code?

        • Re: Tool for rearrange the dimension lable position
          Keith Rice

          Mahesh,

           

          You will need to get the IDisplayDimension pointer for that dimension, then use IDisplayDimension::GetAnnotation to get the IAnnotation pointer, then use IAnnotation::SetPosition to change the position.

           

          For example, select a sketch and then run this code. It will put a dimenion at the origin.

           

          =======

           

          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swSelMgr As SldWorks.SelectionMgr

          Dim swFeat As SldWorks.Feature

          Dim swDispDim As SldWorks.DisplayDimension

          Dim swAnn As SldWorks.Annotation

           

          Sub main()

              Set swApp = Application.SldWorks

              Set swModel = swApp.ActiveDoc

              Set swSelMgr = swModel.SelectionManager

              Set swFeat = swSelMgr.GetSelectedObject6(1, -1)

              Set swDispDim = swFeat.GetFirstDisplayDimension

              Set swAnn = swDispDim.GetAnnotation

              swAnn.SetPosition 0, 0, 0

          End Sub

           

          =======

           

          Keith

          SolidWorks API Tutorials