Introduction: Optimizing Drawings for FlowJet - I Made It at TechShop!

One of the most powerful tools at TechShop is the WaterJet cutter. For those who are not familiar with this tool, it works by shooting a jet of water through a very small orifice at about 50,000 pounds of pressure. Added to this high speed jet of water is a fine garnet abrasive that allows this tool to cut through many different kinds of materials. The WaterJet at TechShop has been demonstrated to cut through 2.5 inches of steel, and is commonly used by TechShop members to cut through aluminum, glass, stone, and even wood. Unfortunately, the WaterJet is also the most expensive tool at TechShop to operate, currently costing members $3.00 per minute. In fact, I think that the WaterJet is the only tool at TechShop that members are charged to use above their membership fee.

When I took the FlowJet course, I used a test graphic that I had also used in other courses that I had taken, in this case a heart shaped graphic with my girlfriend and my name in it. When taking the WaterJet course, I was disturbed when this small graphic took 14 minutes and 36 seconds to cut through 0.18 inch thick aluminum. If I had chosen to cut this small graphic outside the course, the cutting time for this piece would have cost me $43.80! Not only was this expensive, but the quality of the output was not very good; the lettering in the font was badly distorted, and the smooth curve of the heart shape had been converted into angular straight lines.

Since taking the course, I have spent the next two weeks of evenings at TechShop working to understand why my graphic had not cut very well, and trying to reduce the cutting time on the WaterJet for everyone who will use that machine into the future. The result of my work is this Instructable, which both improves the quality of the output on the WaterJet for most designs that incorporate curves, and may reduce the cut time by as much as 16%, as compared to the method taught in the course. These gains in both quality and speed are made possible by optimizing the data input into FlowCut, the proprietary software used by the TechShop WaterJet cutter.

Step 1: Following the Instructions Provided

To begin, I wanted to understand the mistakes I had made that had caused my original data file to cut so slowly. According to Gabe, one of TechShop's highly experienced Dream Consultants (DCs), my design should have taken about 4 minutes 30 seconds to cut. I wanted to know why it actually took 14 minutes and 36 seconds to cut.

The manual for the WaterJet course had a multi-step procedure for converting my Adobe Illustrator file into a format that could be read by FlowPath, the path generation tool used by FlowCut.

  1. Not in the manual, but as recommended by one of the DCs, my first step was to use the Illustrator "Trace Outline" command to convert the fonts I had used into graphics.
  2. In Illustrator, the next step was to set the output units to Inches instead of Pixels. Oddly, this does not change the units displayed in the Illustrator interface.
  3. The final step in Illustrator was to save my CS6 file into an Illustrator 3 format. For my simple graphic no details were lost in the conversion to this old file type.
  4. Then I opened this Illustrator 3 format graphic in Corel Draw where it was exported in the DXF file type.
  5. As stated in the course manual, I saved my file from Corel Draw in DXF version "AutoCAD R10".
  6. Finally, I opened this DXF file produced by Corel Draw in FlowPath to set the cutting speed, create the, in-paths, out-paths, and sequence of pierces needed for FlowCut.

The first time I used the WaterJet, I made errors in steps three and five of the above sequence. From Illustrator CS6, I had saved my graphic in the Illustrator CS2 file format, inexplicably because this was the version I had at home. I had no basis to assume that CS2 would result in a better output. This mistake didn't cause a significant problem because Corel Draw was still able to open it, although I am not sure what inconsistencies this created in the file. But the major mistake that I made was that my export from Corel was compatible with AutoCAD 2013, not AutoCAD R10 as suggested. Although this later version of DXF can be opened by FlowPath, the resulting output curves that are drawn in this format provide highly inefficient output for FlowCut. As stated above, this mistake made cutting time take three times longer than expected.

When instead I saved from Illustrator as version 3, and exported from Corel to an AutoCAD R 10 DXF format, FlowPath generated a much more efficient cut path, and the cut time estimated by FlowCut went down to about the 6 minutes 11 seconds, longer than estimated by the DC, but less than half the time of my first attempt. In FlowPath please note the faceted top curves of the heart and the missing stroke of the lower case "t".

This 6 minutes 11 seconds became the cut time I was trying to beat. Also, if possible, I was trying to smooth out the angles on my curves.

Step 2: PoTrace, the Best DXF Export Tool I Have Found

This page can be skipped by the impatient.

Here I will leave out the pages it would take me to write how the very smart TechShop DC named Alex and I came to understand the limitations of FlowPath's proprietary file format, and how we eventually understood what was needed to create a better input data file. Here I will just jump directly to our findings.

