def write_converter(labels, canvas, t=I): width = GS t = I.move((0.5 * width, 0.0)).transform(t) Square(I.scale(1.5, 1.5).transform(t)).write(canvas) Line(((-0.75, -0.75), (0.75, 0.75)), t).write(canvas) canvas.text(labels[0], t.transform_point((-0.35, 0.35))) canvas.text(labels[1], t.transform_point((0.35, -0.35))) return t.move(t.transform_vector((0.5 * width, 0.0)))
def write_power_supply_symbol(self, canvas = None, t = I, label = ''): if canvas is not None: Square(t.r_scale(2.0, 1.0)).write(canvas) canvas.text(self.type, t.transform_point((0.0, -0.5)), 's') canvas.text(label, t.transform_point((0.0, 0.5)), 'n') canvas.text('PWR', t.transform_point((-1.0, 0.0)), 'nw', 'small') canvas.text('GND', t.transform_point((1.0, 0.0)), 'ne', 'small') return t.r_move(-1.0, 0.0), t.r_move(1.0, 0.0)
def write_temp_sensor(canvas, t = I): width = GS t = I.move((0.5 * width, 0.0)).transform(t) Square(I.scale(RESISTOR_RATIO, 1.0).move((0.0, 0.0)).transform(t)).write(canvas) Line(((0.4, 0.4), (-0.4, -0.4), (-0.7, -0.4)), t).write(canvas) # Square(I.scale(1.5, 1.5).transform(t)).write(canvas) canvas.text('$\\vartheta$', t.transform_point((-0.55, -0.4)), position='n') return I.move((0.2 * GS, 0.0)).transform(t)
def write_coil(canvas = None, t = I, labels = None): if canvas is not None: WH_RATIO = 3.0 / 4.0 Square(t.r_scale(WH_RATIO, 1.0)).write(canvas) Line([(-0.5, 0.0), (-0.5 * WH_RATIO, 0.0)], t).write(canvas) Line([(0.5, 0.0), (0.5 * WH_RATIO, 0.0)], t).write(canvas) if labels is not None: canvas.text(labels[0], t.transform_point((-0.5 * WH_RATIO, 0.0)), 'nw', 'small') canvas.text(labels[1], t.transform_point((0.5 * WH_RATIO, 0.0)), 'ne', 'small') return t.r_move(-0.5, 0.0), t.r_move(0.5, 0.0)
def write_radiator(canvas, transf=I): if canvas is not None: symbol = Square(I.scale(2.0, 3.0).transform(transf)) symbol.write(canvas) return transf.r_move(-1.0, 0.0), transf.r_move(1.0, 0.0)
def write_heater(canvas, transf=I): if canvas is not None: t = I.scale(2.0, 3.0).transform(transf) symbol = Square(t) symbol.write(canvas) return transf.r_move(-1.0, 0.0), transf.r_move(1.0, 0.0)
def draw_rect(self, size, line='NORMAL', style='normal'): self.canvas.set_line_width(LINE_WIDTHS[line]) self.set_style(style) Square(self.t.r_scale(size[0], size[1])).write(self.canvas)
def write_radiator(canvas, transf=I): symbol = Square(I.scale(3.0, 4.0).transform(transf)) symbol.write(canvas) return transf.move(transf.transform_vector((4.0, 0.0)))
def write_heater(canvas, transf=I): t = I.scale(3.0, 4.0).transform(transf) symbol = Square(t) symbol.write(canvas) return transf.move(transf.transform_vector((3.0, 0.0)))