HPGL output scaling incorrect

Bug #548918 reported by Neil Baylis
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Alvin Penner

Bug Description

The scaling factor used to generate hpgl output is slightly incorrect. Inkscape version 0.47.

In hpgl_output.py, the scaling is set to 1016/90. This assumes 40 plotter units per mm.

In fact, there are 40.2 plotter units per mm.

The following text is reproduced from the HP7475A interfacing and programming manual page 2-5:

"The plotting area is divided into plotter units; one plotter unit equals 0.025 mm (0.00098 in). There are approximately 40.2 plotter units per millimeter, or approximately 1021 plotter units per inch."

On this plotter, if I plot an object of a known size, and then measure it with a ruler, the size is incorrect. I modified the scale factor in hpgl_output.py to be 1021/90 instead of 1016/90 and repeated the experiment. This caused the object to measure correctly.

I don't know if any other plotters use this same value. It might be useful to allow the user to specify the number of plotter units per inch for their specific plotter in the dialog that appears when saving as hpgl.

Anyway, at least for the HP 7475A, the correct number is 1021, not 1016.

Neil Baylis

Tags: exporting hpgl

Related branches

su_v (suv-lp)
tags: added: exporting hpgl
Revision history for this message
Alvin Penner (apenner) wrote :

attached is a modified version of hpgl_output.py that deals with this. It contains a new parameter called resolution. Could you try this and see if it helps?

Revision history for this message
Alvin Penner (apenner) wrote :

to use this, you will need to copy both the .inx file and the .py file into the share\extensions directory.

Revision history for this message
Neil Baylis (neil-baylis) wrote : Re: [Bug 548918] Re: HPGL output scaling incorrect

Thanks Alvin, I'll test it and let you know.

Neil

On Sun, Mar 28, 2010 at 4:21 PM, Alvin Penner <email address hidden> wrote:
> to use this, you will need to copy both the .inx file and the .py file
> into the share\extensions directory.
>
> ** Attachment added: "hpgl_output.inx"
>   http://launchpadlibrarian.net/42324509/hpgl_output.inx
>
> --
> HPGL output scaling incorrect
> https://bugs.launchpad.net/bugs/548918
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Inkscape: A Vector Drawing Tool: New
>
> Bug description:
> The scaling factor used to generate hpgl output is slightly incorrect. Inkscape version 0.47.
>
> In hpgl_output.py, the scaling is set to 1016/90. This assumes 40 plotter units per mm.
>
> In fact, there are 40.2 plotter units per mm.
>
> The following text is reproduced from the HP7475A interfacing and programming manual page 2-5:
>
> "The plotting area is divided into plotter units; one plotter unit equals 0.025 mm (0.00098 in). There are approximately 40.2 plotter units per millimeter, or approximately 1021 plotter units per inch."
>
> On this plotter, if I plot an object of a known size, and then measure it with a ruler, the size is incorrect. I modified the scale factor in hpgl_output.py to be 1021/90 instead of 1016/90 and repeated the experiment. This caused the object to measure correctly.
>
> I don't know if any other plotters use this same value. It might be useful to allow the user to specify the number of plotter units per inch for their specific plotter in the dialog that appears when saving as hpgl.
>
> Anyway, at least for the HP 7475A, the correct number is 1021, not 1016.
>
> Neil Baylis
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/inkscape/+bug/548918/+subscribe
>

--
http://www.pixpopuli.com

Revision history for this message
Neil Baylis (neil-baylis) wrote :

Alvin,

the resolution option works correctly, thanks very much.

There are a couple of other issues with the hpgl output. I'm not sure
whether they warrant another bug report or not:

Firstly, the hpgl files generated by this extension leave the pen in
the down state at the end of the file. It would be useful if it issued
a pen up command at the end. Without this, the ink from the pen begins
to soak into the paper and bleeds into a blob at the last point
plotted. The pen up command is 'PU;'

Secondly, every hpgl file generated by the extension begins by
selecting pen 1, and generating the entire output with this pen. It
might be more useful to have an option in the save-as dialog that
specifies which pen to select, or to select a different pen for each
layer. This doesn't matter for folks who use hpgl files for a vinyl
cutter, as they do not have multiple pens. But plotters typically have
multiple pens. Mine has 6 pens, and 8 pens is also common.

Neil

Revision history for this message
Alvin Penner (apenner) wrote :

attached are new versions of these two files. I've added the PU; at the end and added an option to choose a pen number.

Revision history for this message
Alvin Penner (apenner) wrote :

