def __update(self): if self.__pins_cache: return assert self.__pin_count % 2 == 0 edge_count = self.__pin_count // 2 pin_edge = self.__pin_space * (edge_count - 1) pin_edge_center_delta = pin_edge / 2 for i in range(self.__pin_count): dx = (i % edge_count) * self.__pin_space if i < self.__pin_count / 2: x = -self.__pin_width / 2 y = pin_edge_center_delta - dx else: x = self.__pin_width / 2 y = -pin_edge_center_delta + dx center = Point2(x, y) newpad = Pad(self, "%s" % (i + 1), center, 0, self.__pad_size, self.__pad_size, th_diam=500) self.__pins_cache.append(newpad)
def __update_pads(self) -> None: if self.__pads: return v = Vec2.from_polar(0, self.pin_d) td = 1 if self.body_type in (Passive2BodyType.TH_AXIAL, Passive2BodyType.TH_RADIAL) else 0 if td: y = x = self.pin_corner_vec.x * 2 else: y = self.pin_corner_vec.y * 2 x = self.pin_corner_vec.x * 2 self.__pads = [ Pad(self, "1", v, 0, y, x, td, self.side), Pad(self, "2", -v, 0, y, x, td, self.side), ]
def __update(self) -> None: if self.__pins_cache: return edge_count = self.__pin_count pin_edge = self.__pin_space * (edge_count - 1) pin_edge_center_delta = pin_edge / 2 for i in range(self.__pin_count): dx = (i % edge_count) * self.__pin_space x = 0 y = pin_edge_center_delta - dx center = Point2(x, y) newpad = Pad(self, "%s" % (i + 1), center, 0, self.__pad_size, self.__pad_size, th_diam=500) self.__pins_cache.append(newpad)
def setUp(self): self.p = p = Project() l = Layer("foo", []) p.stackup.add_layer(l) self.l1 = Trace(Point2(-5, 0), Point2(-1, 0), thickness=1, layer=l) self.l2 = Trace(Point2(1, 0), Point2(5, 0), thickness=1, layer=l) p.artwork.merge_artwork(self.l1) p.artwork.merge_artwork(self.l2) self.assertIsNotNone(self.l1.net) self.assertIsNotNone(self.l2.net) self.assertNotEqual(self.l1.net, self.l2.net) class Dummy(Component): pass cmp = Dummy(Point2(0,0), 0, SIDE.Top, side_layer_oracle=p) self.pad = Pad(cmp, 0, Point2(0, 0), 0, 3, 3, th_diam=1)
def __update(self): if self.__pins_cache: return w = self.dim_1_body h = self.dim_2_body pads = [] d_2_pc = self.dim_2_pincenter / 2 d_1_pc = self.dim_1_pincenter / 2 overall_pin_no = 0 for i, side_pin_count in enumerate(self.side_pins): offset = (side_pin_count - 1) / 2 * self.pin_spacing pad_theta = math.pi / 2 * i if i == 0: start = Point2(-d_2_pc, offset) step = Vec2(0, -self.pin_spacing) elif i == 1: start = Point2(-offset, -d_1_pc) step = Vec2(self.pin_spacing, 0) elif i == 2: start = Point2(d_2_pc, -offset) step = Vec2(0, self.pin_spacing) elif i == 3: start = Point2(offset, d_1_pc) step = Vec2(-self.pin_spacing, 0) for pin_no in range(side_pin_count): pin_center = start + step * pin_no pads.append( Pad(self, "%s" % (overall_pin_no + 1), pin_center, pad_theta, self.pin_spacing / 2, self.pin_contact_length, side=self.side)) overall_pin_no += 1 self.__pins_cache = pads