Hi, I'm looking for a way to clean up our vault, by identifying duplicate sldprt or sldasm files.
A few years ago, we were using Pro Engineer as our CAD software. When we switched to Solidworks, all Pro Eng CAD files were batch transformed into SW files for use in Solidworks. However, all the files lost their functions, and even worse, some were only surface files.
Since then, some sldprt files have been completely redesigned on Solidworks, and renamed by adding the suffix "B" to the original name.
I'd now like to be able to export to Excel a list of files with 2 versions (1 Ex Pro Eng version, and 1 Solidworks version), comparing them by name, over the entire PDM vault.
Then, in a second step, apply a red color to obsolete files ( Ex Pro-eng), so that they can be clearly identified when opening a SW assembly.
I'm more than a novice in macro creation, and I haven't found any macro that comes close. I'd like to know if any of you have already created a macro that might be similar to what I'm looking for.
Thank you for your help.
Jérémy
File name comparison macro in vault PDM
Re: File name comparison macro in vault PDM
Use SQL to get the list of files from the database server.
A query like this:
The query searches for all files that end in B.sldprt and then uses the results to search for all files that have the same name but without the B. This could lead to some false positives, depending on how all your files are named. For instance, if you had two SW files (that aren't associated with pro-E files) with the names NOOB.sldprt and NOO.sldprt, this query would consider them to be a match. Without more info on your overall file naming scheme, it would be hard to prevent such false positives.
A query like this:
Code: Select all
SELECT [Filename] FROM [_EPDM].[dbo].[Documents]
WHERE Filename IN (
SELECT
replace([Filename],'B.SLDPRT','.SLDPRT') FROM [_EPDM].[dbo].[Documents]
WHERE Filename LIKE '%B.sldprt%'
)