unfortunately, I don't know how to associate specific pen numbers with layers. This information would be document-specific so it would need to be saved in the svg file, not in the Inkscape preferences.

could you try this and see if it looks reasonable?

su_v (suv-lp)
Changed in inkscape:
importance: Undecided → Wishlist
status: New → In Progress
Revision history for this message
Neil Baylis (neil-baylis) wrote :
  • xxx.hpgl Edit (64 bytes, application/octet-stream; name="xxx.hpgl")
  • xxx.svg Edit (2.1 KiB, image/svg+xml; name="xxx.svg")

Hi Alvin,

On Mon, Mar 29, 2010 at 6:25 PM, Alvin Penner <email address hidden> wrote:
> unfortunately, I don't know how to associate specific pen numbers with
> layers. This information would be document-specific so it would need to
> be saved in the svg file, not in the Inkscape preferences.
>

I understand. I was thinking of just starting with pen 1, and
incrementing the pen number for each layer. But I'm not sure if that
would work for other users.

Having the option of selecting a single pen in the save-as dialog is
probably a good compromise. This way, the user can at least make a
separate hpgl file for each pen.

The changes you provided seem to work OK, except there seems to be an
extra point plotted at the end.

I made a test drawing that draws a 1 inch square located at 0,0. I've
attached the svg file and the resulting hpgl file. If you look before
the final 'PU;" there are two identical 'PD0,1019;' entries. Looking
at the code, it's not immediately clear to me why this is happening.
This extra point has no effect on the plotter, because it's identical
to the previous one.

Neil

Revision history for this message
Alvin Penner (apenner) wrote :

    The extra point is confirmed. Inkscape will sometimes do this, for reasons that I do not understand. It has to do with whether a path has been formally closed or not. For example, if you go into the XML editor and select this particular path and remove the 'z' at the end, then the extra point in the hpgl output will disappear. The 'z' is an svg command to close the path, which in this case is redundant, and leads to the extra point.

In any event, these changes have been committed to bzr rev 9262.

Changed in inkscape:
status: In Progress → Fix Committed
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.48
ScislaC (scislac)
Changed in inkscape:
importance: Wishlist → Low
ScislaC (scislac)
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
scruss (scruss) wrote :

Although the HP-7475A manual does state that "[t]here are approximately 40.2 plotter units per millimeter", the standard is that one HP-GL unit = 1/40 mm. Physical device units are always an approximation depending on temperature, humidity, and plotting media. If you want accurate output, you'll always need to measure and calibrate.

I have a couple of other HP manuals here. Here's what they say:

The HP-GL/2 and HP RTL Reference Guide: A Handbook for Program Developers, page 12 (Hewlett Packard, 1996. ISBN 0–201–63325–6):

    Plotter-units Equivalent Value
    1 plotter-unit = 0.025 mm (≈ 0.00098 inch)
    40 plotter-units = 1 mm
    1016 plotter-units = 1 inch
    3.39 plotter-units = 1 dot at 300 dots per inch

(available at http://www.hpmuseum.net/document.php?catfile=213 )

HP-GL Programmer's Reference Manual, page 3 (Hewlett Packard, 1984):

    The plotter unit is the smallest possible addressable move
    and is 0.025 mm (approximately 0.001 in) in length.

HP-7470A Graphics Plotter - Interfacing and Programming Manual page 2-3 (Hewlett Packard, 1982, 1984):

    The plotting area is divided into plotter units; one plotter unit equals
    0.025 mm. There are approximately 40 plotter units per millimetre, or
    approximately 1000 plotter units per inch.

(available here: http://scruss.com/wordpress/wp-content/uploads/2014/03/HP-7470A_Graphics_Plotter-Interfacing_and_Programming_Manual.pdf)

I'd say that the 40.2 number is an anomaly in the HP-7475A manual, and that the 40 units per mm standard should be used.

Revision history for this message
Alvin Penner (apenner) wrote :

>> and that the 40 units per mm standard should be used.

actually, it is. The very first time you run the extension, the default resolution will be 1016 dpi as expected.

Revision history for this message
TimeWaster (sebi-k-deactivatedaccount) wrote :

Actually there are many plotters that have weird units deviating from the "standard" (there is actually no official standard) 1016 DPI (40 dpmm).

My Helo cutter for instance uses 1000 DPI, and i have seen at least 5 other plotters having equally weird settings.

so there is no standard that this extension should follow, although it (now) presets 1016 DPI.
there is nothing wrong with that and every user has to calibrate this number for his plotter them selfs.

is there a reason why you write this on a bug report that has long been closed (and outdated since the trunk version of this extension behaves now different)?
Just curious.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.