Multiple pens for hpgl map pen to colour

Bug #1409568 reported by James Cordell on 2015-01-12
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Wishlist
TimeWaster

Bug Description

This patch maps the colours used from a custom inkscape pallet to an 8 pen 1980's style plotter. its does this by mapping colours to a pen. Its modifies a few files including hpgl_enclode.py hpgl_output.pl hpgl_output.ink. More options have been added to the dialogue save box. when saving a hpgl file. The original pen select option is still there but when 0 is selected then multiple pens are used, according to the colours that have been used in the drawing. I have attached a test file also. colour-test.svg that will draw a line with each pen in order from bottom to top.

James Cordell (cordell-james) wrote :

hpgl_encoder.py

James Cordell (cordell-james) wrote :

hpgl_output.inx

James Cordell (cordell-james) wrote :

hpgl_output.py

James Cordell (cordell-james) wrote :

custom pallette

James Cordell (cordell-james) wrote :

colour-test.svg this file have 8 lines that when saved as a hpgl file will use each pen in order.

description: updated
su_v (suv-lp) on 2015-01-12
tags: added: exporting extensions-plugins hpgl
removed: feature pen
Changed in inkscape:
importance: Undecided → Wishlist
su_v (suv-lp) wrote :

@Sebastian - any chance you could take a look at the proposed changes for the HPGL exporter?

TimeWaster (sebi-k) wrote :

@suv - definitely.

Actually i already did take a good look since James contacted me beforehand.

Changed in inkscape:
assignee: nobody → TimeWaster (sebi-k)
su_v (suv-lp) on 2015-01-12
Changed in inkscape:
status: New → In Progress
James Cordell (cordell-james) wrote :

I have discovered this creates a bug with the plot extension. The gui in there will at least need to match the export module pen colour etc.

James Cordell (cordell-james) wrote :

Here is the patch for the Extensions->Export->Plot that needs modifications due to the changes made hpgl_encode.py

James Cordell (cordell-james) wrote :

And the gui changes.

TimeWaster (sebi-k) wrote :

Hi James,

I finally found the time to look into your proposal.

