1 Reply Latest reply on Jan 22, 2015 5:36 PM by Yong Ning

    Rotate the dimension text orientation with API?

    Yong Ning

      It is possible to rotate the dimension text orientation using the Custom Text Position options in the Leaders tab of the Dimensions Property Manager.

      11-5-2014+8-47-18+AM.jpg

       

       

       

       

       

      Private Sub llll()

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

            Set SwApp = Application.SldWorks

            Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

            Set SwSelMgr = SwModel.SelectionManager

            Set SwDraw = SwModel

         Dim SwDispDim As DisplayDimension, SwDim As Dimension

            Set SwDispDim = SwSelMgr.GetSelectedObject5(1)

            Debug.Print SwDispDim.GetDimension.FullName

           With SwDispDim

               .ShowParenthesis = True

                  ' text orientation using the Custom Text Position options ????????

           End With

           ''

         Dim SwAnn As Annotation

            Set SwAnn = SwDispDim.GetAnnotation

            With SwAnn

                   '' text orientation using the Custom Text Position options ???????

            End With

         

      End Sub

       

       

      Solidworks API: How to change Dimension text - DASSAULT: SOLIDWORKS 3D Design - Eng-Tips

      http://www.eng-tips.com/viewthread.cfm?qid=240157

        • Re: Rotate the dimension text orientation with API?
          Yong Ning

          Find method

           

           

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

          Private Sub llll()

             Dim swApp As SldWorks.SldWorks, swModel As ModelDoc2, swDraw As DrawingDoc

                Set swApp = Application.SldWorks

                Set swModel = swApp.ActiveDoc

             Dim SwSelMgr As SelectionMgr

                Set SwSelMgr = swModel.SelectionManager

                Set swDraw = swModel

             Dim swDispDim As DisplayDimension, swDim As Dimension

                Set swDispDim = SwSelMgr.GetSelectedObject5(1)

                Debug.Print swDispDim.GetDimension.FullName

               With swDispDim

                  .HorizontalJustification = swTextJustificationCenter

                  Debug.Print .HorizontalJustification

                  .ShowParenthesis = True

                  .SetBrokenLeader2 True, swBrokenLeaderHorizontalText

                  .SetBrokenLeader2 False, swDisplayDimensionLeaderText_e.swBrokenLeaderHorizontalText

                  Debug.Print

                  .SetBrokenLeader2 False, swDisplayDimensionLeaderText_e.swBrokenLeaderAlignedText

                  .SetBrokenLeader2 False, swBrokenLeaderHorizontalText

                  .SetBrokenLeader2 False, swBrokenLeaderAlignedText

                  .SetBrokenLeader2 False, swSolidLeaderAlignedText

                

                  .CenterText = True

            

                  Set swDim = .GetDimension

                  .ShowParenthesis = False

                

               End With

               With swDim

                

               End With

               ''

             Dim SwAnn As Annotation

                Set SwAnn = swDispDim.GetAnnotation

                With SwAnn

           

           

                End With

                ''

                      Debug.Print "    AnnName = " & SwAnn.GetName

                      Debug.Print "      DimFullName      = " & swDim.FullName

                      Debug.Print "      DimName          = " & swDim.Name

                      Debug.Print "      DrivenState      = " & swDim.DrivenState

                      Debug.Print "      ReadOnly         = " & swDim.ReadOnly

                      Debug.Print "      Value            = " & swDim.GetSystemValue2("")

                      Debug.Print ""

                    

                      Debug.Print "      Arrowside        = " & swDispDim.ArrowSide

                    

                      Debug.Print "      TextAll          = " & swDispDim.GetText(swDimensionTextAll)

                      Debug.Print "      TextPrefix       = " & swDispDim.GetText(swDimensionTextPrefix)

                      Debug.Print "      TextSuffix       = " & swDispDim.GetText(swDimensionTextSuffix)

                      Debug.Print "      CalloutAbove     = " & swDispDim.GetText(swDimensionTextCalloutAbove)

                      Debug.Print "      CalloutBelow     = " & swDispDim.GetText(swDimensionTextCalloutBelow)

          End Sub

           

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

           

          How to display dimension of Horizontal Text wit... | SOLIDWORKS Forums

          https://forum.solidworks.com/message/366384#366384

           

           

          How to set center Dimension in drawingdoc with ... | SOLIDWORKS Forums

          https://forum.solidworks.com/message/428757#428757

           

           

          How to set the Radial Dimension Text Position? | SOLIDWORKS Forums

          https://forum.solidworks.com/message/429020#429020

           

           

          How to set Center Dimension with API | SOLIDWORKS Forums

          https://forum.solidworks.com/message/366436#366436

           

           

           

          How to display dimension of Horizontal Text wit... | SOLIDWORKS Forums

          https://forum.solidworks.com/message/366384#366384