Rename files via API

Hello

Sometimes we have a series of files to rename in the EPDM and it's long and tedious to do.
So I thought about making a macro, but the problem is that the references in the assemblies and drawings don't follow.

I use an 'IEdmFile5' on which I apply the 'RenameEx' method, ...

 

Do you have a solution so that my references don't break?
Thank you!

1 Like

Hello

If I understand correctly, you have parts and sets to copy and rename?? If that's it, open the assembly and make a take-away composition like its references will follow and before making the composition you indicate the future name as well as the location so different from the start.

Kind regards

It's not really that,

We use logopress and it creates the parts with "-1" at the end, so yes we do "Right click -> SolidWorks -> Rename", but when you have 60 parts to rename you quickly spend the morning there.

1 Like

Hello

By going to the Rename Method (IEdmFile5) page :

http://help.solidworks.com/2014/English/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmFile5~Rename.html

We see written at the top:

Obsolete. Superseded by IEdmFile6::RenameEx.

So you have to use this method: IEdmFile6::RenameEx

http://help.solidworks.com/2014/English/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmFile6~RenameEx.html

 

1 Like

>> I use an 'IEdmFile5' on which I apply the 'RenameEx' method, ...

 

I was careful about this, I use the 'RenameEx' method.

Yes and as I indicated, you have to use IEdmFile6 instead of IEdmFile5 : the 5 is obsolete!

I noticed that I was using 'IEdmFile8', so it should be playing right?

 

Edit: I also tried with 'IEdmFile6', the result is the same. I lose the reference in the assembly.

See these links:

http://www.hawkridgesys.com/blog/setting-epdm-dispatch-script-rename-solidworks-files/

https://forum.solidworks.com/thread/107453

https://www.razorleaf.com/2009/12/dispatch/

https://forum.solidworks.com/thread/100549

 

Would it be nice to post the macro if people have the same problem:)

Hello

I can't use this rename method. Can you help me please? Please post your code.

 

Kind regards.

 

To have a chance of getting an answer @cleclancher it's better to create your own topic (possibly you slip a link to it).

 

@sbadenis, I've been trying to create a new topic for 2 days and each time I'm blocked by some kind of firewall of the site that says attack blocked. 

I sent a message to the community manager but nothing. How can I do this?

For that I can't help you.

For your topic, while waiting to be able to create it, look at the following topics on EPDM:

https://www.lynkoa.com/forum/g%C3%A9n%C3%A9ralit%C3%A9s/version-du-coffre-fort-pdm-une-macro-excel

https://www.lynkoa.com/forum/import-export-formats-neutres/lien-vba-epdm

For my part, I have not been able to help you better on the subject