def _placeShapes(self): """ """ mirror = False try: shapes_dict = self._module_dict['shapes'] except: return for sheet in ['copper', 'soldermask', 'solderpaste', 'silkscreen']: try: shapes = shapes_dict[sheet] except KeyError: continue there_are_pours = {} shape_groups = {} for pcb_layer in utils.getSurfaceLayers(): there_are_pours[pcb_layer] = utils.checkForPoursInLayer( pcb_layer) shape_groups[pcb_layer] = et.SubElement( self._layers[pcb_layer][sheet]['layer'], 'g') shape_groups[pcb_layer].set( '{' + config.cfg['ns']['pcbmode'] + '}type', 'module-shapes') for shape_dict in shapes: pcb_layers = shape_dict.get('layers') or ['top'] for pcb_layer in pcb_layers: # Shapes placed on the bottom layer are not mirrored # unless they are text, in which case, it's the # expected behaviour and so it is mirrored by default # unless otherwise instructed. try: shape_mirror = shape_dict.get['mirror'] except: if shape_dict['type'] == 'text': shape_mirror = True else: shape_mirror = False if (pcb_layer == 'bottom') and (shape_mirror != False): shape_dict['location'][0] *= -1 mirror = True else: mirror = False shape = Shape(shape_dict) style = Style(shape_dict, sheet) shape.setStyle(style) place.placeShape(shape, shape_groups[pcb_layer], mirror) # Place mask for pour if copper shape if (sheet == 'copper') and (there_are_pours[pcb_layer] == True): location = shape.getLocation() transform = "translate(%s,%s)" % (location.x, location.y) mask_group = et.SubElement(self._masks[pcb_layer], 'g') self._placeMask(svg_layer=mask_group, shape=shape, kind='pad', original=False, mirror=mirror)
def _placeShapes(self): """ """ mirror = False try: shapes_dict = self._module_dict['shapes'] except: return for sheet in ['copper','soldermask','solderpaste','silkscreen']: try: shapes = shapes_dict[sheet] except KeyError: continue there_are_pours = {} shape_groups = {} for pcb_layer in utils.getSurfaceLayers(): there_are_pours[pcb_layer] = utils.checkForPoursInLayer(pcb_layer) shape_groups[pcb_layer] = et.SubElement(self._layers[pcb_layer][sheet]['layer'], 'g') shape_groups[pcb_layer].set('{'+config.cfg['ns']['pcbmode']+'}type', 'module-shapes') for shape_dict in shapes: pcb_layers = shape_dict.get('layers') or ['top'] for pcb_layer in pcb_layers: # Shapes placed on the bottom layer are not mirrored # unless they are text, in which case, it's the # expected behaviour and so it is mirrored by default # unless otherwise instructed. try: shape_mirror = shape_dict.get['mirror'] except: if shape_dict['type'] == 'text': shape_mirror = True else: shape_mirror = False if (pcb_layer == 'bottom') and (shape_mirror != False): mirror = True else: mirror = False shape = Shape(shape_dict) style = Style(shape_dict, sheet) shape.setStyle(style) place.placeShape(shape, shape_groups[pcb_layer], mirror) # Place mask for pour if copper shape if (sheet == 'copper') and (there_are_pours[pcb_layer] == True): location = shape.getLocation() transform = "translate(%s,%s)" % (location.x, location.y) mask_group = et.SubElement(self._masks[pcb_layer], 'g') #id="routing_masks") #transform=transform) self._placeMask(svg_layer=mask_group, shape=shape, kind='pad', original=False, mirror=False)