def traces(self): t = [] for p1, p2 in zip(self.points[:-1], self.points[1:]): d = sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2) if p2 != self.points[-1]: d += self.width/2 a = atan2(p2.y - p1.y, p2.x - p1.x) r = s2d.rectangle(0, d, -self.width/2, self.width/2) t.append(s2d.move(s2d.rotate(r, degrees(a)), p1.x, p1.y)) return reduce(operator.add, t)
def cutout(self): if self._cutout is not None: return self._cutout return s2d.rectangle(self.x0, self.x0 + self.width, self.y0, self.y0 + self.height)
t = [] for p1, p2 in zip(self.points[:-1], self.points[1:]): d = sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2) if p2 != self.points[-1]: d += self.width/2 a = atan2(p2.y - p1.y, p2.x - p1.x) r = s2d.rectangle(0, d, -self.width/2, self.width/2) t.append(s2d.move(s2d.rotate(r, degrees(a)), p1.x, p1.y)) return reduce(operator.add, t) ################################################################################ # Discrete passive components ################################################################################ _pad_1206 = s2d.rectangle(-0.032, 0.032, -0.034, 0.034) class R_1206(Component): ''' 1206 Resistor ''' pins = [Pin(-0.06, 0, _pad_1206), Pin(0.06, 0, _pad_1206)] prefix = 'R' class C_1206(Component): ''' 1206 Capacitor ''' pins = [Pin(-0.06, 0, _pad_1206), Pin(0.06, 0, _pad_1206)] prefix = 'C' _pad_SJ = s2d.rectangle(-0.02, 0.02, -0.03, 0.03) class SJ(Component):
t = [] for p1, p2 in zip(self.points[:-1], self.points[1:]): d = sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2) if p2 != self.points[-1]: d += self.width/2 a = atan2(p2.y - p1.y, p2.x - p1.x) r = s2d.rectangle(0, d, -self.width/2, self.width/2) t.append(s2d.move(s2d.rotate(r, degrees(a)), p1.x, p1.y)) return reduce(operator.add, t) ################################################################################ # Discrete passive components ################################################################################ _pad_1206 = s2d.rectangle(-0.032, 0.032, -0.034, 0.034) class R_1206(Component): ''' 1206 Resistor ''' pins = [Pin(-0.06, 0, _pad_1206), Pin(0.06, 0, _pad_1206)] prefix = 'R' class C_1206(Component): ''' 1206 Capacitor ''' pins = [Pin(-0.06, 0, _pad_1206), Pin(0.06, 0, _pad_1206)] prefix = 'C' ################################################################################
def cube(x0, x1, y0, y1, z0, z1): return extrusion(s2d.rectangle(x0, x1, y0, y1), z0, z1)