1 Reply Latest reply on Aug 14, 2015 10:57 AM by Leon Wurr

    Why don't get the DisplayDimension in Sheet Format

    Yong Ning

      Follow code, why don't get DisplayDimension in Sheet Format?

      1.jpg

       

      Set swView = swDraw.GetFirstView

      Ss = swView.GetAnnotations →  is empty, see bottom picture

       

       

       

      2.jpg

       

       

       

       

       

      follow code, don't find displaydimention.in Sheet Format? can be get displaydimension in View?

       

       

      Private Sub ll3()

         Dim swApp As SldWorks.SldWorks, swModel As ModelDoc2

            Set swApp = Application.SldWorks

            Set swModel = swApp.ActiveDoc

         Dim swDraw As DrawingDoc, swView As View

            Set swDraw = swModel

            Set swView = swDraw.GetFirstView

         Dim SwAnn As Annotation, Ss

            Ss = swView.GetAnnotations

         Dim SwDispDim As DisplayDimension, SwDim As Dimension

       

         For ii = 0 To UBound(Ss)

            Set SwAnn = Ss(ii)

            Set SwDispDim = SwAnn.GetSpecificAnnotation

            Set SwDim = SwDispDim.GetDimension

            Debug.Print SwDim.FullName, SwDim.Value

         Next ii

      End Sub

      '''*****************

       

      Set SwDispDim = swView.GetFirstDisplayDimension

        result → result is nothing?

      3.jpg

       

       

       

       

       

      Private Sub ll4()

         Dim swApp As SldWorks.SldWorks, swModel As ModelDoc2

            Set swApp = Application.SldWorks

            Set swModel = swApp.ActiveDoc

         Dim swDraw As DrawingDoc, swView As View

            Set swDraw = swModel

            Set swView = swDraw.GetFirstView

         Dim SwDispDim As DisplayDimension, SwDim As Dimension

            Set SwDispDim = swView.GetFirstDisplayDimension

            Stop

       

      End Sub

        • Re: Why don't get the DisplayDimension in Sheet Format
          Leon Wurr

          Since it's a sketch dimension, you should use IDimension:

           

          Sub main()
          
          
              Set swApp = Application.SldWorks
              Set swModel = swApp.ActiveDoc
              Set swDraw = swModel
              Set swView = swDraw.GetFirstView
              
              Dim swDim As SldWorks.Dimension
              Dim vDimVal As Variant
              Set swDim = swModel.Parameter("D1@Sketch2")
              vDimVal = swDim.SetValue2(10, swSetValue_InAllConfigurations)
              
              Stop
           
          End Sub