"""Auto-converted from lcd-supports.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 LcdSupports(Part): def __init__(self): super().__init__() sketch = self._sketch = Sketch(self.xy()) # === Left LCD support (support() at origin) === # base block: translate([-55,-2,0]) cube([69,81,10]) self._add_box(-55 + 69/2, -2 + 81/2, 0 + 10/2, 69, 81, 10) # screw block: translate([-72,22,0]) cube([30,16,10]) self._add_box(-72 + 30/2, 22 + 16/2, 0 + 10/2, 30, 16, 10) # outer shape cuts self._add_box(-69.6 + 60/2, 32 + 53/2, -1 + 15/2, 60, 53, 15, cut=True) self._add_box(13.7 + 60/2, 89.7 + 42/2, -1 + 15/2, 60, 42, 15, cut=True) self._add_box(-19 + 60/2, -9 + 9/2, -1 + 15/2, 60, 9, 15, cut=True) self._add_box(7 + 60/2, -3 + 68/2, -1 + 16/2, 60, 68, 16, cut=True) self._add_box(-16 + 60/2, 60 + 50/2, -1 + 15/2, 60, 50, 15, cut=True) self._add_box(-41 + 60/2, -45 + 80/2, -1 + 13/2, 60, 80, 13, cut=True) # pcb cutouts self._add_box(4 + 1.8/2, 1.5 + 56.5/2, -1 + 17/2, 1.8, 56.5, 17, cut=True) self._add_box(0 + 5.8/2, 7.5 + 44.5/2, -1 + 17/2, 5.8, 44.5, 17, cut=True) self._add_box(4.8 + 5.8/2, 3.5 + 52.5/2, -1 + 17/2, 5.8, 52.5, 17, cut=True) # lower angled cuts self._add_box(-75 + 20/2, -2 + 14/2, -1 + 15/2, 20, 14, 15, cut=True) self._add_box(-70 + 20/2, -2 + 14/2, -1 + 15/2, 20, 14, 15, cut=True) self._add_box(-50 + 20/2, -16.3 + 20/2, -1 + 15/2, 20, 20, 15, cut=True) self._add_box(-76.5 + 15/2, -2 + 40/2, -1 + 15/2, 15, 40, 15, cut=True) # screw holes (lying along X-axis — approx as horizontal boxes) self._add_box(-71 + 22/2, 22, 5, 22, 1.75*2, 1.75*2, cut=True) self._add_box(-70 + 22/2, 33, 5, 22, 1.75*2, 1.75*2, cut=True) # nut traps self._add_box(-58 + 2.2/2, 19.1 + 5.8/2, 5 - 2.8 + 29.7/2, 2.2, 5.8, 29.7, cut=True) self._add_box(-58 + 2.2/2, 30.1 + 5.8/2, 5 - 2.8 + 29.7/2, 2.2, 5.8, 29.7, cut=True) # === Right support (rotate 180, translate [-60,-2,0]) === # Mirror by adding a second support block offset self._add_box(-60 + 55 + 69/2, -2 + 81/2, 0 + 10/2, 69, 81, 10) self._add_box(-60 + 72 - 30/2, 22 + 16/2, 0 + 10/2, 30, 16, 10) 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 = LcdSupports() show(part)