SOLIDWORKS to Easel - Macro to Convert Faces to SVG

I do almost all of my design work in Solidworks, so in order to support my design process and to make it easier to get my designs into Easel, I created a macro to convert faces in a SOLIDWORKS part into useable svg files.

If you would like to use the macro for your own use, please download the attached zip file.

Here is a video showing how the macro works:
https://youtu.be/ihQbTjZVgb8

There are a few issues currently:

  1. Outlines generated by the macro are “on path”. When you import the SVG into easel, you will have to set them to “outside” manually.
  2. Currenlty when an svg is imported the “grayscale” of the shape determines the depth as a fraction of the current material thickness. The rgb values available are from 0 to 255. So the depth “resolution” is your material thickness / 256. If Easel gets updated to support percentages with decimals, i will update the program to achieve greater resolution.

If you have any problems with the program, please let me know and tell me how to replicate the issue.

Cheers and Happy Carving!

V1.03 - Updated 2018-03-13
Face2SVG_V1.03.zip (4.3 MB)

4 Likes

this is awesome as only new to x-carve (just got the machine to home the first time yesterday) but design everything in solidworks

great work and thank you

Glad to hear it. If you run into any issues with it, juet let me know.

I am running a very old version of solidworks so hopefully works but will let you know - looks like it will save a heap of time, thanks for sharing

Maybe, I use some api calls from some of the newer versions of SolidWorks. Of course you could always send the file to someone with a newer version of SolidWorks and have them run the macro for you.

bummer, I got excited too quickly

This is awesome. Thankyou. I cant wait to try it.

never worked with macros, and couldn’t work out how to load it

What version of Solidworks are you using?

old old - 2005 on Parallels on a mac

Haha, yeah, that’s pretty old. I haven’t tested how far back it will go, but my guess is 2015 or 2016 versions.

Hi Ethan im using solidworks 2018 but i ran in to a problem when trying to process the face .
Run -time error ‘91’:
Object variable or With block variable not set
???
Can you help?

Are you running it on a part or an assembly? (Macro only runs on parts right now.) Any chance you could send me a screenshot of your model? Also make sure it’s a planer face that you select, cylindrical faces don’t work.

Yes it is a simple plate with two holes on a planar face!!

Hi Mihai,

That’s not a good sign. I’ve updated the macro to give a bit more information when it errors out. When it shows the error window, click on “debug” and shoot me a screenshot of the highlighted code. I should be able to figure it out from there.

Thanks!

Face2SVG.swp (400.5 KB)

HI Ethan
Thanks for the fast reply!!!


This is the message i get when i press debug!!!

Ok, one more thing. In the debug window, can you click on “Tools” > “Options” > “General” tab. And then under that tab set error trapping to “Break in Class Module”.

Then you can try running the macro again. This will show me the exact line where the program errors out.

My apologies, this is still a new program and i haven’t worked the error catching into it yet.

No problem at least we will figure it out and maybe will be helpful for somebody else!!!

Ok, i think i figured it out. Had to do with the function that converted 3D coordinates to 2D space. I uploaded the new macro and put it in the original post (v1.03). Give that a shot and let me know if it works.

Yep it works!!!
Thanks man.