4 Replies Latest reply on Sep 4, 2018 4:59 PM by Adam Doerr

    PDM API Help - Adding an error message to a custom program if drawing is not up to date

    Adam Doerr

      We have a simple program on a keyboard shortcut in Solidworks to print drawings at B size, but I'd like to add a warning/error message to the user if the drawing has the "File edited but not saved" pencil symbol and/or the "Referencing older version" exclamation symbol shown in the PDM pane. The pencil symbol shows up for the drawing, but the exclamation symbol is next to the part/assembly the drawing is linked/referenced to (also shown in the drawing's "Child Quick Info" column). Can anyone give me any suggestions on how to add this kind of functionality to my macro if it's even possible?

       

      Here's the current code for our program:

       

      Dim SWAPP As Object

      Dim PART As Object

      Dim pagesetup As Object

      Dim PRINTER1 As String

      Dim CPAPERSIZE1 As String

      Dim SHEET As Object

      Dim PAPERSZ As Variant

       

      Private Sub Form_Load()

      Set SWAPP = CreateObject("SldWorks.Application")

      Set PART = SWAPP.ActiveDoc

      Set pagesetup = PART.pagesetup

      Set SHEET = PART.GETCURRENTSHEET

       

      'PRINTER1 = SWAPP.ACTIVEPRINTER

      'CPAPERSIZE1 = PART.printsetup(0)

       

      'Text1.Text = PRINTER1

      'Text2.Text = CPAPERSIZE1

       

      PAPERSZ = SHEET.GETPROPERTIES

      'Text2.Text = PAPERSZ(0)

      PSIZE = PAPERSZ(0)

       

      If PSIZE = 0 Then

        PART.Printer = "\\SERVER\HP5N"

        PART.printsetup(0) = 1

       

      End If

       

      If PSIZE = 2 Then

        PART.Printer = "\\SERVER\HP5N"

        PART.printsetup(0) = 17

       

      End If

       

      If PSIZE = 3 Then

        PART.Printer = "\\SERVER\XES Synergix 8830"

        PART.printsetup(0) = 24

       

      End If

       

      If PSIZE = 4 Then

        PART.Printer = "\\SERVER\XES Synergix 8830"

        'PART.printsetup(0) = 43

         PART.printsetup(0) = 25

      End If

       

      If PSIZE = 5 Then

        PART.Printer = "\\SERVER\XES Synergix 8830"

        PART.printsetup(0) = 26

       

      End If

       

      pagesetup.Orientation = 2

       

      PART.printout2 1, 1, 1, 0, "", 1#, 0, ""

       

      End

       

      End Sub