On 15-Mar-2012 emmanuel chemla wrote:
> A newbie question in Pic:
> Having to draw a ruled paper, I finally succeeded in writing
> this short program :
> ----
> .PS
> lineWidth=3i
> interlineHeight=0.2
>
> line lineWidth;
> line lineWidth at last line.start +(0i, -interlineHeight)
> line lineWidth at last line.start +(0i, -interlineHeight)
> line lineWidth at last line.start +(0i, -interlineHeight)
> .PE
>
> ----
> the program is correct but I would like it to work in a loop,
> with the number of lines set in a register or as a variable
> or send as an argument to a recursive macro.
> (and I don't want to output as much as *".PS blabla .PE"*
> blocks as lines needed, I'd like to solve this matter just
> staying in Pic environment).
>
> Any ideas ?
The following should do what you want:
.PS
nLines=20
lineWidth=3i
interlineHeight=0.2
line lineWidth;
for i=1 to (nLines-1) do {
line lineWidth at last line.start +(0i, -interlineHeight)
}
.PE
Ted.
-------------------------------------------------
E-Mail: (Ted Harding) <[email protected]>
Date: 15-Mar-2012 Time: 23:45:12
This message was sent by XFMail
-------------------------------------------------