From bc63166a40f522014dfd11e830cce11d6d61be6d Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 30 Mar 2023 14:54:46 +0200 Subject: svg-flatten: Make drill size mapping more precise, add tests --- gerbolyze/__init__.py | 24 ------------------------ gerbolyze/tests/resources/layers.svg | 22 +++++++++++----------- gerbolyze/tests/test_integration.py | 20 +++++++++++++++++--- 3 files changed, 28 insertions(+), 38 deletions(-) (limited to 'gerbolyze') diff --git a/gerbolyze/__init__.py b/gerbolyze/__init__.py index e817471..2989169 100755 --- a/gerbolyze/__init__.py +++ b/gerbolyze/__init__.py @@ -335,30 +335,6 @@ def parse_subtract_script(script, default_dilation=0.1, default_script=DEFAULT_S subtract_script[out_layer] = subtract_script.get(out_layer, []) + [(in_layer, dilation)] return subtract_script -# Parameter parsing foo -#====================== - -def parse_bbox(bbox): - if not bbox: - return None - elems = [ int(elem) for elem in re.split('[,/ ]', bbox) ] - if len(elems) not in (2, 4): - raise click.BadParameter( - '--bbox must be either two floating-point values like: w,h or four like: x,y,w,h') - - elems = [ float(e) for e in elems ] - - if len(elems) == 2: - bounds = [0, 0, *elems] - else: - bounds = elems - - # now transform bounds to the format pcb-tools uses. Instead of (x, y, w, h) or even (x1, y1, x2, y2), that - # is ((x1, x2), (y1, y2) - - x, y, w, h = bounds - return ((x, x+w), (y, y+h)) - # Utility foo # =========== diff --git a/gerbolyze/tests/resources/layers.svg b/gerbolyze/tests/resources/layers.svg index fd263c7..1879033 100644 --- a/gerbolyze/tests/resources/layers.svg +++ b/gerbolyze/tests/resources/layers.svg @@ -94,7 +94,7 @@ inkscape:document-units="mm" showgrid="false" inkscape:zoom="1.326224" - inkscape:cx="153.44316" + inkscape:cx="145.52594" inkscape:cy="302.3622" inkscape:window-width="1920" inkscape:window-height="1011" @@ -109,38 +109,38 @@ aria-label="Top Paste" transform="matrix(0.70241335,0,0,0.70241335,-8.580134,-12.02921)" id="text1132" - style="font-style:italic;font-size:9.00953px;font-family:'Bodoni Moda';-inkscape-font-specification:'Bodoni Moda Italic';text-align:justify;white-space:pre;shape-inside:url(#rect1134);display:inline;opacity:1;stroke:#000000;stroke-width:0.141882;stroke-linecap:round;stroke-linejoin:round"> + style="font-style:italic;font-size:9.00953px;font-family:'Bodoni Moda';-inkscape-font-specification:'Bodoni Moda Italic';text-align:justify;white-space:pre;shape-inside:url(#rect1134);display:inline;opacity:1;stroke:#000000;stroke-width:0.14236632;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none"> @@ -544,7 +544,7 @@ id="path7795" />