Commit bb19884b authored by gijs's avatar gijs

Simplified commands, clean HPGL in python

parent 333954c2
......@@ -37,12 +37,17 @@ def ploteps():
# converting eps to hpgl
subprocess.call([
'./eps2hpgl.sh',
'./{0}'.format(epsfile)
'pstoedit',
'-f',
'plot-hpgl',
epsfile,
hpglfile
])
handle = open(hpglfile)
shape = ''.join(handle.readlines()).replace('\n', '')
dirtyhpgl = ''.join(handle.readlines()).replace('\n', '')
cleanhpgl = ';'.join([part for part in dirtyhpgl.split(';') if part[0:2] in ['PA', 'PR', 'PU', 'PD']])
textbox = Textbox(
font=font,
......@@ -54,7 +59,7 @@ def ploteps():
textbox.insertText('{0} \n{1} \n\ntype.code, Maison du Livre, Bruxelles'.format(hpglfile, datetime.now().strftime("%d-%m-%Y %H:%M")))
hpgl = 'SC{0},{1},{2},{3};SP{4};FS{5};VS{6};PU;{7};PU;'.format(page['left'], page['right'], page['bottom'], page['top'], pen, force, speed, shape)
hpgl = 'SC{0},{1},{2},{3};SP{4};FS{5};VS{6};PU;{7};PU;'.format(page['left'], page['right'], page['bottom'], page['top'], pen, force, speed, cleanhpgl)
# hpgl += box((page['left'] + 200, page['bottom'] + 200), 200 * 40, 287 * 40)
hpgl += textbox.hpgl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment