Retrieve the material name of 10000 pieces and store it in an excel sheet

Good evening everyone 

I'm new on this forum and I have zero experience on VBA Solidworks!!

I want to write a macro that allows me to extract the material name of 10000 pieces and store them in an Excel sheet, so that I have a complete list of all the materials.

For the moment I had the idea of saving the macro by doing the necessary operations to have the list, but what I got didn't work for the remaining 9999 pieces!!  

1 Like

Hello

I hope you're not in too much of a hurry to get the result because you're going to need a program that allows you to:

- Open each Solidworks file.

- Recover the material.

- Store the result in a file.

All this is doable but, to have manipulations of this type, it takes about 10 to 15 seconds per file so for 10000 files I let you do the counting. The processing will surely have to be done in batches of files to limit the risk of Windows and Solidworks saturation and therefore crashes.

I will provide you with a program to do this in the evening. This program will be based on the same principle as that of the post http://www.lynkoa.com/forum/import-export-formats-neutres/automatisation-en-masse-de-la-bounding-box-dimension-hors-tout#answer-743348 with of course the function of recovering the material.

Kind regards

1 Like

Hello

Do you have MyCad utilities?

2 Likes

Hello

So if you don't have the MyCad utilities and your SolidWorks files are not stored in Epdm, you should be able to use the following program. This allows, from a list of SLDPRT files that must be formatted as the liste.csv file attached to the program, to:

- Open each SolidWorks file.

- Calculate the dimensions of external dimensions.

- Pick up the material entered in SolidWorks.

- Save the result in a file named résultat.csv (stored in the same place as the program).

It is best to test on a small amount of 3D file to get started. Given the amount of files to be processed, I advise you to divide the complete list of files to be processed into several lists. Between each processing of a list, the résultat.csv file must be renamed to avoid losing the previous result.

It is best not to use the PC during treatment.

During my test phase, each file took 1 to 2 seconds of processing but this depends on the size of the files and necessarily on the PC.

Of course, if you have the MyCad utilities as remrem asks, it's best to use them.

Kind regards


recup-matiere.zip
2 Likes