Finding 1: The slow cut speed of my first WaterJet attempt was caused by FlowPath interpreting the Bezier curves and the font in my design as a large number of short lines, each of which required ramp-up time and ramp-down time.

Finding 2: FlowPath is only optimized for straight lines and circles. Any other path must be simplified into permutations of these two primitives.

Finding 3: The latest version of the DXF file format is highly complex, requiring over 6,000 lines of header needed for only a single graphical line. Our tests have shown that the current complexity of this format is not effectively interpreted by FlowPath.

Based on these findings, my goal became finding a way to interpret Bezier curves as a series of circular arcs instead of straight lines. Ideally, these arcs were to be as long as possible so as to maximize the cutting speed of the WaterJet. Finally, the output file format was to be in an old enough version of DXF that FlowPath could interpret it efficiently.

It took days of searching, but I eventually found a graphical conversion utility that would output complex curves as a series of circular arcs instead of as straight lines. The utility that I found is called PoTrace, software written by Peter Selinger, that converts raster images directly to the DXF file format with complex curves "approximated by piecewise circular arcs."

In the attached image, the lines of documentation that describe this useful functionality of PoTrace are highlighted.

Unfortunately, PoTrace is a command line utility, which only imports Windows files in the BMP file format. Being a command line utility, it requires an arcane string of parameters as input. Learning these command line switches takes more time to learn how to operate than would a tool with a Windows interface; however, the quality of the output justifies this time spent. Using PoTrace has produced more beautiful output curves and shorter cut times than the file conversions done with Corel Draw. To make this process easier to use, Alex and I have talked about creating a batch file to automate this file conversion process.

Step 3: Preparing Your Input File

Since PoTrace traces the edges of an image, it is important that the image be in black and white and that it be clear where the edges of the image are.

In this example, I have created this image in Adobe Illustrator, although almost any graphical program will work. For this particular graphic, I needed to invert the black and white areas of the image so that the part that I wanted to keep was in black and the part to be cut away was in white. I also needed to create a white boarder on my graphic so that PoTrace would add an outside line on the output image.

Finally, I used the Illustrator Export command to save my graphic in the BMP file format. It is critical that you know the output resolution. The reason that it is essential to know the resolution of the images is that when the BMP file is traced, PoTrace converts pixels to inches and so it is necessary to add the conversion parameter to scale your image down from inches back to pixels.

In this example, I have chosen export my image at 72 pixels per inch. It is my recommendation not to output at a much higher resolution than this.

After having done more than sixty tests to evaluate resolution alone, I have found that the DXF files produced by PoTrace using higher resolution input images often resulted in Auto-Trace errors in FlowTrace. The most common error is that the cut path is traced outside of the shape of text characters, cutting inside of the letters. As shown, a 300 pixel per inch image resulted in a DXF that caused FlowTrace to incorrectly identify the inside of the "l", "h", and "l". More importantly, using a higher than 72 pixel per inch resolution input image produced no improvement in trace quality.

One guess as to the reason for these DXF output errors is that PoTrace is optimized for low resolution images, and that larger images produce internal rounding errors. I may contact PoTrace's developer and ask him if there is a fix for this problem.

One other point about BMP files. Although PoTrace will only interpret black and white images, it still works far better if these black and white images are provided using 32 bit RGB BMP files instead of 2 bit BMP files. It is unclear to me why this is unless PoTrace is able to interpret grey-scale anti-aliasing. Further tests could be done to determine if grey-scale images would process better or worse than RGB images, but that testing is outside the scope of this project. Later tests were done with anti-aliased images, which appeared to produce better results.

Finally, one note regarding my design: the actual image that I used to WaterJet required editing in Illustrator so that the center of the "a", "&", and "P" were supported when the piece was complete. Depending on your design you may need to create similar bridging.

Step 4: Creating an MS Windows Screen Capture

Since the input file format used by PoTrace is BMP, almost any Windows graphical program can create it. Because the input to PoTrace is a raster image, it does not require the use of a vector based editor like Adobe Illustrator or AutoCAD. However, even if a program does not output to the BMP file format, any image that can be displayed on a Windows screen can be captured and used as input for PoTrace.

An easy way to create a screen capture on any Windows machine is to hold the Alt key while pressing the Print Screen key. This key combination will Copy an image of the active window to the Windows clipboard. Then, one can open MS Paint and Paste (Control+V) this image to view it.

In MS Paint, one can then use the Crop command to select just the graphical part of the image, cropping out the toolbars and windows frame of the application where the image was viewed.

One important part of using PoTrace is knowing the resolution of your image -- that is, the number of pixels per inch of your image. Fortunately, MS Paint provides a pretty good way to estimate this resolution.

