I'm looking for a way, a macro (or someone able to make it for me) to insert parts to an assembly from an excel file that includes (among other things): the name of the part (Column B) and the path (column F).
Concretely, this question follows a previous one I asked a few weeks ago: I have an assembly of a part that makes up the furniture of a boat. I must provide my supplier with a layout file of these parts. The best solution I had been offered to flatten all the parts is to make a new assembly with all the parts constrained according to the face plane. Yes but there are a lot of coins in the four corners of the server.... So I'd like to be able to use a macro that imports all the parts in the file. After that, I'll manage to position them as I want.
The attached program is a bit hasty but works at home (Solidworks 2015, version 4.5.2 of the framework)
You start by unzipping the attached file on your desktop then:
1°) you extract your 2 columns "part name" and "path" from your Excel file to create a csv file formatted like the example named "Liste-3D.csv" (preferably to be encoded in UTF-8).
2°) you name this csv file "Liste-3D.csv" and you put it in the program folder instead of the existing one.
3°) you open a new assembly in Solidworks.
4°) you launch the "Ajout-3D.exe" program.
5°) you click on the "Add components" button.
6°) you wait until the message "Processing completed"
7°) You leave the program.
All that's left to do is position your parts and save your assembly.
Maybe test the program on a limited number of parts (lines in the csv file) to see if it works the way you want.
I just tested the program which has a small bug at the end.
Everything seems to be fine, the list of components appears in the program, but after the message "processing complete", the components have opened but are not inserted into the assembly. That said, once everything is open, I can very easily have it inserted, it lists the open files, I select everything and roll my chicken =)
Small bug good to know, it means that I would have some changes to make on my programs when moving to Solidworks 2016 or more probably 2017 for the next version change.
When I run the program with my "big" assembly, it opens all the parts of the assembly but I quickly reach the limit of open documents that Solidworks knows how to handle.
Do you think it would be possible to solve the problem of inserting the parts in the model?
The problem is that I don't have a SolidWorks 2016 on hand.
On my PC, each part is opened, inserted into the assembly and then closed again so no risk of limiting open documents. Can you tell me how big your parts files are on average?
Can you also check that you don't have several SLDWORKS.exe processes running?
The insertion works perfectly, except that it does not close the component afterwards. I launched the program by separating the list in two, it works well.