How to reaname the file in both Solidworks and PDM vault?

I have a PDM add-in that does extensive renaming and moving of files in the PDM vault. The add-in can be triggered from inside SOLIDWORKS or from Explorer.

To do rename, I’m following these steps.

  1. Check out the file
  2. Using Rename Method (IEdmFile5)
  3. Check in back to vault

With explorer, everything is fine by following these steps. But if it’s triggered from Solidworks, Rename is happening but the file is in Solidworks window, still showing the old one.

Please let me know , what went wrong here and also correct me the steps to rename the file.

I believe you should be using IEdmFile6 RenameEx instead of the outdated Rename. You shouldn’t need to check out the files to perform the rename either. See the following thread for more information on why.

If the file is being used by SOLIDWORKS, you may need to remove the system locks on it by calling UnLock Method (IModelDoc2) - 2022 - SOLIDWORKS API Help, renaming your file, relocking it.

2 Likes