예제 #1
0
    def render_scale_diagram(self, render=None, px_per_mm=2):
        fork_path = self._fork_path()

        if render is None:
            inf = array([self.left_cs.tube_top[0], 0])
            sup = array([fork_path[-1][0], self.head_tube.tube_top[1]])
            r = Render(inf, sup, px_per_mm)
        else:
            r = render

        for tube in (self.seat_tube, self.top_tube, self.head_tube,
                     self.down_tube):
            r.draw_tube(tube)

        for mitre in (self.tt_ht, self.dt_ht, self.dt_st, self.tt_st):
            r.draw_mitre(mitre)

        # Draw the lower stack
        path = self._lower_stack_path()
        r.polyline(self._lower_stack_path(), "black")

        # The fork
        r.polyline(fork_path, "darkblue")

        # And the centreline
        start = array([self.right_drop.end[0], self.bb_drop])
        end = array([fork_path[-1][0], self.bb_drop])
        r.polyline((start, end), "black")

        # The chainstays
        r.draw_tube(self.right_cs)
        r.draw_tube(self.right_ss)

        # The CS dropout
        do_top = self.right_drop.end + \
          self.right_ss.vecn * self.right_drop.ss_length
        r.polyline((self.right_drop.start, self.right_drop.end, do_top),
                   "purple")

        # The wheels
        r.draw_wheel(self.right_cs.top + self.right_drop.vec,
                     self.wheel_diameter, self.tyre_height)
        r.draw_wheel(fork_path[1], self.wheel_diameter, self.tyre_height)

        # And finally the BB shell
        r.circle(array([0, 0]), self.bb_tube.radius, "brown")
        r.draw_point(self.dt_bb_mitre_corner[INSIDE], "red")
        r.draw_point(self.dt_bb_mitre_corner[OUTSIDE], "cyan")

        return r
예제 #2
0
    def render_scale_diagram(self, px_per_mm=2):
        f = self.frame

        left_cs = f.left_cs.transform(self.projection)
        right_cs = f.right_cs.transform(self.projection)
        bb = f.bb_tube.transform(self.projection)

        inf = left_cs.top
        sup = bb.top

        r = Render(inf, sup, px_per_mm)

        r.draw_tube(bb)
        r.draw_tube(left_cs)
        r.draw_tube(right_cs)

        self._draw_tyre(r)
        self._draw_dropouts(r)
        self._draw_chainrings(r)
        r.draw_mitre(self.cs_bb)

        return r