I had a similar feature wish on my table already (In the "ideas for new features" section: http://www.timewasters-place.com/inkscape-and-plotters-the-2nd/ ) and have put a lot of thought into it already.

There are multiple possibilities to "tag" paths to assign them to certain pens:
- Setting a label, title or description in the "Object Properties"
- Set a fill or outline color or stroke width for the path
- Sort the paths into layers and set an identifier in the name of the layer (e.g. "Pen 1")
- Something else i didn't think of (yet)

I think the layer solution is the best since it has multiple advantages:
- No direct "tagging" of any path is needed
- Users can use black outline on the paths to see them better, the bright yellow for instance is not really visible on white
- Users can switch on and off visibility of layers to look at only one pen color at a time
- the "tagging" is visible, readable and understandable at all times since it is the name of the layer
- the paths are grouped thematically

I have just tried some stuff to see if this approach would work, and it does.

What do you think about this?

TimeWaster (sebi-k) wrote :

I forgot some more advantages:
- The paths are already grouped together pen-wise, so plotters do not change the pen randomly
- You can define an unlimited amount of pens instead of only 8
- No parameters have to be added to the GUI (keeps it lean) and the user does not has to configure mappings

James Cordell (cordell-james) wrote :

HI

Yes layers are the way to do it I agree with all your points. My mods are a solution for the interim only.

I am happy to be a tester, debugger as I have a Roland DXY-1300 with eight pens.

TimeWaster (sebi-k) wrote :

Hi James,

please find attached a version you can test. just unzip it into "C:\Program Files\Inkscape\share\extensions" or wherever your Inkscape is installed to.

You can specify a pen in the layer name with the following possible patterns:
"pen1"
"Pen1"
"Pen 1"
"myCoolLayerName Pen 1"
"myCoolLayerName - Pen 1 - andOtherStuff"
and so on. important is that before and after "Pen 1" there is either nothing or a space to separate it from other stuff.

If no pen number is specified in the layer name it will fall back to the "Pen Number" setting from the "Plotter Settings" tab.

It would be very nice if you could test it extensively including different settings (precut & pen number for instance), i am also interested how your plotter reacts when changing a pen, since i was not entirely sure how the commands will be interpret by the plotter.

You can use the save as HPGL function to test without a plotter, the resulting file can be opened with Inkscape again. But be advised that this is in no way a replacement for testing with a plotter, the import was heavily refactored by me today and it could be buggy.

have fun!

jazzynico (jazzynico) on 2015-02-05
Changed in inkscape:
milestone: none → 0.92
TimeWaster (sebi-k) wrote :

Hi James, did you have a chance to test yet?

TimeWaster (sebi-k) wrote :

James, are you still with us?

Hi

Yes I am still here. I have moved house between the last post so I sorry I
have been out of contact. I will test your patch as soon as I can in the
next weeks.

Thanks

James
On 4 Mar 2015 23:40, "TimeWaster" <email address hidden> wrote:

> James, are you still with us?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1409568
>
> Title:
> Multiple pens for hpgl map pen to colour
>
> Status in Inkscape: A Vector Drawing Tool:
> In Progress
>
> Bug description:
> This patch maps the colours used from a custom inkscape pallet to an 8
> pen 1980's style plotter. its does this by mapping colours to a pen.
> Its modifies a few files including hpgl_enclode.py hpgl_output.pl
> hpgl_output.ink. More options have been added to the dialogue save
> box. when saving a hpgl file. The original pen select option is still
> there but when 0 is selected then multiple pens are used, according to
> the colours that have been used in the drawing. I have attached a test
> file also. colour-test.svg that will draw a line with each pen in
> order from bottom to top.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/inkscape/+bug/1409568/+subscriptions
>

James Cordell (cordell-james) wrote :

HI

I made a test file and named the layers. pen 1 through to pen 4.

Here is a video of the pens being selected and it looks fine. The pen I notice returns to its original position. before continuing when changing pen. I have tried different pen change codes in hpgl and there does not seem to be any way round this, as its a hardware restriction.

I also attached the test1.svg so the layers can be seen.

https://www.youtube.com/watch?v=93Fwg-xj20c&list=UUu8dY6i92SpHltZxowr8-XQ

James Cordell (cordell-james) wrote :
TimeWaster (sebi-k) wrote :

hi James, after seeing your youtube video i noticed that the last two commands where switched, also the hpgl export was missing the needed changes, so i ziped you the newest version to fiddle with.
have fun!

James Cordell (cordell-james) wrote :

Hi

I have diffed the hpgl output using the same test1.svg file.

The output is cleaner now as there is no duplicate SP1 at the start.

The only difference I can see phisaclly where the plotter travels is the end position of the head. The pen finishes in a different position now 0,0. Not sure which is more desirable? Maybe ill try two plots in a row.

diff -u brick/plotter\ vector\ drawings/test1.hpgl brick/plotter\ vector\ drawings/test2.hpgl
--- "brick/plotter vector drawings/test1.hpgl" 2015-03-05 21:30:14.656390167 +0000
+++ "brick/plotter vector drawings/test2.hpgl" 2015-03-11 22:55:37.097221427 +0000
@@ -1 +1 @@
-IN;SP1;VS5;SP1;PU1655,2365;PD4342,2397;PU1439,1139;PD1439,1139,4407,1139;SP2;PU1568,4009;PD1568,4009,1568,4008,4181,3621;SP3;PU1697,5427;PD1697,5427,4374,4846;SP4;PU1858,5975;PD1858,5976,1858,5977,1858,5978,1858,5979,4310,6430;PU0,0;SP0;IN;
+IN;VS5;SP1;PU1655,2365;PD4342,2397;PU1439,1139;PD1439,1139,4407,1139;SP2;PU1568,4009;PD1568,4009,1568,4008,4181,3621;SP3;PU1697,5427;PD1697,5427,4374,4846;SP4;PU1858,5975;PD1858,5976,1858,5977,1858,5978,1858,5979,4310,6430;SP0;PU0,0;IN;

James Cordell (cordell-james) wrote :

Hi

I have striped the music off. I find it so petty they have to do that.

TimeWaster (sebi-k) on 2015-04-10
Changed in inkscape:
status: In Progress → Fix Committed
Bryce Harrington (bryce) on 2017-01-10
Changed in inkscape:
status: Fix Committed → Fix Released
Andrew Smith (yratof) wrote :

So I'm working with a Roland DXY 1150A with Inkscape, so far, i'm only managing to plot one pen - I'm not actually seeing any options to use a palette or allow multi-pen options.

Is there something I'm missing, or need to activate or install to get this working?

Andrew Smith (yratof) wrote :

Scrap that – I've just noticed that I have split the drawing into layers before saving – Reading up on your blog Sebi I can see that layer naming must contain Pen X – Will report back if that didn't work

Alvin Penner (apenner) wrote :

attached is a screenshot of the appearance of the hpgl output dialog. This gives instructions for how to use multiple pens. This came from Inkscape 0.92.1 r15371.

If your dialog does not look like this then you will need to upgrade to a more recent Inkscape version at: https://inkscape.org/en/download/

James Cordell (cordell-james) wrote :

Use different colours with the inkscap pallet at the bottom of inkscape.
Then export as hpgl.

On 31 Mar 2017 12:29 pm, "Andrew Smith" <email address hidden> wrote:

> So I'm working with a Roland DXY 1150A with Inkscape, so far, i'm only
> managing to plot one pen - I'm not actually seeing any options to use a
> palette or allow multi-pen options.
>
> Is there something I'm missing, or need to activate or install to get
> this working?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1409568
>
> Title:
> Multiple pens for hpgl map pen to colour
>
> Status in Inkscape:
> Fix Released
>
> Bug description:
> This patch maps the colours used from a custom inkscape pallet to an 8
> pen 1980's style plotter. its does this by mapping colours to a pen.
> Its modifies a few files including hpgl_enclode.py hpgl_output.pl
> hpgl_output.ink. More options have been added to the dialogue save
> box. when saving a hpgl file. The original pen select option is still
> there but when 0 is selected then multiple pens are used, according to
> the colours that have been used in the drawing. I have attached a test
> file also. colour-test.svg that will draw a line with each pen in
> order from bottom to top.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/inkscape/+bug/1409568/+subscriptions
>

Andrew Smith (yratof) wrote :

Confirmed that this isn't working still regardless of layer naming

TimeWaster (sebi-k) wrote :

I just tested it with the newest Inkscape version and it is working as expected.

The produced HPGL looks correct:

IN;SP3;PU0,5973;PD2141,5973,2141,3482,0,3482,0,5973;SP2;PU1672,4307;PD3813,4307,3813,1815,1672,1815,1672,4307;SP1;PU3276,2492;PD5418,2492,5418,0,3276,0,3276,2492;SP0;PU0,0;IN;

All three pens are selected.

Find attached my test files with gui screenshots and output file.

If it is still not working for you please provide us with your exact Inkscape version number and a detailed description how to reproduce it and/or testfiles.

Andrew Smith (yratof) wrote :

Thanks for that TimeWaster, onwards I went last night, removed all instances of Inkscape, opted for the Homebrew route – installed the latest available, finally I'm seeing something that looks like it's going to work, then the dreaded "No module named lxml" kicks in when trying to export hpgl.

Are there any flags with Homebrew that would ensure that library is included?

Andrew Smith (yratof) wrote :

Ok, I've managed to bypass that – for future notes:

brew uninstall --ignore-dependencies python
sudo easy_install pip
STATIC_DEPS=true sudo pip install lxml

Solves that issue. ONWARDS TO PLOTTING!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers