User:Ssstephen/write-here-write-now

From XPUB & Lens-Based wiki
< User:Ssstephen
Revision as of 16:34, 18 November 2022 by Ssstephen (talk | contribs) (Created page with "This is an attempt to write directly from a keyboard to a plotter pen, onto precut pages (cards) on an A3 sheet. Can it be broken down into steps hopefully yes. =Getting the input from the keyboard= =Sneakily saving it maybe to a txt file for alternative documentation= =Converting it to HPGL with some nice formatting= HPGL things to run before printing any cards: <pre> IN SP1 SC0,40,0,40,2 DT.,1; </pre> IN: initialise the plotter SP1: Select pen 1 SC0,40,0,40,2: S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is an attempt to write directly from a keyboard to a plotter pen, onto precut pages (cards) on an A3 sheet.

Can it be broken down into steps hopefully yes.

Getting the input from the keyboard

Sneakily saving it maybe to a txt file for alternative documentation

Converting it to HPGL with some nice formatting

HPGL things to run before printing any cards:

IN
SP1
SC0,40,0,40,2
DT.,1;

IN: initialise the plotter

SP1: Select pen 1

SC0,40,0,40,2: Scale the plotter units to mm (roughly? or maybe this is exact, need to measure)

DT.,1; : Set the terminator character to period. This should be a non-printing character but not really working at the moment.

Positioning it on the page and sending it to the printer

A very rough way to do this would be to wrap each hpgl command in bash. Chiplotle is probably better but I cant get it working yet. First some hpgl setup. (This needs to know which cards have been used in future, and position the pen based on what card were curently on in a matrix or list, currently it is just printing from the absolute location 0,23 (mm apparently but I dont think so).

for line in userText:
# first line is the title
    if userText.index(line) == 0:
        os.system(('echo "PA0,' + str(23-userText.index(line)) + '" > /dev/ttyUSB0'))
        os.system(('echo "LB' + line + '." > /dev/ttyUSB0'))

     
    #     all the other lines
    else:
        os.system(('echo "PA0,' + str(21-userText.index(line)) + '" > /dev/ttyUSB0'))
        os.system(('echo "LB' + line + '." > /dev/ttyUSB0'))

PA: position absolute LB: label (text, needs a terminator character)