"""Auto-converted from x-end-idler.scad — cadbuildr.foundation port.""" from cadbuildr.foundation import ( Part, Sketch, Point, Square, Rectangle, Circle, RegularPolygon, RectangleRounded, Extrusion, Lathe, Hole, Cylinder, Box, Sphere, Cone, show, ) rod_distance = 45 bearing_diameter = 14.95 thinwall = 3 bearing_size = bearing_diameter + 2 * thinwall height = 58 class XEndIdler(Part): def __init__(self): super().__init__() sketch = self._sketch = Sketch(self.xy()) # === x_end_base() === self._add_box(-15, -9, height/2, 17, 39, height) self._add_box(-8 + 5/2, -28.5 + 1/2, 13.5/2, 5, 1, 13.5) # bearing holder self._add_box(-2 - bearing_size/4, 0, 29, 4 + bearing_size/2, bearing_size, 58) self._add_cyl(0, 0, 29, bearing_size/2, 58) # nut trap self._add_cyl(0, -17, 0, 12.5, 13.5) self._add_cyl(0, -17, 13, 12.5, 3) # === x_end_idler extra base — side wall === self._add_box(-6.5 + 1/2, -21 + 12.5/2, 13.5 + 42/2, 1, 12.5, 42) # waste pockets (cuts) self._add_cyl(-15, -1, 6, 5, 5, cut=True) self._add_cyl(-15, -1, 51, 5, 5, cut=True) # bearing stop ring self._add_cyl(0, 0, 57, 8, 1) self._add_cyl(0, 0, 56.5, 7, 2, cut=True) # bearing spacer self._add_cyl(0, 0, 26, 8, 6) self._add_cyl(0, 0, 25, 7.55, 8, cut=True) # === x_end_holes() cuts === # bearing bore self._add_cyl(0, 0, 31, bearing_diameter/2 + 0.2, 62, cut=True) # belt slot self._add_box(-15, -10, 30, 10, 46, 28, cut=True) # bottom rod self._add_cyl(-15, -41, 6, 7.8/2, 50, cut=True) # top rod self._add_cyl(-15, -41.5, rod_distance + 6, 7.8/2, 50, cut=True) # TR nut hole self._add_cyl(0, -17, -1, 6.7, 14.51, cut=True) # Pulley screw (along X, approx as horizontal cyl via box) self._add_box(0 + 80/2, -19 + 3.5, 30.25, 80, 1.55*2, 1.55*2, cut=True) # pulley side cut self._add_box(-9 + 9/2, -19 + 3.5, 30.25, 9, 9.5*2, 9.5*2, cut=True) self._add_box(-19 + 10/2, -35 + 20/2, 21.25 + 18/2, 10, 20, 18, cut=True) # outer corner cuts self._add_box(-25 + 30/2, 37 + 20/2, 49 + 20/2, 30, 20, 20, cut=True) self._add_box(-47 + 20/2, -40 + 80/2, 60 + 20/2, 20, 80, 20, cut=True) def _pt(self, x, y): return Point(self._sketch, x, y) def _add_box(self, x, y, z, w, d, h, cut=False): self.add_operation(Box(self._pt(x, y), w, d, h, cut=cut)) def _add_cyl(self, x, y, z, radius, height, cut=False): self.add_operation(Cylinder(self._pt(x, y), radius, height, cut=cut)) def _add_cone(self, x, y, z, r1, r2, height): self.add_operation(Cone(self._pt(x, y), r1, r2, height)) def _add_sphere(self, x, y, z, radius, cut=False): self.add_operation(Sphere(self._pt(x, y), radius, cut=cut)) def _add_extrusion(self, shape, end, start=0, cut=False): self.add_operation(Extrusion(shape, end=end, start=start, cut=cut)) part = XEndIdler() show(part)