Exemple #1
0
    def updated(self, ep):
        if self.p1_point.is_set:
            if self.p_bottom_corner.is_set:
                v = (self.p_bottom_corner.get() - self.p1_point.get())
                mag = v.mag()
                v = v.norm()
                self._cmodel.theta = v.angle()

                self._model.pin_spacing = mag / (self._model.side1_pins - 1)

            self.v_base = Vec2.from_polar(self._cmodel.theta, 1)
            self.v_vert = Vec2(-self.v_base.y, self.v_base.x).norm()

            p_edge_center = self.v_base * self._model.pin_spacing * (
                self._model.side1_pins - 1) / 2

            if self.p_side_3_1.is_set:
                dv = self.p_side_3_1.get() - self.p1_point.get()

                v, _ = project_point_line(dv, Point2(0, 0), self.v_vert, False)
                self._model.dim_2_pincenter = v.mag()

            self._cmodel.center = self.v_vert * self._model.dim_2_pincenter / 2 + p_edge_center + self.p1_point.get(
            )

            if self.p_side_2_1.is_set:
                v, _ = project_point_line(
                    self.p_side_2_1.get() - self._cmodel.center, Point2(0, 0),
                    self.v_base, False)

                self._model.dim_1_pincenter = v.mag() * 2
Exemple #2
0
    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),
        ]
Exemple #3
0
 def corner_offset():
     mag = self._model.pin_spacing * (self._model.side1_pins - 1)
     return Vec2.from_polar(self._cmodel.theta, mag)
Exemple #4
0
 def other_point():
     return Vec2.from_polar(self._cmodel.theta, self.model.pin_d)