add all materials
This commit is contained in:
parent
01e7a23ae2
commit
2ea0c0b60c
43 changed files with 20448 additions and 0 deletions
37
setup/generate_materials.py
Normal file
37
setup/generate_materials.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
MSVG = 'template.svg'
|
||||
TEMPL = '0xNN'
|
||||
NREG = 4
|
||||
N = 30
|
||||
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if N > 255:
|
||||
print('cannot do it!')
|
||||
sys.exit()
|
||||
|
||||
addresses = [hex(i).replace("0x", "0x0") for i in range(N//2+1)] + \
|
||||
[hex(i) for i in range(N//2+1,N)] + \
|
||||
[f'REG{i}' for i in range(NREG)]
|
||||
|
||||
msvg = open(MSVG).read()
|
||||
delete = []
|
||||
to_join = []
|
||||
for a in addresses:
|
||||
print(f'Processing {a}...')
|
||||
new_svg = a+MSVG
|
||||
new_svg_pdf = new_svg.replace('.svg', '.pdf')
|
||||
with open(new_svg, 'wt') as svg:
|
||||
svg.write(msvg.replace(TEMPL,a))
|
||||
delete.extend([new_svg, new_svg_pdf])
|
||||
subprocess.run(['inkscape', '--export-filename='+new_svg_pdf, new_svg], capture_output=True)
|
||||
to_join.append(new_svg_pdf)
|
||||
|
||||
subprocess.run(['pdftk'] + to_join + ['output', 'materials.pdf'], capture_output=True)
|
||||
subprocess.check_call(['rm'] + delete)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue