"""Auto-converted from PSU-cover-MK3.scad — cadbuildr.foundation port.""" from cadbuildr.foundation import ( Part, Sketch, Point, Square, Rectangle, Circle, RegularPolygon, RectangleRounded, Extrusion, Lathe, Hole, Cylinder, Box, Sphere, Cone, show, ) class PsuCoverMk3(Part): def __init__(self): super().__init__() sketch = self._sketch = Sketch(self.xy()) # === PSU_COVER base === self._add_box(0 + 95/2, 0 + 65/2, -0.46 + 54.25/2, 95, 65, 54.25) # back pillar 1 self._add_box(0 + 13.5/2, 0 + 65/2, -3.5 + 5/2, 13.5, 65, 5) # back pillar top self._add_box(-1.6 + 5/2, 1 + 64/2, 51.5 + 3/2, 5, 64, 3) # back pillar 2 self._add_box(59.5 + 14/2, 0 + 65/2, -3.5 + 5/2, 14, 65, 5) # base for bracket self._add_box(95 + 6/2, 0 + 65/2, -0.46 + 54.25/2, 6, 65, 54.25) # nipple self._add_box(-2 + 2/2, 40.8 + 3/2, 19 + 15/2, 2, 3, 15) # frame skirts self._add_box(-1.6 + 1.65/2, 0 + 65/2, 0 + 2/2, 1.65, 65, 2) self._add_box(-1.6 + 1.65/2, 0 + 30/2, 0 + 53.78/2, 1.65, 30, 53.78) self._add_box(-1.6 + 1.65/2, 0 + 65/2, 51.32 + 2.46/2, 1.65, 65, 2.46) # main interior cutout self._add_box(3 + 89.02/2, 3 + 65.02/2, 2 + 49.32/2, 89.02, 65.02, 49.32, cut=True) # insert cutout self._add_box(-3 + 100/2, 33.6 + 16.5/2, 2 + 49.3/2, 100, 16.5, 49.3, cut=True) self._add_box(-3 + 10/2, 18 + 100/2, 2 + 17/2, 10, 100, 17, cut=True) self._add_box(87 + 10/2, 17.3 + 100/2, 2 + 49.3/2, 10, 100, 49.3, cut=True) # socket cutout self._add_box(5.5 + 48 + 27.5/2, 0.5 + 1.5 + 32.9/2, 40 + 30/2, 27.5, 32.9, 30, cut=True) # switch cutout self._add_box(5.5 + 1 + 12.5/2, 0.5 + 6 + 20/2, 40 + 44 + 30/2, 12.5, 20, 30, cut=True) # mount holes self._add_cyl(6, 54, -10, 2, 50, cut=True) self._add_cyl(66.8, 57.5, -10, 2, 50, cut=True) # fan slot (row of 10 cylinders approx as boxes) for i in range(10): self._add_box(20 + i + 3.5/2, 6.8 + 3.5, -10 + 50/2, 3.5, 3.5, 50, cut=True) # === PSU_Y_REINFORCEMENT === self._add_box(59.5 + 33/2, 0 + 6/2, -18 + 19/2, 33, 6, 19) self._add_box(73.5 + 5/2, 5 + 16/2, -18 + 19/2, 5, 16, 19) # cleanup cut self._add_box(-5 + 150/2, -9 + 10/2, -30 + 100/2, 150, 10, 100, cut=True) # upper_part add-ons self._add_box(30 + 15/2, 3.5 + 11/2, 49.5 + 2.5/2, 15, 11, 2.5) self._add_box(45 + 15/2, 3.5 + 11/2, 1 + 2.5/2, 15, 11, 2.5) # m3 screws self._add_cyl(37, 9, 39, 1.5, 12, cut=True) self._add_cyl(14.5, 8, 25, 1.5, 12, cut=True) self._add_cyl(85.5, 8, 25, 1.5, 12, cut=True) self._add_cyl(52, 9, 14.5, 1.5, 12, 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 = PsuCoverMk3() show(part)