def __init__(self, start, end, layer='F.SilkS', width=0.15, board=None): line = pcbnew.DRAWSEGMENT(board and board.native_obj) line.SetShape(pcbnew.S_SEGMENT) line.SetStart(Point.native_from(start)) line.SetEnd(Point.native_from(end)) line.SetLayer(pcbnew_layer.get_board_layer(board, layer)) line.SetWidth(int(width * units.DEFAULT_UNIT_IUS)) self._obj = line
def __init__(self, center, radius, layer='F.SilkS', width=0.15, board=None): circle = pcbnew.DRAWSEGMENT(board and board.native_obj) circle.SetShape(pcbnew.S_CIRCLE) circle.SetCenter(Point.native_from(center)) start_coord = Point.native_from( (center[0], center[1] + radius)) circle.SetArcStart(start_coord) circle.SetLayer(pcbnew_layer.get_board_layer(board, layer)) circle.SetWidth(int(width * units.DEFAULT_UNIT_IUS)) self._obj = circle
def __init__(self, center, radius, start_angle, stop_angle, layer='F.SilkS', width=0.15, board=None): start_coord = radius * cmath.exp(math.radians(start_angle - 90) * 1j) start_coord = Point.native_from((start_coord.real, start_coord.imag)) angle = stop_angle - start_angle arc = pcbnew.DRAWSEGMENT(board and board.native_obj) arc.SetShape(pcbnew.S_ARC) arc.SetCenter(Point.native_from(center)) arc.SetArcStart(start_coord) arc.SetAngle(angle * 10) arc.SetLayer(pcbnew_layer.get_board_layer(board, layer)) arc.SetWidth(int(width * units.DEFAULT_UNIT_IUS)) self._obj = arc