Free HPGL Drawing in Inkscape

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

skrasms

Well-known member
Joined
Jun 16, 2004
Messages
72
Location
Gary/Purdue-Lafayette
This might be useful for those of us wanting to use graphics in Front Panel Designer without buying any other software.

I've been looking for something free and simple for making HPGL files for a while now, and I just found out today that the next version of Inkscape (0.47) supports HPGL export.

I tested out a recent un-supported build and the functionality is there. The results are pretty blocky (and mirrored for some reason), but at least it's a start. I'll get a couple screen shots of original Inkscape drawing vs. Front Panel Designer HPGL import if anyone is interested.
 
I went ahead and made a comparison picture. The left is inside Inkscape before export, and the right is the graphic after it has been loaded into Front Panel Designer.

It looks like there is no true arc support yet, just line approximations. Hopefully that will change.

spiral.PNG
 
I was under the impression that HPGL IS line approximations - in order to run a pen-plotter the simplest possible way.

What you do is select number-of-lines at a magnitude that is enough for your purpose..

Jakob E.
 
Most software titles come with an option to select how many segments a drawing is made up of. I imagine there is a setting somewhere that cleans that line up...
 
[quote author="gyraf"]I was under the impression that HPGL IS line approximations - in order to run a pen-plotter the simplest possible way.

What you do is select number-of-lines at a magnitude that is enough for your purpose..

Jakob E.[/quote]

The HPGL and HPGL/2 formats both contain circle and arc commands, but I guess it is common practice to ignore those and only use line segments.

I can't find any control to set the number of segments in Inkscape, but it's still in beta so that is bound to change.
 
Funny, I've been working a lot with Illustrator and an etching plant to make front panels for myself, and it turns out it's even worth it to compete with Schaeffer a little...what I have is this possibility: You can design any front panel in vector graphics, and I can get a combination of etching and lasering going on so that you can basically have anything etched 0,5-1mm deep in 3mm steel; text and graphics. The holes then get lasered, using a dxf as input material (meaning you can make the crookedest weirdest holes and they'll still work).

So you can design anything that you can dream, as long as you get your measurements right.

Would this be interesting for you guys?
 
[quote author="livingnote"]Would this be interesting for you guys?[/quote]
Absolutely. It depends on the price, of course, but being able to work with steel is already a major plus compared to Schaeffer/FPE.

Keep us posted,

JDB.
 
Well, price wise it would probably be around 90 Eur for the initial frontplate and every plate thereafter around 60. These are unconfirmed prices for a 1 HU, but me being a friend of experimentation (and being around the factory for the next 3 weeks) I want to offer this:

The first 3 who get in touch with me (lukas at monstermacher dot de) and can see themselves getting a design together until Friday, Aug 22:

Get theirs free! That way you can give me feedback on how you like it, and I can find out if this is worth the Kahuna :). All you pay for is postage.

How does that sound?
 
Do you have access to a Linux box and a whole heapload of patience? There is a free command-line program that you can use called pstoedit:

http://www.pstoedit.net/pstoedit

Save the output of your Inkscape drawing as a .PS file and run it through pstoedit like so:

Code:
pstoedit -f plot-hpgl drawing.ps out.plt

Then import the out.plt into FPE. I tried it with FPE 3.5 and it looks pretty smooth even when zoomed in. There is a Windows port of pstoedit, but I didn't have much luck with it. If you've only got a few files you need converted, PM me and I'll run them through the cleaners for you. It will be awhile before the HPGL export module from Inkscape matures...it was only checked into the code base in June, and most of the devs working on it are trying to drive vinyl cutters like the Roland CAMM-1. I've been using Inkscape for a year or two, but I've only used the printed output to make silk screens.
 
Absolutely, don't wanna take this OT.

Back on the topic, though, isn't HPGL the same data you can use to drill a pcb on a cnc? I've been wondering about how to get the stuff I designed in Illustrator onto a proper mill before etching...
 
