CNC Plotter and Software

Inspired by all the cool robot drawing machines that are out there, I wanted one of my own to have fun with.

FoxPlot and Patherator are my CNC plotter, built from scrap 3D printer parts, and art-oriented path-generation Python script, which explores a variety of fun ideas and art concepts.

I built FoxPlot out of scrap parts from my Rostock Max V2 leftover from rebuilding it, as well as parts I designed and 3D printed on my modified Rostock. It utilizes CoreXY kinematics, which allowed me to make the motion platform lighter. The pen holder is capable of holding a variety of pens, either vertically or at a 45-degree angle. The pen is raised and lowered by a mini servo. At the heart of it is the RAMBo 3D printer controller board running a slightly customized Repetier firmware to setup the LCD menus more conveniently for my purposes.

While there are some pieces of software out there that can generate tool-paths for CNC plotters, none of them could really do all that I wanted to be able to do, so I wrote my own - Patherator. There are two main modules that can be invoked from the command-line. Configuration parameters are supplied through a JSON file. They both output in the common G-code format. The code can be found here.

The first module, Trace N Fill, takes an image as an input, traces outlines for the shapes within, and fills in the outlines with one of many fill patterns. You can also pass in a multi-color image, and the Trace N Fill module will segment the different colored portions and apply different options. You can customize the number of outlines to be drawn, the density of the chosen fill pattern, and even generate separate G-code files to make it easy to do multi-color drawings! In the case that a low-resolution image is supplied, the Trace N Fill module does some bilateral filtering to improve the quality of the final image. The final tool-path is optimized with a nearest-neighbor algorithm.

The other module, Artsy, also takes an image as input, but instead of tracing and filling outlines, it converts the image into one of several different computer-generated art styles, which can be seen below. Unlike the Trace N Fill module, the Artsy module is particularly suitable for photographs. All of the different styles involve some amount of pre-processing on the image, such as certain combinations of brightness, contrast, and sharpening enhancements. The amounts of each type of enhancement depend on the style, and this helps tremendously to bring out the details in the images. Where applicable, as in the Trace N Fill module, the final tool-path is nearest-neighbor optimized.

This example from the Trace N Fill module is a multi-color penrose triangle. Each color has a different fill pattern - pink has the Peano-Gosper curve, yellow has the Hilbert curve, and blue has hexagonal fill.

This is a silhouette of a shiba inu (yes, that one) that I made. There are three outline loops, and it is filled in with shapefill, which is an infill pattern that takes an additional image, creates outlines, and tiles the outlines for a custom fill pattern. I used an alpaca art found on Vecteezy.com for the infill.

These two examples show just a few of the different fill patterns built into the Trace N Fill module. There are additional fill patterns, including: lines, grid, triangles, concentric, sunflower spiral, and more.

Depicted here is Keith Haring painting a piece in the Stedelijk Museum in Amsterdam. I used the Artsy module to generate an amplitude-modulated spiral. 

This is a crosshatch style drawing generated from a photograph of my late cat and me.

Consisting of 29,650 dots, this stippling-style drawing of a llama on Machu Pichu was derived from a photograph by Alexandre Buisse, available under a Creative Commons Attribution-ShareAlike license. To emulate the stippling appearance more closely, a small amount of random jitter is applied to each dot location. This way, the dots look a little less machine-made, and more human.

Another interesting style is the Travelling Salesman Problem (TSP) art style. The Artsy module has a simple 2-opt heuristic algorithm to try to find the optimal path. The longer the algorithm is run, the better the path becomes. I let it run for about 15 minutes. This drawing was derived from a photo of Gunpei Yokoi, the inventor of the GameBoy, from the Nintendo Wiki, available under a Creative Commons Attribution-ShareAlike license.

Here is that shiba inu once again, but drawn with a Delaunay triangulation. This style was one of the trickier ones, with a lot of trial and error in honing in the pre-processing on the image.

The Artsy module can also generate halftone-style art. This one is from that photo of my late cat and me. The little shapes are triangles in this example, but other built-in shapes also include circles, squares, stars, and hearts. What is even cooler is that if you supply an image of a custom shape, the art can be generated with that shape!