"""Auto-converted from z-axis-bottom.scad — cadbuildr.foundation port.""" from cadbuildr.foundation import ( Part, Sketch, Point, Square, Rectangle, Circle, RegularPolygon, RectangleRounded, Extrusion, Lathe, Hole, Cylinder, Box, Sphere, Cone, show, ) MX = 25 + 4.3 # motor centre X MY = 20 # motor centre Y class ZAxisBottom(Part): def __init__(self): super().__init__() sketch = self._sketch = Sketch(self.xy()) # === z_bottom_base() === # plate touching base (right version, mirrors handled by approx) self._add_box(0 + 7.5/2, -1.5 + 49/2, 0 + 36/2, 7.5, 49, 36) self._add_box(0 + 30/2, -5 + 3.7/2, 0 + 22/2, 30, 3.7, 22) self._add_box(0 + 30/2, 42 + 5.5/2, 0 + 22/2, 30, 5.5, 22) self._add_box(0 + 50/2, -5 + 52.5/2, 0 + 7/2, 50, 52.5, 7) # === z_bottom_holes() (cuts) === # Frame screw holes along X self._add_box(-1 + 20/2, 10, 12, 20, 1.6*2, 1.6*2, cut=True) self._add_box(-1 + 20/2, 30, 12, 20, 1.6*2, 1.6*2, cut=True) self._add_box(-1 + 20/2, 20, 32, 20, 1.6*2, 1.6*2, cut=True) # Screw head holes self._add_box(4 + 20/2, 10, 12, 20, 3.1*2, 3.1*2, cut=True) self._add_box(4 + 20/2, 30, 12, 20, 3.1*2, 3.1*2, cut=True) self._add_box(4 + 20/2, 20, 32, 20, 3.1*2, 3.1*2, cut=True) # Z rod holder self._add_cyl(MX, 3, -0.1, 4.05, 5.6, cut=True) self._add_cone(MX, 3, -2.1, 6, 4, 2.6) # chamfer self._add_box(MX - 1 + 2/2, 3 + 10/2, 0.5 + 8/2, 2, 10, 8, cut=True) # Motor mounting screws (4 corners of 31x31mm NEMA17 pattern) for dx, dy in [(15.5, 15.5), (15.5, -15.5), (-15.5, 15.5), (-15.5, -15.5)]: self._add_cyl(MX + dx, MY + dy, -2, 1.65, 20, cut=True) self._add_cone(MX + dx, MY + dy, -0.5, 4.5, 3.2, 2) # countersink # Motor centre opening self._add_cyl(MX, MY, -1, 11.2, 20, cut=True) self._add_cone(MX, MY, 0, 12, 11.2, 2) # === corner/fancy shape approx (large cuts to shape outer profile) === self._add_box(-38 + 30/2, -10 + 60/2, -2 + 30/2, 30, 60, 30, cut=True) self._add_box(47 + 30/2, -10 + 60/2, -2 + 30/2, 30, 60, 30, cut=True) self._add_box(8 + 30/2, 0 + 50/2, 38 + 30/2, 30, 50, 30, cut=True) # left variant: mirror offset (placed adjacent, approx) self._add_box(70 + 7.5/2, -1.5 + 49/2, 0 + 36/2, 7.5, 49, 36) self._add_box(70 + 30/2, -5 + 3.7/2, 0 + 22/2, 30, 3.7, 22) self._add_box(70 + 50/2, -5 + 52.5/2, 0 + 7/2, 50, 52.5, 7) 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 = ZAxisBottom() show(part)