These macro’s save a PDF, DXF or AI version of a drawing or STL of a model with the name of the model, in the model folder. Saves tons of time making packages of technical drawings. One-click file-saving! Can be easily changed to save other formats (STEP, IGES, …)
Warning: automatically overwrites existing files!
Download the ZIP package! (33k)
Chrome users: this download link is blocked – copy the link address and paste it manually in the address bar. Then select “Keep” on the “Insecure download blocked”-popup. If you’re curious: you can inspect the source code before using or installing to see they don’t do anything malicious.
Update 1-2-2016: Since I’m still getting a ton of traffic on this post; I recently tested them with SolidWorks 2016 and they work perfectly.
Update 27-10-2024: more than 10 years and still going strong. Tested with SW 2021 and 2024.
BTW: If you want to make other macro’s for different file types: just open the macro, edit the extension at the end of the macro (“stl”) and SolidWorks will do the rest. Also changing the output folder to a fixed ‘export’ folder (not relative to the file) is easy – change the folder to a fixed path.
Like this? You might be interested in my latest project. It's a desk light made completely from a single sheet of printed circuit board. Check it out:
Does your macro run on win 64bit?
Not sure, but probably, yeah. I’m on 2008, so no 64bit back then (I think). Let me know if it does 🙂
Hi, i have checked stl and pdf on 64-bit system (SWX2014) – it runs good… 😀
nice macro – thanx
Hi,
Thanks for sharing these macros. I’m new to using macros and these are working great for me.
Well I’d like to know that How can I use one of these Macros (say PDF) in Solidworks Task Scheduler to automatically save all the drawing files located in a folder to PDF files in the same folder.
Your help is appreciated.
Many thanks in advance!
Best Regards
Ashish Sharma
Hi Ashish,
Good idea. However, I didn’t even know SW had a task scheduler 😀
I’d guess you could feed this macro into the scheduler, but if I remember correctly it only saves a PDF of the currently opened and active file so you might have some trouble with that.
Best regards, Gregor
Can you test this macro on new solidworks?
worked on 2019, which is the latest I have installed
Hi,
Thank you for sharing these macros.
I was having trouble with the one I wrote crashing solidworks when I used it.
Makes everything a lot easier
Hey,
thanks for the macros.
-is it possible to make the .stl macro where i can choose the folder where i can save my file?
-the dxf macro is very nice but it only works on drawing file. can you also make it for a sketch file? i need it for sheet-exhaus transaction
nice greetz from germany
Hi Patrick,
1) Do you want to choose a different path every time? If you want them always in the same folder you can edit the macro quite easily. If you want a pop-up to choose a location then I wouldn’t know how to do that 🙂
2) What do you mean with “sketch file”? A blank SW file with only a sketch?
Hi Patrick,
I would like to save the pdf to a specific folder (always the same) where we put all our pdf. How can I do that.
I was going to reply “Like this!” and then I saw SW returns the full file path in stead of just the filename. This makes it a lot harder to refactor the code. This might help you: http://help.solidworks.com/2016/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.idocumentspecification~filename.html
If I ever need this too I might dive into it and post it here 😉
I just tried this on SW 2021, worked just fine. Thanks so much Gregor!
Yep, still going strong! 🙂
Hello Gregor!
Nice scripts you have here, thank you for that!
But I cant get the DXF macro to work, it just dont save any file?
The STL macro works and PDF too.
Also, is it possible to save only the current faces?
Regards / Johan.
Hi Johan,
Thanks. Which version of SW are you using? I’m (stuck) on 2021. The DXF macro was meant to be used on drawings, not parts btw.
‘Current faces’ might be possible: this macro reuses the last used settings when you manually ‘Saved as’ a file. So if you select ‘current faces’ in the ‘Save’ options dialog, this might work. Hope this helps.
-G