def Render(self, canvas, obj): if len(self.attributes) < 3: return start = Canvas.Point(canvas.xmm2px(float(self.Attribute(0))), canvas.ymm2px(-float(self.Attribute(1)))) end = Canvas.Point( canvas.xmm2px(float(self.Attribute(0)) + float(self.Attribute(2))), canvas.ymm2px(-float(self.Attribute(1)))) if self.Attribute(len(self.attributes) - 1) == 'F': circle = Canvas.Circle(start, end, 2, True) else: circle = Canvas.Circle(start, end, 2, False) canvas.Draw(circle, ["Drawing"])
def Render(self, canvas, obj): if len(self.attributes) < 6: return width = 2 length = canvas.mm2px(float(self.Attribute(4))) if self.Attribute(5) == 'U': angle = 3 * math.pi / 2 text_angle = angle text_dx = -10 text_dy = -length / 2 elif self.Attribute(5) == 'D': angle = math.pi / 2 text_angle = 3 * math.pi / 2 text_dx = -10 text_dy = length / 2 elif self.Attribute(5) == 'R': angle = 0 text_angle = 0 text_dx = length / 2 text_dy = -10 else: angle = math.pi text_angle = 0 text_dx = -length / 2 text_dy = -10 start = Canvas.Point(canvas.xmm2px(float(self.Attribute(2))), canvas.ymm2px(-float(self.Attribute(3)))) end = Canvas.Point(canvas.xmm2px(start.x + length * math.cos(angle)), canvas.ymm2px(start.y + length * math.sin(angle))) line = Canvas.Line(start, end, width) canvas.Draw(line, ["Drawing"]) font = Canvas.Font( Canvas.Point(canvas.xmm2px(float(self.Attribute(6))), canvas.ymm2px(float(self.Attribute(7)))), 2) text = Canvas.Text(self.Attribute(1)) text.anchor_x = 'center' text.anchor_y = '' text.at = Canvas.Position(canvas.xmm2px(start.x + text_dx), canvas.ymm2px(start.y + text_dy), text_angle) canvas.SetFont(font) canvas.Draw(text, ["Label"]) circle = Canvas.Circle( start, Canvas.Point(canvas.xmm2px(start.x + 10), canvas.ymm2px(start.y)), 1, False) canvas.Draw(circle, ["Label"])
def Render(self, canvas, obj): circle = Canvas.Circle() super(KicadFPCircle, self).Render(canvas, circle) canvas.Draw(circle)