Reference Guide > Output Devices and Window Systems > HPGL Output
  

HPGL Output
HPGL (Hewlett-Packard Graphics Language) is a plotter control language used to produce graphics on a wide family of pen plotters.
To use HPGL as the current graphics device, issue the command:
SET_PLOT, 'HP'
This causes PV-WAVE to use HPGL for producing graphical output. Once the HPGL driver is enabled via SET_PLOT, the DEVICE procedure is used to control its actions, as described in "Controlling HPGL Output with DEVICE Keywords". The default settings for the HPGL driver are given in HPGL Default Settings.
 
Table B-3: HPGL Default Settings  
Setting
Default Value
Output file name
wave.hp
Orientation
portrait
Erase
no action
Polygon fill
software
Turn plotter logically on/off
no
Specify xon/xoff flow control
yes
Horizontal offset
.3175 cm (.125 in.)
Vertical offset
11.43 cm (4.5 in.)
Width
17.78 cm (7 in.)
Height
12.7 cm (5 in.)
Use the statement:
INFO, /Device
to view the current HPGL driver settings.
Controlling HPGL Output with DEVICE Keywords
The following keywords to the DEVICE procedure provide control over the HPGL driver:
Close_File—PV-WAVE creates, opens and writes a file containing the generated graphics output. The Close_File keyword outputs any buffered commands and closes the file.
 
Caution
Under UNIX, if you close the output file with the Close_File DEVICE keyword, and then execute a command (such as PLOT) that creates more output, PV‑WAVE reopens the same file, erasing the previous contents. To avoid losing the contents of an output file, use the Filename keyword to specify a different filename, or use SET_PLOT to switch to a different graphics driver, or be sure to print the closed output file before creating more output.
 
note
See the discussion of printing output files in the PV‑WAVE User’s Guide for more information on this topic.
Eject—In order to perform an erase operation on a plotter, it is necessary to remove the current sheet of paper and load a fresh sheet. The ability of various plotters to do this varies, so the Eject keyword allows you to specify what should be done. The following list gives the possible values:
*0—(Default) Do nothing. Note that this is likely to cause one page to plot over the previous one, so you should limit yourself to one page of output per file.
*1—Use the sheet feeder to load the next page.
*2—Put the plotter off-line at the beginning of each page, except the first.
Many HPGL plotters lack a sheet feeder, and require you to load the next page manually. Therefore, the default action is for PV‑WAVE to not issue any page eject instructions. In this case, you must restrict yourself to generating only a single plot at a time.
If your plotter has a sheet feeder, you need to issue the command:
DEVICE, /Eject
to tell PV‑WAVE that it should use the sheet feeder instead of placing the plotter off-line. If your plotter does not have a sheet feeder, but it does understand the HPGL NR command, use the command:
DEVICE, Eject=2
to place the plotter off-line at the start of every plot except the first one. This causes the plotter to wait between plots for you to replace the paper. When you put the plotter back on-line, the graphics commands for the new page are executed by the plotter. Consult the programming manual for your plotter to determine if this instruction is provided.
Filename—By default all generated output is sent to a file named wave.hp. The Filename keyword can be used to change this default. If you specify a filename, the following occurs:
*If the file is already open (as happens if plotting commands have been directed to the file since the call to SET_PLOT), then the file is completed and closed as if Close_File had been specified.
*The specified file is opened for subsequent graphics output.
Inches—By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Inches is present and nonzero, these keywords are taken to be in inches instead.
Landscape—PV-WAVE normally generates plots with portrait orientation (the x-axis is along the short dimension of the page). If Landscape is present, landscape orientation (the x-axis is along the long dimension of the page) is used instead.
Output—Specifies a scalar string that is sent directly to the graphics output file without any processing, allowing you to send arbitrary commands to the file. Since PV‑WAVE does not examine the string, it is your responsibility to ensure that the string is correct for the target device.
Polyfill—Some plotters (e.g., HP7550A) can perform polygon filling in hardware, while others (e.g., HP7475) cannot. PV-WAVE therefore assumes that the plotter cannot, and generates all polygon operations in software using line drawing. Specifying a nonzero value for the Polyfill keyword causes PV‑WAVE to use the hardware polygon filling. Setting it to zero reverts to software filling.
Different implementations of HPGL plotters may have different limits for the number of vertices that can be specified for a polygon region before the plotter runs out of internal memory. Since this limit can vary, the HPGL driver cannot check for calls to Polyfill that specify too many points. Therefore, it is possible to produce HPGL output that causes an error when sent to the plotter. To avoid this situation, minimize the number of points used. On the HP7550A, the limit is about 127 points. If you do generate output that exceeds the limit imposed by your plotter, you have to break that polygon filling operation into multiple smaller operations.
Plotter_On_Off—There are some configurations in which an HPGL plotter is connected between the computer and a terminal. In this mode (known as eavesdrop mode), the plotter ignores everything it is sent and passes it through to the terminal—the plotter is logically off.  This state continues until an escape sequence is sent that turns the plotter logically on. At this point the plotter interprets and executes all input as HPGL commands. Another escape sequence is sent at the end of the HPGL commands to return the plotter to the logically off state.
Most configurations do not use eavesdrop mode, and the plotter is always logically on. However, if you are using this style of connection, you must use Plotter_On_Off to instruct PV‑WAVE to generate the necessary on/off commands. If present and nonzero, Plotter_On_Off causes each output page to be bracketed by device control commands that turn the plotter logically on and off. Specifying a value of zero stops the issuing of such commands. You should only use this keyword before any output has been generated.
Portrait—If Portrait is present, PV‑WAVE generates plots using portrait orientation, the default.
Xoffset—Specifies the x position on the page of the lower-left corner of output. Xoffset is specified in centimeters unless Inches is specified. (In some cases, offset is taken from the origin. See the Note at the end of this section for details.)
Xon_Xoff—If present and nonzero, Xon_Xoff causes each output page to start with device control commands that instruct the plotter to obey xon/xoff (^S/^Q) style flow control. A value of zero stops issuing commands. You should only use this keyword before any output has been generated. Such handshaking is the default. To turn it off, use the command:
DEVICE, Xon_Xoff=0
Often, it is not necessary to tell the plotter to obey flow control because the printing facilities on the system handle such details for you, but it is usually harmless.
Xsize—Specifies the width of output PV‑WAVE generates. Xsize is specified in centimeters unless Inches is specified.
Yoffset—Specifies the y position on the page of the lower-left corner of output generated by PV‑WAVE. Yoffset is specified in centimeters unless Inches is specified. (In some cases, offset is taken from the origin. See the Note following the keyword descriptions for details.)
YsizeSpecifies the height of output generated by PV‑WAVE. Ysize is specified in centimeters unless Inches is specified.
When plotting to an HP plotter in the series 757X, 758X, and 759X, you will need to specify the Xoffset and Yoffset from the origin instead of the lower-left corner of output. Because the default values for Xoffset and Yoffset assume a lower-left corner origin, you have to set these keywords to appropriate values when plotting to one of the above listed plotters. For example, to center a plot, use the following equations to find the offsets:
Xoffset = -(Xsize/2)
Yoffset = -(Ysize/2)
where Xsize and Ysize are the width and height, respectively, of the plot to be generated.
 