In MS Paint, use the Select tool to drag a selection box around your image. In the lower tool bar of Paint the size of your selection is displayed in pixels. If you know the dimensions in inches that you would like your graphic to output to the WaterJet, it is a simple matter to calculate the pixel resolution of your image.

In the attached example, the size of the selection box is 861px x 649px. Since the size of the artwork was created as, and intended to be output as, 6 inches wide by 4.5 inches tall, one can divide 861 pixels by 6 inches and calculate that the resolution of this graphic is about 143 pixels per inch. If you are using this MS Paint screen capture method, calculate this value for your image because you will need it two steps from now.

Finally, save your image in the BMP file format.

There are also other screen capture tools you can use, but whatever method you choose it is important to know how many pixels your image is per inch.

Step 5: Preparing PoTrace

Since PoTrace is Open Source, it can be freely distributed. What I have done is attach the entire PoTrace program to this Instructable to download for your use, a total of only 170 kilobytes.

I recommend creating a PoTrace directory at your C:\> root level, as this will make it easier to navigate from the command line. Once this directory is created, copy the PoTrace.zip file you have downloaded to this new directory and un-zip the files. In Windows 7 and later, you can extract ZIP files without additional software installed.

As shown, right-click the PoTrace.ZIP file and from the dropdown menu select Open with Windows Explorer. This will show the files in the archive in a new window. Clicking the Extract Files button will then open a new dialog window to prompt where you wish to save the files. Use the Browse button navigate to the C:\PoTrace directory that you created and click the Extract button. PoTrace is an executable file and there is no Windows setup file and no further installation is needed.

To make later command line processing easier, I recommend that you copy the BMP image you will trace into your PoTrace directory.

Finally, with the PoTrace files extracted, you can then open a Command Prompt from the Accessory directory as shown. Using the commands shown, at this Command Prompt you can navigate to the PoTrace directory that you have created. Using PoTrace in its own directory will make it easier to convert your images from the command prompt.

Step 6: Operating PoTrace

There are several pages of command line switches for PoTrace in its documentation, but there are only three switches that you will need for this conversion. From the command line type:

potrace -b dxf -O 0.4 -x 0.0069 YourFile.BMP

The -b dxf switch tells PoTrace to output to the DXF file format. The default output format of PoTrace is not DXF but EPS.

The -O 0.4 switch tells PoTrace to loosen its trace precision. By default, PoTrace creates a very tight curve fit with the input file. The default PoTrace -O setting is 0.2. (Note this switch is a capital letter O, not the number zero.) The result of using this default tight curve fit is that PoTrace creates a large number of short curved arcs. Experimentally, these short curve arcs do improve curve quality, but it is up to the individual to determine if the increased cut time is worth the cost for your particular project. Compromises can be made in this setting for the specific design between curve fit and speed. What is important to note is that these options are only available using PoTrace and not using Illustrator, Corel Draw,, or AutoCAD.

The -x 0.0069 switch tells PoTrace to scale the output image to the correct resolution. For some reason, PoTrace interprets pixels as inches. This means that if you have a 2 inch graphic at 300 DPI, and you do not use this PoTrace switch, the output scale of your DXF output will be 600 inches, or 50 feet in size! Using this scaling factor returns your image to its correct size. The numeric value after the -x is calculated as 1/(YourFile resolution). If your file is 72 DPI this value will be 1/72 or 0.01389. If your file is 150 DPI this value will be 1/150 or 0.00667. If your file is 300 DPI this value will be 1/300 or 0.00333. In our example from MS Paint, the screen capture resolution was 143 pixels per inch, and so this parameter is 1/143 = 0.0069.

The file conversion using PoTrace is very fast and the output DXF will be saved in your PoTrace directory. Using PoTrace eliminates the need to open your Illustrator files in Corel Draw, as is suggested in the TechShop WaterJet class notes.

The command for using PoTrace is also shown in the attached image using a larger -O value. The "dir" command demonstrated in the graphic lists the files in the current directory. This directory listing for PoTrace shows the "potrace.exe" executable file, the "Caitlin_and_Phil.bmp" input file, and the "Caitlin_and_Phil.dxf" output file. It is this DXF output file that will be opened in FlowPath in following steps.

Step 7: A Final Note About PoTrace

This page can also be skipped by the impatient.

It is a reasonable question to ask, if PoTrace is so good, why has no one written an interface for it?

The shortest answer is, they have.

One interface is called PoTraceGUI and unfortunately it is only distributed as source code for Linux, a form that programmers can use for another operating system, not as an executable program for Windows.

http://potracegui.sourceforge.net/

