aboutsummaryrefslogtreecommitdiff
path: root/gerbolyze/__init__.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-06-19 00:52:57 +0200
committerjaseg <git@jaseg.de>2022-06-19 00:52:57 +0200
commit13b92b09474139676753862ec6d87df72c05f5dd (patch)
tree318090f9174e630c2b377bedd44edd0e86a59564 /gerbolyze/__init__.py
parentd8c20e63118f63546d6dffe008cb6b04dc6d6675 (diff)
downloadgerbolyze-13b92b09474139676753862ec6d87df72c05f5dd.tar.gz
gerbolyze-13b92b09474139676753862ec6d87df72c05f5dd.tar.bz2
gerbolyze-13b92b09474139676753862ec6d87df72c05f5dd.zip
svg: Fix template layer IDs
Diffstat (limited to 'gerbolyze/__init__.py')
-rwxr-xr-xgerbolyze/__init__.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gerbolyze/__init__.py b/gerbolyze/__init__.py
index 8f41361..3011833 100755
--- a/gerbolyze/__init__.py
+++ b/gerbolyze/__init__.py
@@ -271,7 +271,7 @@ def convert(input_svg, output_gerbers, is_zip, dilate, curve_tolerance, no_subtr
layer.merge(dilated, mode='above', keep_settings=True)
if not separate_drill:
- print('merging drill layers')
+ print('Merging drill layers...')
stack.merge_drill_layers()
naming_scheme = getattr(gn.layers.NamingScheme, naming_scheme)
@@ -423,7 +423,7 @@ def calculate_apertureless_bounding_box(cam):
#===========
def template_layer(name):
- return f'<g id="g-{name.lower()}" inkscape:label="{name}" inkscape:groupmode="layer"></g>'
+ return f'<g id="g-{name.lower().replace(" ", "-")}" inkscape:label="{name}" inkscape:groupmode="layer"></g>'
def template_svg_for_png(bounds, png_data, extra_layers, current_layer):
(x1, y1), (x2, y2) = bounds
@@ -440,7 +440,7 @@ def template_svg_for_png(bounds, png_data, extra_layers, current_layer):
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
width="{w_mm}mm" height="{h_mm}mm" viewBox="0 0 {w_mm} {h_mm}" >
<defs/>
- <sodipodi:namedview inkscape:current-layer="g-{current_layer.lower()}" />
+ <sodipodi:namedview inkscape:current-layer="g-{current_layer.lower().replace(" ", "-")}" />
<g inkscape:label="Preview" inkscape:groupmode="layer" id="g-preview" sodipodi:insensitive="true" style="opacity:0.5">
<image x="0" y="0" width="{w_mm}" height="{h_mm}"
xlink:href="data:image/jpeg;base64,{base64.b64encode(png_data).decode()}" />
@@ -454,7 +454,7 @@ def empty_pcb_template(size, extra_layers, current_layer):
w, h, unit = size
extra_layers = "\n ".join(template_layer(name) for name in extra_layers)
- current_layer = f'<sodipodi:namedview inkscape:current-layer="g-{current_layer.lower()}" />' if current_layer else ''
+ current_layer = f'<sodipodi:namedview inkscape:current-layer="g-{current_layer.lower().replace(" ", "-")}" />' if current_layer else ''
# we set up the viewport such that document dimensions = document units = [unit]
template = f'''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -476,7 +476,7 @@ MM_PER_INCH = 25.4
def create_template_from_svg(svg, extra_layers, current_layer):
view, *layers = svg.children
- view.attrs['inkscape__current_layer'] = f'g-{current_layer.lower()}'
+ view.attrs['inkscape__current_layer'] = f'g-{current_layer.lower().replace(" ", "-")}'
extra_layers = [ template_layer(name) for name in extra_layers ]
svg.children = [ view, *extra_layers, gn.utils.Tag('g', layers, inkscape__label='Preview', sodipodi__insensitive='true',