note
If you have trouble with plots not completing and you have a plotter that allows you to set switches to enable pen buffering, make sure that this switch is set. If it is not, turn the plotter off, set the switch, and send your plot to the plotter again.
Supported Features of HPGL
PV‑WAVE is able to produce a wide variety of graphical output using HPGL.
Here is a list of what is supported:
*All types of vector graphics can be generated, including line plots, contours, surfaces, etc.
*HPGL plotters can draw lines in different colors selected from the pen carousel. It should be noted that color tables are not used with HPGL. Instead, each color index refers directly to one of the pens in the carousel.
*Some HPGL plotters can do polygon filling in hardware. Others can rely on the software polygon filling provided by PV‑WAVE.
*It is possible to generate graphics using the hardware-generated text characters, although such characters do not give much improvement over the standard software fonts. To use hardware characters, set the !P.Font system variable to zero, or set the Font keyword to the plotting routines to zero. For more information on fonts, see the PV‑WAVE User’s Guide.
*Here is a list of what is not supported:
*Since HPGL is designed to drive pen plotters, it does not support the output of raster images. Therefore the TV and TVSCL procedures do not work with HPGL.
*Since pen plotters are not interactive devices, they cannot support such operations as cursors and windows.
Specifying Linestyles in HPGL Output
The Linestyle graphics keyword allows you to specify any of 6 linestyles. This keyword is documented in Graphics and Plotting Keywords.
HPGL is not able to support all of the standard PV‑WAVE linestyles. HPGL Linestyles summarizes the differences between the PV‑WAVE linestyles and those supported by HPGL.
Table B-4: HPGL Linestyles
Index
Normal Line Style
HPGL Style
0
Solid
same
1
Dotted
same
2
Dashed
same
3
Dash Dot
The relative size of the dash and dot are different.
4
Dash Dot Dot Dot
Dash Dot Dot
5
Long Dashes
same
 
note
If your HPGL plotter is connected to an HP-IB interface, you must run PV‑WAVE’s HPGL output through a filter before you can plot it. The following UNIX command accomplishes this task:
tr -d '/012' <wave.hp  >newwave.hp

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.