A second interface for CR8Tracer. CR8Tracer does provide a graphical interface to access to the command line options curves and lines but does not output to the DXF file format. CR8Tracer is primarily for creating characters that can be used as fonts, or as output in the SVG file format.

http://www.cr8software.net/tracer.html

A third interface for PoTrace is as part of a larger program called Inkscape, a graphical application installed on TechShop Computers. Unfortunately the Inkscape interface for PoTrace suppresses any curved line output and only exports DXF as straight line segments, thereby defeating the purpose of this research.

http://www.inkscape.org/en/

In fact there are other solutions as well, but none that I have found provide the command line functionality of PoTrace from tracing a raster image to DXF output, using a Windows interface.

http://potrace.sourceforge.net/index.html#other

I will continue to explore other interface options for PoTrace, but until a better solution is found, the best output I have gotten is using PoTrace from the command line.

Step 8: Opening Your DXF in FlowPath

There are many features to FlowPath, but its basic use is simple. Here are a few useful commands to know:

      • You can Zoom in or out of your image using the scroll wheel on your mouse.
      • The tool to Move your graphic is the fourth up from the bottom on the right edge of the screen.
      • The Pan tool is just to the right of the "?" on the top tool bar.
      • The Lead-in / Lead-out dialog is opened using the third icon down just below the Printer icon at the top left of the screen.
      • The tool to select your graphic is the left most Yellow Arrow located at the top middle of the interface.
      • The AP button is to the right of the image on the left hand tool bar.
      • The Cut Speed selector is located at the lower right, then select your cut speed from the lower left tool bar.
      • Both setting Cut Speed and using AutoPath require that you select the entire image using the Yellow Arrow at the top center of the screen.
      • It may also be useful to know that the squares on the grid are 2 inches by 2 inches.

      FlowPath basic use is:

      1. From the File menu Open your DXF input file. FlowPath will also open Illustrator 8.0 files, but the quality of the results are not consistent. If you try to open other versions of Illustrator files, this will crash FlowPath.
      2. Move your file onto the grid and away from the edges. A DXF file will often open in FlowPath off the grid.
      3. Set your Lead-in / Lead-out. An Arc Lead-in / Lead-out will work well for most cases, not leaving a burr that will need to be ground off later. Note that the scale of the default arc may be too large for some graphics, For my graphic, I needed to reduce the Lead-in and Lead-out radius from 0.100 inch to 0.0500 inch, half of its default setting.
      4. Select your cut speed. Using the Arrow tool, either individually click on each line segment of your graphic or drag a window around it. With your graphic selected, choose your cut speed from the lower left menu. For this light aluminum the Blue 60 percent cut speed worked well, although it would cut faster with the Light Blue 40 percent cut speed. For softer and thinner materials, a faster cut speed will cost less, and for harder and thicker materials a slower cut speed will be needed. The dotted blue path in the attached image is just a trace line and will not cut.
      5. Use AutoPath to create cut path for your image. The image does not stay selected after the cut speed is set, so your image will need to be selected again for AutoPath. With your image again selected, click the AP button on the right hand menu. The longer red arrows created by AutoPath represent the speed at which cutting takes place. Longer arrows represent a faster cutting speed and smaller arrows represent a slower cutting speed.
      6. Export your path using the Export Path selection from the File menu. The output file extension is ORD, a proprietary output format for FlowPath. You will open this ORD file in FlowCut in the next step.

      FlowPath is deep and rich enough that simple images could be created directly in this tool, although better tools exist for specific purposes. FlowPath also provides tools to correct path errors, to compose multiple images, and if necessary to manually select path Lead-ins and Lead-outs.

      Step 9: Tests for Improved Cut Quality and Speed

      This page too can be skipped by the impatient. :-)

      As mentioned earlier, many tests were done to determine the best command line setting for PoTrace to produce the best quality output and the shortest cut time.

      The result is that PoTrace can be shown to improve cut quality and reduce cut time for graphics that use extensive curves. Predictably, PoTrace produced no speed improvements for graphics which contained only straight paths.

      For this project, the baseline graphic was produced using the instructions given in the TechShop WaterJet course. The DXF file produced following the course instructions took 6 minutes and 11 seconds to cut and as discussed earlier had curves that were interpreted as a series of angles and lost narrower features of text in the file conversion process.

      PoTrace's DXF output files show an improved quality of output file, matching curves better than the Illustrator-Corel, FlowPath method recommended in the WaterJet course packet while not losing image features. Using PoTrace also produced a lower cut time than the graphic produced following the course instructions. For this particular graphic which was composed almost mostly of curves the DXF file produced using PoTrace took only 5 minutes and 12 seconds to cut. For this small project that is a time savings of 15.9%. If this small part needed to be cut many times this time saving would be significant.

      It is also useful to note that there is very little time savings as a result of loosening PoTrace's curve fit. The attached images show how little the cut speed is affected by changes in PoTrace setting. Apparently the ramp-down and ramp-up speed calculations of the WaterJet are more influenced by the angle between line segments than they are by the segment length. Even though PoTrace's segment lengths can be as short, if not shorter, than the tangential lines produced by Corel, since they do not produce corners, they do not slow down the cut speed. The default curve fit parameter of PoTrace is -O 0.2. A PoTrace parameter of -O 0.6 reduces cut time by about 2%, but at the expense of curve fit. Looser curve fits further degrade graphic curve matching and do not save significant time. For most WaterJet projects, a PoTrace parmeter of about -O 0.4 should be about right.

      Step 10: Conclusion

      There are two reasons why one would choose to use this PoTrace method above other solutions: reduced cut time and improved path quality.

      Through testing, using PoTrace to generate DXF files for FlowPath has reduced cut time by as much as 20%. As discussed earlier, using PoTrace is only an optimization for curves. If a design consisted of only straight lines, it is unlikely that using PoTrace would result in any time saving, although this has not been tested here.

      For improved quality, there are two important criteria to be met: first that curves are created more smoothly than the angled output produced by Corel Draw, and second that fewer if any path segments are lost. As to the first criteria, extensive testing has shown that approximation of complex curves by piecewise circular arcs produces a better curve fit than approximation of the same curves by straight lines. For the second criteria, testing has shown that PoTraces loses fewer line segments than does Corel Draw. It is clear at some complexity of design that any solution will lose some cut detail, but PoTrace appears to lose less detail then Corel.

      Although I have attempted to be through, there is no way that the limited tests that I have done could equal the many people who I hope will come after me and the many tests that they could do. Because my testing is necessarily limited, it is my recommendation than anyone who uses my work verify my results for their own projects.

      It is my recommendation that anyone bringing their designs into FlowPath first convert them using Corel Draw as described and then also convert their designs using PoTrace as suggested here. Only through comparing the two results can one be assured that PoTrace will produce either faster cut times or higher quality output.

      In time it is my hope that the technology of PoTrace will be integrated directly into major graphical Windows applications to avoid the need to go though these additional steps. Further, I might even hope that these instructions prompt this to happen. If those reading this know developers at Adobe, Corel, or even Inkscape, please forward them the link to this Instructable.

      In conclusion, the final set of images above shows my graphic brought from its design stage in Adobe Illustrator through its output in FlowCut. The resulting solution shows good curve matching and a reduced cut time of 14.0%

      The PoTrace input parameters for this conversion were: potrace -b dxf -O 0.4 -x 0.01389 FileName.BMP

      The tests for this evaluation were for cutting 0.18 inch thick aluminum in a common 3003 alloy, although accuracy and speed should be independent of material cut.

      Finally, I hope that this Instructable will benefit the TechShop community as well as the larger maker community.

      Please post if you have any questions and I will do my best to answer.

      Regards, Phil Garrow

      Comments

      author
      PaulP210 (author)2016-08-29

      For fonts themselves I have found I get a much simpler path and really a cleaner cut by doing the lettering from within the Flowpath software itself. Just watch your lead ins-and outs...

      author
      Darrell_H (author)2016-08-14

      I ran across this description of circle arcs vs ellipses in cutting holes for sinks in counter tops. In this case, the difference between a true ellipse and a 4-part circle arc path will result in a slightly different cutout that can result in a significant/noticeable sink fit error. I found the referenced graphic useful for understanding how these circle-arcs can be pieced together to approximate non-circular objects.

      See the discussion in tip #5 at http://www.lambentdesert.com/tips.html

      The graphical example discussed above is at:

      https://upload.wikimedia.org/wikipedia/commons/b/b...

      The red path at the bottom is an actual ellipse, while the blue path is composed of the 4 circle arcs merged together. The black and white portion shows the 4 overlapping circles, and how the 4 circular segments (bottom of the top circle, outer sides of the two middle circles, and top of lowest circle) outline the dark area that only approximates the ellipse.

      author
      stechi (author)2014-08-15

      Great work, I hope somebody at Inkscape takes this up.

      author
      livichris (author)2014-08-02

      Man, I wish we had TechShop here in the UK.

      author
      stechi (author)livichris2014-08-15

      Livichris, do a search for fab lab UK. You will find there are quite a few springing up.

      author
      seamster (author)2014-08-14

      Nice project, thanks for sharing!