So I poked around a bit inside the Inkscape extension that you're using (yay for open source!). Assuming you're on Windows, go into C:\Program Files\Inkscape\share\extensions, and you'll see a file called hpgl_output.py. Open it up in Notepad, and you'll see the following:

Code:
class MyEffect(inkex.Effect):
    def __init__(self):
        inkex.Effect.__init__(self)
        self.OptionParser.add_option("-f", "--flatness",
                        action="store", type="float", 
                        dest="flat", default=10.0,
                        help="Minimum flatness of the subdivided curves")

Change the default=10.0 to default=1.0. The curves should now look a whole lot rounder.

Internally, the extension renders all vector primitives (e.g. circle, curve, arc, etc) as lines, so it's not using the equivalent primitives in HPGL. Having taken a cursory look at the Inkscape API, I would guess this was just to get something out the door quick and dirty, since doing it otherwise would require a lot more introspection of the SVG data. At some point the ability to set this parameter from the UI of Inkscape will probably pop up, but for a quick fix just go in and edit. I have no idea why it's mirrored, though...I'll save that for an after-dinner snack.

Also, if you don't want to deal with the instability of the development version, you can copy hpgl_output.py and hpgl_output.inx into the directory of 0.46, and they work just as well for that version.
 
Thanks, Ptownkid. On a somewhat related note, when using HPGL graphics in Front Panel Express, how does FPE compute the price for that item? The more tesselated one only differed in price by one cent, so I'm guessing that FPE is calculating the cost based on the length of travel that the engraver has to move, rather than the number of elements in the HPGL file.

In regards to the mirroring, there is an HPGL command that rotates the canvas, but when I tried putting that command in by hand, FPE ignored it completely. There is an option in the FPE dialong when you load the file that lets you manually set the rotation, so that's probably as good as it's going to get.
 
[quote author="McCroskey42"]
In regards to the mirroring, there is an HPGL command that rotates the canvas, but when I tried putting that command in by hand, FPE ignored it completely. There is an option in the FPE dialong when you load the file that lets you manually set the rotation, so that's probably as good as it's going to get.[/quote]

FPD can mirror and rotate when it loads the HPGL, so it's not too much hassle... just strange.

Thanks for that post about editing the python code, it cleaned everything up nicely!

How did you get the HPGL export to work in 0.46? I copied the files over from a beta build of 0.47, but "hpgl" still doesn't show up as a save format in 0.46 for me.
 
Whoops...forgot to mention a step for 0.46: The newer XML parser in Inkscape requires a little gobbledygook that 0.46 chokes on. Copy the following into your hpgl_output.inx file:

Code:
<inkscape-extension>
  <_name>HPGL Output</_name>
  <id>org.ekips.output.hpgl</id>
  <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
  <dependency type="executable" location="extensions">hpgl_output.py</dependency>
  <dependency type="executable" location="extensions">inkex.py</dependency>
  <output>
    <extension>.hpgl</extension>
    <mimetype>image/hpgl</mimetype>
    <_filetypename>HP Graphics Language file (*.hpgl)</_filetypename>
    <_filetypetooltip>Export to an HP Graphics Language file</_filetypetooltip>
    <dataloss>true</dataloss>
  </output>
  <script>
    <command reldir="extensions" interpreter="python">hpgl_output.py</command>
    <helper_extension>org.inkscape.output.svg.inkscape</helper_extension>
  </script>
</inkscape-extension>

and you should be good to go. I did figure out how to get it to specify the flatness parameter in a dialog box when you save, but since the output looks like a bad 80's video game for any values over 1.0 (and coarser tessellation doesn't seem to reduce the cost), I just left it at 1.0.

Next up on my to-do list: Inkscape plugin for automagically generating knob scales. Finally, a project that lets me put my beloved Python to work in the service of DIY...
 
Awesome, after changing the .inx file exporting is working great from 0.46

I just figured out tonight how to use the "function generator" in Inkscape. Generating synthesizer wave vectors takes seconds now:

waves.PNG
 
Back
Top