Export of 3D(STL) on the basis of existing BOM line on SLDDRW

Hi everyone,

Maybe you can help me, I'm facing a problem for my team.
I want to be able to start from an existing plan to export STLs via a macro, ideally just by selecting the body line in the BOM and then clicking on the macro.

These parts can be mechanical welding parts composed of several bodies that will have to be registered 1 body - 1 file and also .sldprt parts composed of a single body.

I know it's possible, I've already used this kind of macro in the past where you just had to select the bill of materials and launch the macro to have a small visualization window that was displayed and select the parts to export, same for the DXF with the addition of the choice of the face to export.

But here what interests me is just the export of 3D
An important option, going through the plan nomenclature is necessary because in the name of the output file, the nomenclature marker should appear...

Does anyone have that under their belt?

Thank you in advance, and have a good day,

Hello
I don't have this directly in mind (and not sure if this type of macro exists on the forum) but normally by accumulating different macros it doesn't seem very complicated to me.

2 Likes

Hello,

What do you mean when you say accumulate macros?

Thank you

I have different macros (some of which were developed for this forum) that already do the job of exporting bodies with their names. I have a macro that scrutinizes the nomenclatures and other macros that allow you to do actions from a selection.
So, creating a macro if it doesn't exist that matches the request is feasible by grouping the necessary pieces of code.

1 Like

Hello

Would you have a way to share these two macros? Indeed, starting from that could lead to something!

Thank you

Hello
I did a pass again, so I had forgotten that you couldn't get the selected line number directly.
It is therefore necessary to retrieve the complete nomenclature and extract the data in a form allowing you to select the files to be exported.
So I only have the export part with the names of the bodies and the code to retrieve the data from a nomenclature.
It all depends on your level in SW macro but it can already give some of the elements.

Hello

Yes, I'm fine with having the part of code you're talking about :slight_smile:

Thank you for your help

Hello
The code to export the files in STL named with the file name and the body name: ExportPartBodyToSTL.swp (48 KB)

The code for scanning a BOM: ScanBOM.swp (31 KB)

This second code comes from the help of APIs (my code is a bit more complex and extracting part of it was not necessarily easy).
Some lines will be useless in your case, you have to keep only the link to the file linked to the BOM line and then carry out the processing to load it, scan its tree structure using the STL export code. I can still help debug but it will be limited until next Tuesday. Then I won't have access to SW until May 27th.

1 Like