aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgerbolyze3
-rwxr-xr-xgerbolyze.py6
2 files changed, 5 insertions, 4 deletions
diff --git a/gerbolyze b/gerbolyze
index e6c6d67..fad68b4 100755
--- a/gerbolyze
+++ b/gerbolyze
@@ -16,6 +16,7 @@ if __name__ == '__main__':
vectorize_parser.add_argument('side', choices=['top', 'bottom'], help='Target board side')
vectorize_parser.add_argument('--layer', '-l', choices=['silk', 'mask', 'copper'], default='silk', help='Target layer on given side')
+ vectorize_parser.add_argument('--exact', '-x', action='store_true', default=False, help='Do not subtract existing features on other layers from overlay')
vectorize_parser.add_argument('source', help='Source gerber directory')
vectorize_parser.add_argument('target', help='Target gerber directory')
@@ -29,7 +30,7 @@ if __name__ == '__main__':
args = parser.parse_args()
if args.command == 'vectorize':
- gerbolyze.process_gerbers(args.source, args.target, args.image, args.side, args.layer, args.debugdir)
+ gerbolyze.process_gerbers(args.source, args.target, args.image, args.side, args.layer, args.exact, args.debugdir)
else: # command == render
gerbolyze.render_preview(args.source, args.image, args.side, args.fab_resolution, args.oversampling)
diff --git a/gerbolyze.py b/gerbolyze.py
index 3284ae7..37d2356 100755
--- a/gerbolyze.py
+++ b/gerbolyze.py
@@ -305,7 +305,7 @@ LAYER_SPEC = {
# Command line interface
# ======================
-def process_gerbers(source, target, image, side, layer, debugdir):
+def process_gerbers(source, target, image, side, layer, exact, debugdir):
if not os.path.isdir(source):
raise ValueError(f'Given source "{source}" is not a directory.')
@@ -326,7 +326,7 @@ def process_gerbers(source, target, image, side, layer, debugdir):
print('Target layer file {}'.format(os.path.basename(tname)))
oname, ogrb = find_gerber_in_dir(source, layers['outline'])
print('Outline layer file {}'.format(os.path.basename(oname)))
- subtract = find_gerber_in_dir(source, layers[slayer]) if slayer else None
+ subtract = [find_gerber_in_dir(source, layers[slayer])] if slayer and not exact else []
# Prepare output. Do this now to error out as early as possible if there's a problem.
if os.path.exists(target):
@@ -337,7 +337,7 @@ def process_gerbers(source, target, image, side, layer, debugdir):
sys.exit(1)
# Generate output
- out = paste_image(tgrb, ogrb, source_img, [subtract], debugdir=debugdir, status_print=lambda *args: print(*args, flush=True))
+ out = paste_image(tgrb, ogrb, source_img, subtract, debugdir=debugdir, status_print=lambda *args: print(*args, flush=True))
shutil.copytree(source, target)
with open(os.path.join(target, os.path.basename(tname)), 'w') as f: