4 Replies Latest reply on Jan 11, 2018 5:37 PM by Jacob Corder

    C#: Debug.Print()

    Gabriele Sorrento

      Hi guys,

      I am trying to write my first api with SW but I really do not understand where am I supposed to see the output of Debug.Print().

      I wonder if there is a way to print to a console in the SW gui..

      thanks!

        • Re: C#: Debug.Print()
          Christian Chu

          You need to select where you want to see it. The option is in project properties

          • Re: C#: Debug.Print()
            Gabriele Sorrento

            so there is no way to print something in SW?

              • Re: C#: Debug.Print()
                Christian Chu

                Gabriele Sorrento wrote:

                 

                so there is no way to print something in SW?

                Not sure what you mean by "print something in SW"

                debug.print is the message you can see during the compiling

                You can also use console.write for this purpose

                see below image

                • Re: C#: Debug.Print()
                  Jacob Corder

                  you can print to the Status bar

                  Public Function SetStatusBarText(ByVal SApp As SldWorks, ByVal TextToSet As String) As Boolean

                          Dim RetVal As Boolean = False

                          If Len(Trim(TextToSet)) > 0 Then

                              Dim SWFrame As Frame = CType(SApp.Frame, Frame)

                              If IsNothing(SWFrame) = False Then

                                  Try

                                      If TextToSet = "CLEAR" Then

                                          SWFrame.SetStatusBarText("")

                                      Else

                                          SWFrame.SetStatusBarText(TextToSet)

                                      End If

                                      RetVal = True

                                  Catch ex As Exception

                                  End Try

                              End If

                        (you should call Marshal.ReleaseCOMObject(swframe))

                        SWFrame = Nothing

                          End If   

                      End Function