6 Replies Latest reply on May 11, 2015 2:08 AM by Christoph Neundorf

    Text associated with Gtol

    Chris Champions

      Thank you Deepak - I got it

        • Re: Text associated with Gtol
          Deepak Gupta

          Do you mean something like done by this macro: Set Text in Datum Tags and GTols Example (VBA)

            • Re: Text associated with Gtol
              Chris Champions

              Thank you Deepak

              it's very closed but what I want is to add  text to all Gtol Frames in the drawing (all views)

                • Re: Text associated with Gtol
                  Deepak Gupta

                  There is a loop example which you can use to loop thru the drawing views and edit the Gtol macro to update all of them.

                    • Re: Text associated with Gtol
                      Chris Champions

                      you mean on this forum or from the API samples?

                        • Re: Text associated with Gtol
                          Deepak Gupta

                          Try these codes:

                          Option Explicit

                              Dim swApp                       As SldWorks.SldWorks

                              Dim swModel                     As SldWorks.ModelDoc2

                              Dim swDraw                      As SldWorks.DrawingDoc

                              Dim swView                      As SldWorks.View

                              Dim swDispGtol                  As SldWorks.Gtol

                              Dim vSheetName                  As Variant

                              Dim i                           As Integer

                           

                          Sub main() 

                              Set swApp = Application.SldWorks

                              Set swModel = swApp.ActiveDoc

                              Set swDraw = swModel

                             

                              vSheetName = swDraw.GetSheetNames

                                  For i = 0 To UBound(vSheetName)

                                  swDraw.ActivateSheet vSheetName(i)

                                      Set swView = swDraw.GetFirstView

                                      Set swView = swView.GetNextView

                                              Do While Not swView Is Nothing

                                                      Set swDispGtol = swView.GetFirstGTOL

                                                          swDispGtol.SetText swGTolTextPrefix, "prefix"

                                                          swDispGtol.SetText swGTolTextSuffix, "suffix"

                                                          swDispGtol.SetText swGTolTextCalloutAbove, "above"

                                                          swDispGtol.SetText swGTolTextCalloutBelow, "below"

                                                  Set swView = swView.GetNextView

                                              Loop          

                                  Next i

                          End Sub