Inkscape and 1980’s plotters

I had a Inkscape itch that needed scratching and as the holidays are upon us Christmas 2014. I found the time to write a patch for Inkscape.

Currently its not easy to use a plotter (DXY-1300) and have it switch pens in Inkscape. There is no method in the GUI to switch the pens. I read on news groups that it would be a good idea to have the stroke colours assigned to pen numbers. I have written this patch that allows pen stroke colour assignment to pen numbers.

screen shot

I used the stroke colour as this the colour the line changes. I also used the primary colours. Until somebody can modify the GUI this was a comprise.

inkscape_window

The export as hpgl now appears like so. With the pen assignments to pen numbers. Then the file will be produced with the necessary SP (Select pen) commands. The original Pen box has no function.

There are three files in the archive. They go in the extensions directory. I would also backup your originals first of course. Have fun and let me know if this helped.

These files are based on Inkscape 0.91pre3 However I don’t suspect these hpgl bit are in much flux so it should work for older versions. Mileage may vary.

hpgl_multipen.tar.gz

There a few things that could be improved upon in hpgl_encode. The order in which the pens are selected are based upon the order in which they are drawn in the editor. This is not ideal and to solve it is a “travelling salesman” type problem. This I believe has already been solved in the Inkcut plot extension. So it would be wise to integrate that code.

Here is a test file that will select each pen in order of 1 through to 8. The lines will be drawn from the bottom up. This can be used to test the new pen select code I have added.

 

An anomaly I noticed was that when selecting a pen the head returns to the same place. then continues drawing with the next command. This makes the pen change look inefficient as the head will return to where is once was, even if there is no line to be drawn. Then moves to the new position. Ideally before and after the Pen select command is executed the head would not return to the same location, but instead go to a new location. This seems to be a feature of the hardware and not something the command sequence automatically does.

It would be possible to have the head go to, a location nearest the next pen section then do a SP (Select Pen) so the head only travels back to this location and appears as if its travelling to a new location after pen selection. This would require eight locations outside the pen cartridges to be defined. This may be different for every plotter however. So unless somebody asks, I can’t see the justification in this one.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.