Sunday, September 8, 2013

How To Design Awesome 2D Curvy Things For CNC Machines Using Illustrator and Solidworks


The purpose of this post is to share a technique that has proven to be very useful for designing and optimizing complicated tool paths for use with machines such as the waterjet, laser cutter, vinyl cutter, shopbot, and more importantly CNC mill.

These machines all take *.dxf formats as inputs to cut stock. G-code is the common language that a numerically controlled machine understands. If you've ever written G-code (this practice is less common nowadays due to software tools like Mastercam), you know that G-code essentially only knows how to instruct the machine to move in straight lines and arcs. So generating tool paths for pockets isn't a terrible challenge, but...


what if you want a CNC mill to engrave a pigeon like the one above?


Here is where the unlikely combination of Illustrator and SolidWorks really comes in handy. This technique requires a series of iterations, and it works even better if you're also familiar with Photoshop. If you're an MIT student, you're in luck because MIT just installed a suite of Apple computers in the athena cluster on the 5th floor of the student center (W-20), and they come equipped with Photoshop, Illustrator, and InDesign.

You'll begin by importing your desired image into Illustrator and using the Live Trace feature. This tool works wonders and essentially does most of the work for you. Another way you could experiment with the image before tracing it in Illustrator is with the threshold tool in Photoshop.

In the first iteration, you can play with the tracing options until you have your desired curviness. Below are common starting values for a black and white image. You can see that Illustrator has smoothed out the edges and has changed the radii of the image. If you also know Photoshop, after the first iteration, you can use the magic wand tool, or the smudge tool to further increase the radii and smooth out the drawing. When CNC machining, a large radius is your friend.



Once you are happy with your image, you then have to export it as a *.dxf file to edit in Solidworks, and add mathematical relations as necessary. On the last trace, I typically use the "Strokes" option instead of the "Fills" for a cleaner export. 
This sketch is what the typical export looks like after manipulating the image in Illustrator. You can either set the page size in Illustrator, or scale the figure to the desired size in SolidWorks.

For every dot you see in the drawing, that means the machine that will interpret it will have more steps to complete. A nice tool path will have as few dots, or segments, as possible. For example, instead of small joined splines, try to create an arc that will fit the path. Doing so will not only reduce your machining time, but give you a cleaner cut. This rule of thumb is especially true for tool paths on the waterjet. 

The lab for MIT 2.008 (Design and Manufacturing II) gives us about 12 minutes to machine the paperweight. The total machining time on the mill was about 7 minutes, and about 4 minutes for the lathe. Here is the result:

For my next paperweight (the shop guys are usually nice about letting you do more than one, and if it's a really cool design, you can convince them to help you with more complex tool paths), I wanted to add a bit more intricacy. I thought this decal from Yuri's Night would make a great gift for my younger brother, who had just received his pilot's license, and was going to give the keynote speech at the 56th Annual Goddard Memorial Dinner.


You could import this picture into SolidWorks and trace it with splines and arcs, but this could take hours. If you use a vector graphics program, you could easily generate the drawing file and import it into SolidWorks as a sketch, which you can then modify and dimension to get the desired details. Using the trace feature makes this process fairly simple.

This paperweight is a bit more interesting since it has negative space on the underside, and layers on the face. The total time on the mill for this one was a little under 20 minutes, and about 5 minutes for the lathe.



Combining SolidWorks and Illustrator also works well for rapid prototyping techniques. Here's an idea for a pair of shades from my notebook, for example:


Simply crop the image out, import it into Photoshop, remove the text, then trace it in Illustrator.
The design for this drawing took a few more iterations than the previous designs, since I wanted to keep the hand draw lines to maintain the proportions I drew using my intuition instead of starting with a dimensioned SolidWorks sketch. Here is the first iteration using the Live Trace feature:


You'll notice that the parameters for this drawing are different than the ones I used for the other images. It takes a bit of getting used to the trace tool, but once you get the hang of it the process becomes much faster.
This was my first import into SolidWorks, and it's pretty ugly to work with since the sketch wasn't that great to begin with. I ended up tracing over most of the lines and deleting the squiggles. After mirroring the image and tracing it once more, below is the next iteration in SolidWorks.

While the sketch above still doesn't look too optimized, I could then save the lines as a picture to import into Illustrator, trace the image to get nice smooth lines as shown below:
These lines are much easier to work with, and after importing it into SolidWorks and mirroring a half, here is the result:

These lines could be improved further, but they were good enough for my application, since I only wanted a looks-like model, and I would first be using a laser cutter to make the parts.
Here's the prototype:




What do you think about this process? If you have a better method, I would love to hear about it. I would also love to see any paperweights or other designs that employ the technique outlined above. If it's a really cool design, I could help execute it too!

2 comments:

  1. Sup Saul,

    Nice post. I'm interested in learning a few more basic things about this process. Things like the shopbot and vinyl cutter seem pretty obscure to me. You think you can do a post explaining each of them?

    Also, does this post mean you'll be having more time this semester for side projects, or is this a one time thing?

    ReplyDelete
  2. Mobo!

    I would happily put that up. I actually have drafts for more instructional posts in my notebook, but just haven't found the time to write them up formally.

    I was working on this particular post over the summer a bit because I wanted to have it up before the students in 2.008 this semester started their projects, in case they wanted to reference it.

    Cody and I have started meeting up on the weekends to work on personal projects so hopefully there will be more content soon!

    ReplyDelete