User:Ssstephen/write-here-write-now
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,379,0,250,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) EditL this was wrong, "SC0,379,0,250,2" worked but I'm not sure why.
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)