2 Replies Latest reply on Dec 18, 2013 8:35 AM by Santosh Pawar

    Set Dimension Extension Line Length

    Jela Rose Tano-An

      How to set the length of the dimension extension line length?

      I've attached sample drawing that I want to change the dimension extension line length using API.

        • Re: Set Dimension Extension Line Length
          Matt Martens

          If you are trying to make the gap between the extension line and the object larger, then IDisplayDimension::SetWitnessLineGap is what you need.

           

          If you are trying to set the amount the extension line extends past the dimension, that can only be set globally for all dimensions by using ISldWorks::SetUserPreferenceDoubleValue(swDetailingWitnessLineExtension).

          • Re: Set Dimension Extension Line Length
            Santosh Pawar

            SetPosition Method (IAnnotation) will do it.

             

            Dim swApp As Object

            Dim Part As ModelDoc2
            Dim boolstatus As Boolean
            Dim longstatus As Long, longwarnings As Long

            Sub main()

            Set swApp = _
            Application.SldWorks

            Set Part = swApp.ActiveDoc
            boolstatus = Part.ActivateView("View1")
            boolstatus = Part.Extension.SelectByID2("RD1@View1", "DIMENSION", 0.239874837054649, 0.18876996978852, 0, False, 0, Nothing, 0)
            Dim selmgr As SelectionMgr
            Set selmgr = Part.SelectionManager
            Dim dispdim As DisplayDimension
            Set dispdim = selmgr.GetSelectedObject6(1, -1)
            Dim ann As Annotation
            Set ann = dispdim.GetAnnotation
            ann.SetPosition 0.239874837054649, 0.28876996978852, 0
            Part.ClearSelection2 True
            End Sub