diff options
author | jaseg <git@jaseg.de> | 2022-02-05 12:34:28 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-02-05 12:34:28 +0100 |
commit | 57941b1b76ffbdb9a5eeb9fef5e3c2365e3a4b84 (patch) | |
tree | b75d54db39ad522ee0ee6ee0d3b3679d84247bd6 /examples/panelize.py | |
parent | 4cbda84aa61158c06acc78aac4b318bbea5b6214 (diff) | |
download | gerbonara-57941b1b76ffbdb9a5eeb9fef5e3c2365e3a4b84.tar.gz gerbonara-57941b1b76ffbdb9a5eeb9fef5e3c2365e3a4b84.tar.bz2 gerbonara-57941b1b76ffbdb9a5eeb9fef5e3c2365e3a4b84.zip |
Arc approx WIP
Diffstat (limited to 'examples/panelize.py')
-rwxr-xr-x | examples/panelize.py | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/examples/panelize.py b/examples/panelize.py deleted file mode 100755 index 20a2cac..0000000 --- a/examples/panelize.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -import sys, os -import gerberex -from gerberex import DxfFile, GerberComposition, DrillComposition - -exts = ['GTL', 'GTO', 'GTP', 'GTS', 'GBL', 'GBO', 'GBP', 'GBS', 'TXT'] -boards=[ - ('inputs/sonopi-digi.', 0, 0, 0), - ('inputs/sonopi-digi.', 0, 22.5, 0), - ('inputs/rcstick-f-small.', 0, 60, 0), - ('inputs/rcstick-f-small.', 20, 60, 0), - ('inputs/rcstick-f-small.', 40, 60, 0), - ('inputs/rcstick-f.', 92.216, 55.238, 190), - ('inputs/rcstick-jig.', 0, 44, 0), - ('inputs/stm32breakout.', 78.0, 59.36, 90), - ('inputs/stm32breakout.', 100.0, 59.36, 90), -] -outline = 'inputs/outline.dxf' -mousebites = 'inputs/mousebites.dxf' -outputs = 'outputs/panelized' - -os.chdir(os.path.dirname(__file__)) -try: - os.mkdir('outputs') -except FileExistsError: - pass - -def putstr(text): - sys.stdout.write(text) - sys.stdout.flush() - -for ext in exts: - putstr('merging %s: ' % ext) - if ext == 'TXT': - ctx = DrillComposition() - else: - ctx = GerberComposition() - for path, x_offset, y_offset, angle in boards: - file = gerberex.read(path + ext) - file.to_metric() - file.rotate(angle) - file.offset(x_offset, y_offset) - ctx.merge(file) - putstr('.') - if ext == 'TXT': - file = gerberex.read(mousebites) - file.draw_mode = DxfFile.DM_MOUSE_BITES - file.to_metric() - file.width = 0.5 - file.format = (3, 3) - ctx.merge(file) - else: - file = gerberex.read(outline) - ctx.merge(file) - ctx.dump(outputs + '.' + ext) - putstr(' end\n') - -putstr('generating GML: ') -file = gerberex.read(outline) -file.write(outputs + '.GML') -putstr('.') -ctx = GerberComposition() -base = gerberex.rectangle(width=100, height=100, left=0, bottom=0, units='metric') -base.draw_mode = DxfFile.DM_FILL -ctx.merge(base) -file.draw_mode = DxfFile.DM_FILL -file.negate_polarity() -ctx.merge(file) -ctx.dump(outputs + '-fill.GML') - -putstr('. end\n') |