1 Reply Latest reply on Jul 30, 2018 4:11 PM by Daen Hendrickson

    Workgroup PDM API: Pushing Refresh to the Add-In Interface

    Patrick Hunter

      I've written a macro for Workgroup PDM which my company uses.

      The macro is fairly simple, and it works fine.


      The context is this: if you have a document open, you run the macro and it will find the PDM pointer to that document and grant you ownership if nobody has ownership.


      Here's the issue: When I take ownership via the macro, I can't get my local application instance of Solidworks to realize that now I have write access to the active document. In the add-in that shows my fault, I have access no problem. I've tried refreshing the vault connection in the macro, and refreshing vault connection via the add-in button, I've reloaded and verified the model, but aside from purging the document from memory and then re-opening the file I don't know how to get the application itself to notice that now I have write access; I'm hoping there is a way to do this without the purge. I see a CloseandReopen method for drawings, and a ForceReleaseLocks which looks like it is overkill and maybe dangerous to use in this scenario; I want to basically push SW to re-check with PDM for write-access to the active document.


      I've also noticed strange behavior from PDMWConnection interface. I Dim the container variable for the PDMWConnection instance without the "New" modifier and it seems to give me access to the vault without having to call a Login command. I'm assuming it's tapping into the connection established by my running PDMWorks Add-in. But A) sometimes it has "unknown network connection error" so it doesn't seem to reliably "latch" to the add-in's connection to PDM and B) I run Refresh calls after all changes made to the vault, but my add-in interface never refreshes without me hitting the button. So sometimes I can make changes to the vault with my Login command lines commented out (sometimes I can't), so I'm thinking it's hooking on the existing connection from the add-in, but my Refresh calls on that connection don't refresh my add-in tree view; I can't see the changes to ownership of a document without hitting the button on the add-in.


      Any thoughts or comments on these issues?


      Many thanks in advance!

        • Re: Workgroup PDM API: Pushing Refresh to the Add-In Interface
          Daen Hendrickson

          I am "bumping" this since I am seeing the same issue.



          I have a macro that updates a drawing and then needs to check in the update to our PDM Workgroup vault. After taking ownership I attempt to save the local version. The save3 method returns and error of 3 - which I believe translates to 1+2 (general save error + read only error). Stopping the macro and refreshing the vault view shows I have acquired ownership. Rebuilding the local copy maintains its "read only" status.


          Is there a method to get the local copy to recognize I have taken ownership?