Hewlett Packard Graphics Language Commands

SC, Scale

This command establishes a user-unit coordinate system by mapping user-defined coordinate values onto the scaling points P1 and P2.

SC XMIN,XMAX,YMIN,YMAX [,type[,left,bottom;]] or

SC XMIN,XFACTOR,YMIN,YFACTOR,type[;] or

SC [;]

Parameter Format Functional Range Default
XMIN,XMAX, real -230 to 230 - 1 no default
YMIN,YMAX real -230 to 230 - 1 no default
type clamped integer 0, 1, or 2 0
left clamped real 0 to 100% 50%
bottom clamped real 0 to 100% 50%
XFACTOR, YFACTOR real -230 to 230 - 1 no default

There are three forms of scaling: anisotropic, isotropic, and point-factor. The Type parameter tells the printer which form you are using. Refer to the following table.

Scaling Form Type Description
Anisotropic 0 Establishes standard user-unit scaling allowing different unit size on X-axis and Y-axis.
Isotropic 1 Establishes standard user-unit scaling with same unit size on X-axis and Y-axis.
Point Factor 2 Establishes P1 user-unit location and a specific ratio of plotter units to user-units.

No Parameters - Turns off scaling; subsequent coordinates are in plotter units.

For Scaling Types 0 and 1:

The following forms of scaling establish a user-unit coordinate system by mapping user-defined coordinate values onto the scaling points P1 and P2. The type parameter selects between anisotropic (Type 0) and isotropic scaling (Type 1).

Scaling Form Type Syntax
Anisotropic 0 SC XMIN ,XMAX ,YMIN ,YMAX [,type;]
Isotropic 1 SC XMIN ,XMAX ,YMIN ,YMAX [,type[,left,bottom];]

XMIN, XMAX, YMIN, YMAX - These parameters represent the user-unit X- and Y-axis ranges, respectively. For example, SC0,15,0,10 indicates 15 user-units along the X-axis and 10 user-units along the Y-axis. As a result, the first and third parameters (XMIN and YMIN) are the coordinate pair that is mapped onto P1; the second and fourth parameters (XMAX and YMAX) are the coordinate pair mapped onto P2. Using the same example, the coordinate location of P1 is (0,0) and P2 is (15,10). This is di erent from the IP command, where the parameters are expressed as X,Y coordinate pairs rather than as ranges.

Note XMIN cannot be set equal to XMAX, and YMIN cannot be set equal to YMAX.

As their names suggest, you will normally want to specify XMIN smaller than XMAX, and YMIN smaller than YMAX. If you specify XMIN larger than XMAX and YMIN larger than YMAX, your illustration is drawn as a mirror-image, reversed and/or upside down, depending on the relative positions of P1 and P2.

The parameters of the SC command are always mapped onto the current P1 and P2 locations. P1 and P2 retain these new values until scaling is turned off or another SC command redefines the user-unit values. Thus, the size of a user unit could change if any change is made in the relative position and distance between P1 and P2 after an SC command is executed.

Type - Specifies anisotropic or isotropic scaling.

0 Anisotropic scaling. Allows a user-unit along the X-axis to be a different size than user-units along the Y-axis. Printed shapes are distorted when you use anisotropic scaling. For example, a circle might be drawn as an ellipse- oval-shaped instead of round. (Left and bottom parameters are ignored for anisotropic scaling.)
1 Isotropic scaling. Produces user-units that are the same size on both the X- and Y-axes. The following illustrations show how the printer adjusts the location of (XMIN,YMIN) and (XMAX,YMAX) to create the largest possible isotropic area within the P1/P2 limits. (Remember, the user-units are always square regardless of the shape of the isotropic area.)

[Image][Image]

Left, Bottom - Positions the isotropic area in the P1/P2 limits. (These parameters are always specified together and are valid for isotropic scaling only.) The left parameter indicates the percentage of the unused space on the left of the isotropic area; the bottom parameter indicates the percentage of unused space below.

The defaults for the left and bottom parameters are each 50%. This centers the isotropic area on the page with the unused space equally divided between left and right or top and bottom, as shown in the previous illustrations.

Although you must specify both parameters, the printer applies only one: the left parameter applies when there is extra horizontal space; the bottom parameter applies when there is extra vertical space. The following examples illustrate left and bottom parameters of 0% and 100%.

[Image]

For Scaling Type 2:

The third form of scaling, point-factor scaling, sets a specific ratio of plotter units to user-units, and establishes the user-units coordinate of P1.

Scaling Form Type Syntax
Point Factor 2 SC XMIN ,XFACTOR ,YMIN ,YFACTOR ,type[;]

XMIN,XFACTOR,YMIN,YFACTOR -Establish the user-unit coordinates of P1 and the ratio of plotter to user-units. XMIN and YMIN are the user-unit coordinates of P1. XFACTOR sets the number of plotter units per user-unit on the X-axis; YFACTOR sets the number of plotter units per user-unit on the Y-axis.

Type - Must be 2 for this type of scaling.

An SC command remains in effect until another SC command is executed, or the printer is initialized or set to default conditions.

Examples: The following examples explain the effect of several parameter selections.

(SC0,40,0,40,2) allows scaling in millimeters since 1 millimeter = 40 plotter units. Each user-unit is 1 millimeter.

(SC0,1.016,0,1.016,2) allows scaling in thousandths of an inch since 1 inch = 1016 plotter units.

While scaling is on (after any form of the SC command has been executed), only those HP-GL/2 commands that can be issued in `current units' are interpreted as user-units; the commands that can be issued only in plotter units are still interpreted as plotter units. (The command syntax discussion pertaining to each command tells you which kind of units each parameter requires.)

The SC parameters are mapped onto the current locations of P1 and P2. P1 and P2 do not represent a graphic limit; therefore, the new user-unit coordinate system extends across the entire range of the plotter-unit coordinate system. Thus, you can print to a point beyond P1 or P2, as long as you are within the effective window. For example, you can print from the point (-1,3.5) to the point (5.5,1.5) as shown in the following illustration.

Related Commands Group
IP, Input P1 and P2
IR, Input Relative P1 and P2
IW, Input Window
The Configuration/Status Group

Possible Error Conditions for SC

Condition Printer Response
no parameters turns scaling off
more than 7 parameters executes first 7 parameters
for types 0 or 1: 6 parameters or less than 4 parameters ignores command
for type 2: any more or less than 5 parameters ignores command
XMIN=XMAX or YMIN=YMAX or number out of range ignores command
XFACTOR=0 or YFACTOR=0 ignores command

See:

Questions: