Commits

saar drimer committed 2907d5e

create correct masks for paths without fill

Comments (0)

Files changed (2)

  
     doc = et.ElementTree(board)
 
-    #xpath_expr = "//g[@inkscape:label='%s']//g[@inkscape:label='%s']"
-
-#    board_svg_layers = svg.create_svg_layers(board, board_stackup, surface_layers, transform)
     board_svg_layers = svg.create_svg_layers(cfg, board, transform)
 
-
     # TODO: add support for internal layers
 
     # add outline to dimensions layer
                     path_element.set('style', path_style)
                 if gerber_lp is not None:
                     path_element.set('gerber_lp', gerber_lp)
-                
+
                 # add extra attributes if they exist
                 for extra_attrib in extra_attributes:
                     ea = routes[pcb_layer][route].get(extra_attrib)
                 if stroke_width_def is not None:
                     stroke_width = float(stroke_width_def.group('s'))
                 else:
-                    stroke_width = None
+                    stroke_width = 0
 
                 if stroke_width > 0:
                     fill = 'none'
                     mask_element = et.SubElement(routing_mask_group, 'path',
                                                  id="%s" % pcb_layer,
                                                  type="mask_shape",
-                                                 style=mask_style_template % (fill, pour_buffer * 2),
+                                                 style=mask_style_template % (fill, stroke_width + pour_buffer * 2),
                                                  d=path)
      
                     # set 'gerber_lp' attribute is it's not empty
         for pour in pours.get(pcb_layer) or []:
             pour_type = pour.get('type')
 
-            if pour_type.lower() in ['board_outline', 'outline']:
+            if pour_type.lower() in ['board_outline', 'outline', 'layer']:
 
                 pour_path = et.SubElement(mask_group, 'path',
                                           id="copper_pour",
     paths = top_copper_layer.xpath('//svg:path[starts-with(@inkscape:label, "%s")]' % cfg['via_prefix'], namespaces={'inkscape':cfg['namespace']['inkscape'],'svg':cfg['namespace']['svg']})
     for i, path in enumerate(paths):
         # get via type
-        via_type = path.get('{'+NSMAP['inkscape']+'}label')
+        via_type = path.get('{'+cfg['namespace']['inkscape']+'}label')
         # check if via is specified, or 'default' is specified:
-        via_part_name = via_type[len(VIA_PREFIX):]
+        via_part_name = via_type[len(cfg['via_prefix']):]
         via_part_name = via_part_name.strip(' ') # remove leading spaces if there any
         possible_answers = ['', 'default', 'default_via', 'default via']
         if via_part_name.lower() in possible_answers:
-            via_type = VIA_PREFIX + board_cfg['vias'].get('default_via') or 'VIA'
+            via_type = cfg['via_prefix'] + cfg['board']['vias'].get('default_via') or 'VIA'
         # get location of via
-        location = Point(path.get('{'+NSMAP['sodipodi']+'}cx'), path.get('{'+NSMAP['sodipodi']+'}cy'))
+        location = Point(path.get('{'+cfg['namespace']['sodipodi']+'}cx'), 
+                         path.get('{'+cfg['namespace']['sodipodi']+'}cy'))
         location.y = -location.y
         transform = path.get('transform')
         if transform is not None: 
             location.x += float(tr.group('x'))
             location.y -= float(tr.group('y')) 
         # get radius of via
-        radius_x = path.get('{'+NSMAP['sodipodi']+'}rx')
-        radius_y = path.get('{'+NSMAP['sodipodi']+'}ry')
+        radius_x = path.get('{'+cfg['namespace']['sodipodi']+'}rx')
+        radius_y = path.get('{'+cfg['namespace']['sodipodi']+'}ry')
         vias[str(i)] = {"via_type": via_type, 
                         "location": [str(location.x), str(location.y)], 
                         "radius_x": radius_x,