Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 2:19 pm
by rosenrob
First post! I migrated over here because the new SW forum is unusable.
I'm looking for a macro to save all the parts in a given assembly as step files. I found some stuff on the old SW forum but all the links seem to be gone. Does anyone know of anything?
Thank you!
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 2:21 pm
by matt
Welcome! We seem to have a pretty API savvy group here, so hopefully someone can get you sorted out. Thanks for posting!
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 2:22 pm
by mattpeneguy
Yes, I know @artem posted a link to all his macros and that one is there (also a lot more. Thanks Artem!). Let me do some digging and I'll post a link here.
Re: Macro to save all parts in assembly as step files?
Get the one that's closest to what you need and post back here if you need help. As Matt posted, there are some good programmers here that can help (I'll pitch in, but my advice compared to theirs' is nowhere near as good).
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 2:42 pm
by Frederick_Law
Export the assembly to STEP or X_T and other can import and all the parts.
Usually with correct file name.
Exporting each part will require assemble.
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 2:47 pm
by matt
Remember that if you want to share a macro, one great way to make sure it gains visibility is to use the Upload function in the menu bar at the top of the window. This way all the macros can be in one easy to search location.
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 3:04 pm
by DanPihlaja
mattpeneguy wrote: ↑Thu May 06, 2021 2:22 pm
Yes, I know @artem posted a link to all his macros and that one is there (also a lot more. Thanks Artem!). Let me do some digging and I'll post a link here.
Re: Macro to save all parts in assembly as step files?
Posted: Thu May 06, 2021 6:58 pm
by artem
@rosenrob , you can use this macro: https://www.codestack.net/solidworks-ap ... i-formats/. It is pretty flexible with output folder and file naming (you can use a combination of free text, file name, custom property value etc.) and you can even use this to generate sub-folders. This macro runs on a single file. But you can combine this with free Batch+ for assemblies to run on all (or selected components) in the assembly: https://cadplus.xarial.com/batch/assembly/. Here is a short demo (although the UI there is from a newer, not yet released version), but it will give you an idea:
Re: Macro to save all parts in assembly as step files?
Posted: Fri May 07, 2021 8:09 am
by rosenrob
Damn you guys are quick! Thank you for all the help. I was originally hoping to be able to do this through Solidworks PDM which I have set up to create pdf's when I release an assembly. Turns out you need the pro version to do that with step file, so here I am.
@artem, I'll give that macro a shot this morning. I am pretty new to macros so I may be back with questions.
Re: Macro to save all parts in assembly as step files?
Posted: Fri May 07, 2021 9:06 am
by rosenrob
@artem, it works like a dream.
Thanks for the help everyone. Now time to dive deeper into the rabbit hole of macros.
Re: Macro to save all parts in assembly as step files?
Posted: Tue May 02, 2023 3:31 pm
by jluie85
Hello,
I am using solidworks 2019 With PDM. I have been Testing with multi format export
The macro works really good but I would like it to Name the drawing file with the part revision. Im not sure the input for that. I know solidworks has this for pulling revision from other areas but that does work "($PRPSHEET:{Revision})" I also cant get the macro to stop saving the part as a .PDF
The inputs I have used
OUT_NAME_TEMPLATES = Array("<_FileName_><Revision>.pdf", "<_FileName_><Revision>.x_t")
We also Use PDM data card but I have tried "Dwg Rev"