It has been a cold and wet New Year's Day this year, so I've been staying warm in the cave while working on a few online projects.  For this one, I needed to create an object using .hpgl (Hewlett Packard Graphics Language) plotter file format for use in Front Panel Designer. I will walk through the steps I used to quickly create an engraved/filled object from a raster file.

I wanted to update the look of the side panels on my BMW K100 project bike to improve the bike's lines from front to back.  My first design did not take this into account and creates a "break" along the line of the bike that I do not like.  The new side panels will be the same size and shape as the previous design, so I started from my blank side panel .dxf files previously created using FreeCad (you can download those files from here for the left and right panels). I import the .dxf file into Front Panel Designer, select the material type (anodized Al), and thickness (3mm) which gives me my initial panel substrate.  From there I can use FPD to create through holes, slots, and basic text engraving (using only their supplied fonts).  For the primary graphic however, the supplied fonts were not what I was looking for, so I needed to import my own image.  FPD allows one to import their own graphics for engraving, but the object file must be in .hpgl format (an HP plotter graphics language format).  Creating the file can be a challenge though, especially if one only has access to free software tools.  Since .hpgl is a vector file I figured that Inkscape would be my best bet.  Inkscape is a vector file creation tool, which can open raster files, and can save to .hpgl, as well as many other vector formats. If one only wants to engrave the outline of an image, this tool can be very quick and useful.  In this case, one only has to open the raster file, use the "trace bitmap" function, and save the result as .hpgl.  In my case, however, I wanted to engrave not just the outline, but also the "fill".  In order to instruct the milling/engraving tools to do this, one has to create not just the path of the outline, but also create a series of tool paths in the interior of the graphic to remove the material from the inside of the graphic's lines.  I was able to find a way to do this however, that I think is pretty slick.  

Starting with the initial raster file, in my case a .png graphic, open the file in Inkscape and use the "Trace Bitmap" function under "Path".  A dialog will pop up with multiple options for generating a path from the bitmap.  I select the Single Scan method using "Brightness Cutoff" -- for a single color, changing the cut off Threshold to 0.95 ensures fairly clean lines.  I then "break apart" [Shift][CTRL][k] the image components to be able to scale each piece individually - this may or may not be needed in your case, depending on your image and final target.  At this point, saving this file as .hpgl will result in an outline that can be imported into FPD - one can then select the appropriately sized engraving or milling tool to get the desired outline size.  If, however, you also want to remove the "fill", then additional paths must be created in order to instruct the tool to mill out the inner material.  I started with HPGL engraving instructions provided by Front Panel Express which describe a manner to do this using Corel Draw.  Those instructions should be reviewed here, as the concept is generally the same process, and the table of offset values in their step 6 will be needed for the next steps.  For this process we will take advantage of the format of .hpgl which allows multiple layers to assigned different "pens" - in our case, when we import the file into FPD these "pen-layers" will become definitions for engraving or milling cutters of different sizes.  FPD allows one to assign a tool to each layer in the file.  This is useful as one can assign, for example, a thinner engraving tool for the initial outline, then assign larger milling cutters to remove more material in subsequent passes, reducing the number of passes (and, hence, reduce the tool time and cost of the project).

Okay, so back to the project, since we want to first engrave the outline of our image, we want to start with the smallest engraving tool - in this case, the 0.2mm engraving tool.  If we apply this to the file as-is, we will cut down the middle of the line, so removing material (0.1mm) from each side of the outline.  In many cases this is fine, but note it will enlarge the size of the graphic slightly.  To avoid this, we can offset the outside line by half the tool width, towards the inside of the image.  Inkscape has a useful method to do this under the Path menu, using the Inset function.  Be selecting the path one wants to move inward and hitting the Inset button or [CTRL]-( the path will move by the preset amount.  What is the preset amount and how does one change it?  Good question - for the answer, select Edit->Preferences->Behavior->Steps and you will find the Inset/Outset default setting of 2px.  First, change the units to "mm" then, using the suggested offsets from the FPE instructions (step 6 in the instructions mentioned above), set the appropriate inset value.  Now, here is where the layering comes in handy.  After changing your inset values for a given layer, use the Layer->Duplicate function to generate a new layer, then repeat with another offset value.  Rinse and Repeat this process (Set Inset value, Select Paths to change, Path->Inset to generate a new path, create new layer) until one has enough layers to completely eliminate the fill material from the graphic.  The last trick here is to name each of the layers starting with "Pen 1" for the first layer up to "Pen n" for the last layer - this is needed for the .hpgl file to be generated correctly.

I use the 3mm end milling cutter to remove the most material with each subsequent tool pass, this means using an inset of 1.5mm for each of the layer paths.  Here is Inkscape with the Layers created - these layers must be renamed "Pen 1" through "Pen 18":

 

 

Here is the tool for setting the inset values:

 

Lastly, here is the image imported as HPGL into FPD: