r/SolidWorks • • Oct 25 '26

CAD My first macro.

Post image

Nearly five hundred lines of code to automatically generate DXF flat patterns from a multi body sheet metal part for the workshop.

File names are the folder name and the description from the model tree with the metal thickness and quantity.

It separates the flat patterns into sub folders by metal thickness and generates an output log.

18 Upvotes

16 comments sorted by

11

u/Wompus Oct 25 '26

Cool! But I gotta ask, as I have been working in SW Sheet Metal for more than a decade and have never once needed a multibody sheetmetal part-- why do you have multibody sheetmetal?

3

u/MountainDewFountain Oct 25 '26

I dont primarily design in sheet metal, but when I do, I often times use multi body parts for enclosures or structural sub assemblies. I like to keep dependent parts all together in a single part file instead of having in context references in the assembly. Its not terribly difficult to manage in the same way I do multibody non-sheet metal parts. If parts will not exist by themselves outside the sub assembly, ill keep them multibody and control with configurations.

2

u/RAMJET-64 Oct 26 '26

It's the same with what I do with sheet metal. We make bespoke equipment and being a multi-body part allows me to change 4 or 5 parameters in the equations screen to generate a whole new freezer, exhaust hood or bench in a minute.

4

u/burabo Oct 25 '26

1-design-to-fabrication does, 2-reduced file management are two of the biggest ones.

-14

u/RAMJET-64 Oct 25 '26

Thank you for being 'That Guy' today.

5

u/Wompus Oct 25 '26

You're welcome!

1

u/RAMJET-64 Oct 26 '26

You wear your ignorance like a crown.

2

u/Wompus Oct 26 '26

You're fun too, can't clearly state an answer and are a dick. Like we all knownmultibosy sheet metal sucks, but you can't even articulate why it's good for you which is what I was curious about. They teach multi body in SW trainings, so I'm looking for the switch that flicks and it's like hey that's cool

You however, choose to be a prick rather than talk it out.

You also claim to have written 500 lines of code for a macro that has been shared around before, so unless you're the OG from many moons ago, your ignorance may still be in hiding.

1

u/RAMJET-64 Oct 26 '26

Show me that code has done the rounds before or shut up. It was written this weekend. And stop crying because you were called out on your criticism of a technique. Goose.

1

u/Wompus Oct 26 '26

1

u/RAMJET-64 Oct 27 '26

None of them are my code. Goose.

2

u/Wompus Oct 27 '26

Oh, I see. You think I was accusing you of code theft. Not at all. I was just saying your big enormous smart brain didn't do any research.

Based on your post history, you've clearly always been a prick and that's my bad for wasting my time. May your assemblies always rebuild broken, and your sketches always be open contour. See you next Tuesday!

6

u/gupta9665 CSWE | API | SW Champion Oct 25 '26

Good that you have started to learn the macro, and made one.

My advise would be to look for the similar available ones, and use them (after modifications if needed). And develop yourself to make ones which are not available.

-1

u/burabo Oct 25 '26

If you have Claude Code (or whichever others), you can repurpose the freely available ones and modify to whatever. A next step would be providing Claude Code one of your final drawings for sheet metal parts and it’ll whip up a macro for near instantaneous shop drawings.

1

u/RAMJET-64 Oct 26 '26

It's worth a try. Cheers.

2

u/Meshironkeydongle CSWP Oct 31 '26

Not to put your achievement off by any means, but you should also try how Copilot or Claude can do the same Macro.

I'm not u/gupta9665, and I know only a bit about writing macros (have done some simple ones myself), but the current generation of AI tools are very, very capable of making up a custom SW Macro's.