def __init__(self, coord, diameter, drill, board=None, layer_pair=('F.Cu', 'B.Cu'), via_type='through'): self._obj = pcbnew.VIA(board and board.native_obj) # define the layers used if board: self._obj.SetLayerPair(board.get_layer(layer_pair[0]), board.get_layer(layer_pair[1])) else: self._obj.SetLayerPair(layer.get_std_layer(layer_pair[0]), layer.get_std_layer(layer_pair[1])) # define the position self._obj.SetPosition(coord.native_obj) # define the via type if via_type.lower() == 'through': self._obj.SetViaType(pcbnew.VIA_THROUGH) elif via_type.lower() == 'blind_buried': self._obj.SetViaType(pcbnew.VIA_BLIND_BURIED) elif via_type.lower() == 'microvia': self._obj.SetViaType(pcbnew.VIA_MICROVIA) else: raise Exception('Unimplemented via type.') # Define overall via diameter (drill + annular ring) self.diameter = diameter # Define the drill size self.drill = drill
def __init__(self, coord, layer_pair, size, drill, board=None): self._via = pcbnew.VIA(board and board.native_obj) self._via.SetViaType(via_type) self._via.SetWidth(int(size * units.DEFAULT_UNIT_IUS)) coord_point = Point.build_from(coord) self._via.SetEnd(coord_point.native_obj) self._via.SetStart(coord_point.native_obj) if board: self._via.SetLayerPair(board.get_layer(layer_pair[0]), board.get_layer(layer_pair[1])) else: self._via.SetLayerPair(layer.get_std_layer(layer_pair[0]), layer.get_std_layer(layer_pair[1])) self._via.SetDrill(int(drill * units.DEFAULT_UNIT_IUS))
def __init__(self, coord, layer_pair, diameter, drill, board=None): self._obj = pcbnew.VIA(board and board.native_obj) self.diameter = diameter coord_point = Point.build_from(coord) self._obj.SetEnd(coord_point.native_obj) self._obj.SetStart(coord_point.native_obj) if board: self._obj.SetLayerPair(board.get_layer(layer_pair[0]), board.get_layer(layer_pair[1])) else: self._obj.SetLayerPair(layer.get_std_layer(layer_pair[0]), layer.get_std_layer(layer_pair[1])) self.drill = drill
def __init__(self, coord, layer_pair, size, drill, board=None): self._via = pcbnew.VIA(board and board.native_obj) self._via.SetWidth(int(size * units.DEFAULT_UNIT_IUS)) coord_point = Point.build_from(coord) self._via.SetEnd(coord_point.native_obj) self._via.SetStart(coord_point.native_obj) if board: self._via.SetLayerPair(board.get_layer(layer_pair[0]), board.get_layer(layer_pair[1])) else: self._via.SetLayerPair(layer.get_std_layer(layer_pair[0]), layer.get_std_layer(layer_pair[1])) self._via.SetDrill(int(drill * units.DEFAULT_UNIT_IUS))
def __init__(self, width, start, end, layer="F.Cu", board=None): self._track = pcbnew.TRACK(board and board.native_obj) self._track.SetWidth(int(width * units.DEFAULT_UNIT_IUS)) if board: self._track.SetLayer(board.get_layer(layer)) else: self._track.SetLayer(pcbnew_layer.get_std_layer(layer)) self._track.SetStart(Point.native_from(start)) self._track.SetEnd(Point.native_from(end))
def __init__(self, width, start, end, layer='F.Cu', board=None): self._track = pcbnew.TRACK(board and board.native_obj) self._track.SetWidth(int(width * units.DEFAULT_UNIT_IUS)) if board: self._track.SetLayer(board.get_layer(layer)) else: self._track.SetLayer(pcbnew_layer.get_std_layer(layer)) self._track.SetStart(Point.native_from(start)) self._track.SetEnd(Point.native_from(end))
def top_layer(self, value): brd = self._obj.GetBoard() if brd: self._obj.SetTopLayer(brd.GetLayerID(value)) else: self._obj.SetTopLayer(pcbnew_layer.get_std_layer(value))