3 Replies Latest reply on Feb 17, 2017 10:17 AM by Jim Sculley

    Limitations of ForceReleaseLocks and ReloadOrReplace

    Jim Sculley

      I have come across what seems to be an undocumented limitation of this pair of API calls.  What I want to do is rename a part file while that file is open in SOLIDWORKS.  Seems simple enough.  Just call ForceReleaseLocks(), rename the file and then call ReloadOrReplace() with the new file name.  But it doesn't work.  The call to ForceReleaseLocks() does its job.  Without it you cannot rename the file from outside SOLIDWORKS (say via Windows Explorer), but after calling it, you can rename the file.  However, when you call ReloadOrReplace() with the new file path, it fails with error code 10  (swFileInvalidOrSameNameError) every time.  If I use a different file, instead of renaming the original, the call to ReloadOrReplace() is successful.

       

      Has anyone bumped into this limitation and if so, how did you get around it?  Copying the original and renaming it isn't going to work here because I eventually want all this to happen inside an EPDM vault and the file references and data card values need to remain intact.