Macro: Changing References in an Assembly

Hi all

I changed the filling of the folder containing all my screws and accessories.
So when I open an assembly, SW looks for the screws in the old folder, and creates opening conflicts with the same elements already open, (which have the same name but in another folder).

I want to do a macro to override the component path of an assembly, so that it can go and get the component in the new folders.

I tried using the "replace component" function, but the problem is that the files in question have the same name! SW doesn't know how to replace a component with another one whose file has the same name (even if it's in a different folder).
Maybe we should see for a macro like "take-away" or something like that.

 

Do you have a way to advise me?

 

Thank you for your help.

 

 

Hello

There's a macro available here:

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

Otherwise, this is also possible with the paid myCADtools utilities.

2 Likes

Hello

What version of SolidWorks do you have?

Because since 2015 it is possible to replace with a file with the same name.

Otherwise I would be you, I would put everything back where it was at the beginning and I will use the SolidWorks Explorer to control the move or ideally as @.PL the MyCad tools offer if you have them.

@+

 

3 Likes

Otherwise another solution (without macro and simpler):

in option/ external references, checked Find file locations for external references

 

Then in the locations of the referenced files/Documents add the new folder path

And now when opening an assembly, if it can't find a part, sw checks that it's not in the folder or folders added in external references.

 

However, this method only works if the file keeps exactly the same name.

 

We recently moved our screws by this process on axemble advice and it works perfectly.

On the other hand, on the 1st opening of a large assembly, it can slow down a bit.

After a registration, no more problems, the new path is saved.

3 Likes

@Sbadenis: this trick is terrible, I didn't know it. I don't move files every day, but I have to keep it for next time:)

Great sbadenis!

You also have to think about adding the subfolders.

That said, it works very well.