Creating Graphics

Creating Graphics

The next example shows one way to move the rectangle to di￿erent positions on the display.

100

OUTPUT 723;"PU;PA 0,0;PD;"

Position pen.

110

OUTPUT 723;"PR 300,0,0,200,-300,0,0,-200;"

Draw rectangle .

120

OUTPUT 723;"PU;PA 300,300;PD;"

Position pen.

130

OUTPUT 723;"PR 300,0,0,200,-300,0,0,-200;"

Draw rectangle .

140

OUTPUT 723;"PU;PA 600,600;PD;"

Position pen.

150

OUTPUT 723;"PR 300,0,0,200,-300,0,0,-200;"

Draw rectangle .

Reposition the Rectangle

The OSA draws di￿erent types of lines, which are speci￿ed by the line-type command, LINET. Once the line type is speci￿ed, all subsequent lines are drawn with that type. The following example draws rectangles with di￿erent line types.

100

FOR N=0 TO 750 STEP 150

Repeat lines 110 through 140 for six values of N: 0,150,300,450,600,

 

 

and 750.

110

L=L+1

Increase L by one .

120

OUTPUT 723;"LINET ";L;";"

Select line type .

130

OUTPUT 723;"PU;PA ",N,N;";PD;"

Position pen.

140

OUTPUT 723;"PR 300,0,0,200,-300,0,0,-200;"

Draw rectangle .

150

NEXT N

 

The OR command o￿sets the position of graphics on the display relative to P1 , in the current scale units. The programs below draw a box. In the ￿rst example, the box is drawn without any o￿set. In the second, the box is o￿set 500 units in the X and Y directions.

120 OUTPUT 723;"PU;PA 0,0;PD;"

Place pen down at 0,0.

5-7