Kim White

Solidworks API GetDimensionDisplayString4() Method (IView)

Discussion created by Kim White on Dec 18, 2019
Latest reply on Dec 19, 2019 by Josh Brady

Hi there, I'm trying to create a macro to extract the text from the dimensions in an active drawing view. I put together the macro below but I get a run time error '424' on the bolded line that tells me that an object is required? What am I doing wronf?Any guidance is much appreciated.


(Ultimately I'd like to be able to specifically get the prefix text from the selected dimension in a drawing but I figured the below is a good starting point.)



   Option Explicit

   Sub main()

   Dim swApp                               As SldWorks.SldWorks
   Dim swModel                            As SldWorks.ModelDoc2
   Dim swDraw                             As SldWorks.DrawingDoc
   Dim swView                              As SldWorks.View
   Dim swDispDim                         As Object


   Set swApp = Application.SldWorks
   Set swModel = swApp.ActiveDoc
   Set swDraw = swModel
   Set swView = swDraw.ActiveDrawingView


   Set swDispDim = swView.GetDimensionDisplayString4()

   Debug.Print  swDispDim


End Sub