4 Replies Latest reply on Dec 7, 2017 11:27 AM by Jim Sculley

    Anyone use IEdmfile7::Move ?

    Michael Garvelink

      I am trying to move files around from folder to folder using the IEdmFile7::Move tool.

       

      Has anyone had any success doing this? If yes, would you be willing to share some screens shots or examples?

       

      thanks

        • Re: Anyone use IEdmfile7::Move ?
          Michael Dekoning

          It works. Look at the API documentation for IEdmFile6 Move method and the examples listed.

          • Re: Anyone use IEdmfile7::Move ?
            Jim Sculley

            Michael Garvelink wrote:

             

            I am trying to move files around from folder to folder using the IEdmFile7::Move tool.

             

            Has anyone had any success doing this? If yes, would you be willing to share some screens shots or examples?

             

            thanks

            Yes.  What problem are you having?  Is there an error message?  Can you create a small working example that illustrates your problem?

              • Re: Anyone use IEdmfile7::Move ?
                Michael Garvelink

                Jim,

                After I posted the question, I came across your post here -

                 

                I am running into the same challenges that you describe, have you implemented any solution(s) other than an 'after the fact' fix?

                 

                My goal is to define some rules for new files that are being added to our Vault. One of the guidelines is the filename, but here is the catch, we are using a serial number filename dished out by the PDM server, with the added 'fun' of no duplicate filenames. So I don't know what the filename will be until it is added to PDM, it isn't added until it lands in a directory somewhere... the whole chicken and egg thing I guess.

                 

                My first swing at this went something like,

                • Users saves wherever (typically root directory)
                • The code does a 'Save As' with same filename, different directory (since the second one hasn't been committed yet, this seems to work)
                • Deletes the original

                 

                This process gives me the same sorta error that the IEdmfile6 :: Move does, SolidWorks process has it locked in memory which doesn't allow delete much of anything else.

                 

                My second attempt followed your code almost exactly (just in VB.net), same 'Opportunity for Improvement' was the end result

                 

                I am open to other ideas as to how to get incoming files to land in predetermined folders, if you have any....

                 

                Cheers,

                Mike

                  • Re: Anyone use IEdmfile7::Move ?
                    Jim Sculley

                    Michael Garvelink wrote:

                     

                    Jim,

                    After I posted the question, I came across your post here -

                     

                    I am running into the same challenges that you describe, have you implemented any solution(s) other than an 'after the fact' fix?

                     

                    My goal is to define some rules for new files that are being added to our Vault. One of the guidelines is the filename, but here is the catch, we are using a serial number filename dished out by the PDM server, with the added 'fun' of no duplicate filenames. So I don't know what the filename will be until it is added to PDM, it isn't added until it lands in a directory somewhere... the whole chicken and egg thing I guess.

                     

                     

                    The interaction between SOLIDWORKS and EPDM with respect to file locking is complicated and fraught with difficulties.  The API provides two methods that are supposed to make this possible (CloseAndReopen and ReloadOrReplace), but neither of them works correctly.

                     

                    SOLIDWORKS Crash Using CloseAndReopen in Conjunction with EPDM

                     

                    Limitations of ForceReleaseLocks and ReloadOrReplace

                     

                    The second one is C# specific.

                     

                    Things get even more complicated when you start renaming/moving files and changing data card variables that are tied to SW custom properties.  It is a real challenge to do this to files that are open in SW and then have SW reflect the correct information from the files in the vault.

                     

                    In then end (as is often the case when working with the API) I had to write kludgy workarounds.

                     

                    I have an approach that I have been testing that seems to work.  It allows me to transition a file (from SW itself or from and Explorer window) that is open in SW (either directly or as an assembly/drawing reference) and perform variable update and move/rename operations in a manner such that when it is all finished, the proper files are show in SW with the proper information and with none of the files claiming that they need to be saved.

                     

                    I would post more details, but the server where my source code is stored is being rebuilt and the information isn't currently available.