2 Replies Latest reply on Apr 5, 2018 8:12 AM by Aaron Torberg

    PDM watermark removal does not play nice with printing macro

    Aaron Torberg

      Some background info:


      I have developed a macro to make printing drawings in our company easier.  It checks for sheet size, sets the appropriate print options and spits the drawing out of a printer.  Additionally it can crawl through a BOM of an open assembly drawing and print all of the relevant drawings.  All seems good here.


      We use Solidworks PDM Profession for data/workflow management and at the beginning of a design cycle the PDM system places a watermark property on the parts and drawings that is just a text string that says "NOT FOR PRODUCTION!".  In our drawings sheet formats there are two overlapping notes that have "$PRPSHEET:"Watermark"", and "$PRP:"Watermark"".  When the part and drawing are released PDM changes the properties in the part and drawing to " " (a space) and then when a user opens the drawing the "NOT FOR PRODUCTION!" watermark note is not visible in the drawings.  We also have the PDM option "Always work with the latest version..." turned on.


      Okay, on to the issue:


      If I work on a drawing and then it gets released by a colleague I can open the drawing and it, in some circumstances, might still have the "NOT FOR PRODUCTION!" text in the drawing.  Although we have "Always work with latest version" turned on, and it gets the latest version of the draft and part file, it is not updating the part properties that are being used in the draft until I actually open the part file and load it into memory (if you can tell me how to fix this issue you will be my new BFF).  This is an okay workaround for a user who notices that a drawing has this text on it, but the print macro that runs based on a BOM might spit out 20 drawings with the text on it because it just doesn't know better.  Originally I thought I would just check the note for text and open the part if I found the watermark note, but unfortunately the note always just contains "$PRPSHEET:"Watermark"".  How can I tell if the "NOT FOR PRODUCTION!" text is present?



        • Re: PDM watermark removal does not play nice with printing macro
          Michael Spens

          Hi Aaron,

          First, the missing model data might be a result of using Detached drawings?  It's not a common technique, but it would be the reason models aren't loaded when you open a drawing.


          In your batch print script, find the call for OpenDoc6 and make sure you're passing the argument to load the model - swOpenDocOptions_LoadModel.


          If you still need to check the note text, you can get the Note interface and use the GetText method.  It will return the text value rather than the link syntax.  Here's an example.  You'd need to code the location of the note into the SelectByID2 method.  Alternatively, you'd need to cycle through all notes on the drawing.


          Dim swApp As SldWorks.SldWorks

          Dim Part As ModelDoc2

          Dim boolstatus As Boolean

          Dim longstatus As Long, longwarnings As Long


          Sub main()


              Set swApp = Application.SldWorks

              Set Part = swApp.ActiveDoc

              boolstatus = Part.Extension.SelectByID2("", "NOTE", 0.376, 0.0757, 0, False, 0, Nothing, 0)

              Dim sm As SelectionMgr

              Set sm = Part.SelectionManager

              Dim myNote As Note

              Set myNote = sm.GetSelectedObject(1)

              Debug.Print myNote.GetText


          End Sub



          • Re: PDM watermark removal does not play nice with printing macro
            Aaron Torberg

                 We're not using Detached Drawings.  I tried using the option - swOpenDocOptions_LoadModel - and that did not make a difference.  I began noticing that different computers opened the drawings with the watermark, or without the watermark consistently so I began investigating the system settings and found that most of us have the setting "Allow auto-update when opening drawings" checked.  With this option checked the watermark does not show up.  Additionally by adding a simple rebuild in my print macro even with this box unchecked the watermark will go away.  I also spent some time with the above code to try and find the string of text and that also worked.  Thanks for the help!