Original-Prusa-i3/Printed-Parts/SCAD/LCD-cover-ORIGINAL-MK3.py

109 lines
4.3 KiB
Python

"""Auto-converted from LCD-cover-ORIGINAL-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 LcdCoverOriginalMk3(Part):
def __init__(self):
super().__init__()
sketch = self._sketch = Sketch(self.xy())
# === main_body union ===
self._add_box(-77 + 155/2, -4.5 + 59.8/2, 0 + 2/2, 155, 59.8, 2)
self._add_box(-77 + 155/2, -4.5 + 3/2, 0 + 20.08/2, 155, 3, 20.08)
self._add_box(-77 + 7/2, -3.5 + 5/2, -1 + 15/2, 7, 5, 15)
self._add_box(71 + 7/2, -3.5 + 5/2, -1 + 15/2, 7, 5, 15)
self._add_box(-77 + 155/2, -15.2 + 3.1/2, 14.2 + 11.8/2, 155, 3.1, 11.8)
self._add_box(-77 + 155/2, 54 + 2/2, 0 + 17/2, 155, 2, 17)
# M3 hole bodies (hex cylinders — approx as regular cylinders)
self._add_cyl(73.5, 43.3, 0.5, 4, 14)
self._add_cyl(-72.5, 43.5, 0.5, 4, 14)
# pcb_clip bodies
self._add_box(-3 + 7/2, -12 + 4/2, 17.5 + 5/2, 7, 4, 5)
self._add_box(-3 + 1/2, -10.6 + 2.6/2, 12.5 + 7/2, 1, 2.6, 7)
self._add_box(3 + 1/2, -10.6 + 2.6/2, 12.5 + 7/2, 1, 2.6, 7)
# reset button body
self._add_cyl(62.5, 37.3, 0, 3.5, 7.2)
# left side panels
self._add_box(-77 + 1.5/2, -14.7 + 70.7/2, 0 + 26/2, 1.5, 70.7, 26)
self._add_box(-76.5 + 4/2, -15 + 70/2, 0 + 14.6/2, 4, 70, 14.6)
# right side panels
self._add_box(76.5 + 1.5/2, -14.7 + 70.7/2, 0 + 26/2, 1.5, 70.7, 26)
self._add_box(73.5 + 4/2, -14 + 70/2, 0 + 14.5/2, 4, 70, 14.5)
# rear reinforcement
self._add_box(-54.5 + 110/2, -11.7 + 4/2, 8 + 6.5/2, 110, 4, 6.5)
self._add_box(65.5 + 12/2, -11.7 + 4/2, 8 + 6.5/2, 12, 4, 6.5)
self._add_box(65.5 + 12/2, -13 + 2/2, 14 + 12/2, 12, 2, 12)
self._add_box(-76.5 + 12/2, -11.7 + 4/2, 8 + 6.5/2, 12, 4, 6.5)
self._add_box(-76.5 + 12/2, -14.7 + 4/2, 14.5 + 11.5/2, 12, 4, 11.5)
self._add_box(-44 + 89/2, -14.7 + 4/2, 14.5 + 11.5/2, 89, 4, 11.5)
# front reinforcements (approx)
self._add_box(-77 + 15/2, 41.3 + 14/2, 0 + 25/2, 15, 14, 25)
self._add_box(38 + 40/2, 41.2 + 14/2, 0 + 26/2, 40, 14, 26)
# SD card window support tabs
self._add_box(-76.5 + 1/2, 15 + 5/2, 16.70 + 4.1/2, 1, 5, 4.1)
self._add_box(-76.5 + 1/2, 25 + 5/2, 16.70 + 4.1/2, 1, 5, 4.1)
# === cuts ===
# LCD window
self._add_box(-61.5 + 98.5/2, 1 + 42/2, 1.2 + 10/2, 98.5, 42, 10, cut=True)
self._add_box(-52.5 + 80/2, 8 + 30.5/2, -1 + 10/2, 80, 30.5, 10, cut=True)
# speaker slots
for buzz in range(55, 68, 2):
self._add_box(buzz + 1.3/2, 1.5 + 4/2, -1 + 10/2, 1.3, 4, 10, cut=True)
# knob hole
self._add_cyl(62.5, 21, -1, 6, 10, cut=True)
self._add_cone(62.5, 21, -1.2, 7, 6, 2) # chamfer (not cut — just visual approx)
# reset button cutout
self._add_box(44 + 1/2, 26 + 6/2, -1 + 9/2, 1, 6, 9, cut=True)
# SD card opening
self._add_box(-80 + 10/2, 9 + 28/2, 16.5 + 4.5/2, 10, 28, 4.5, cut=True)
# M3 screw threads
self._add_cyl(72.5, 43.2, 3, 1.4, 20, cut=True)
self._add_cyl(-72.5, 42.7, 3, 1.4, 20, cut=True)
# front cleanup
self._add_box(-100 + 200/2, -64.6 + 50/2, 0 + 50/2, 200, 50, 50, cut=True)
# large bottom cleanup
self._add_box(-100 + 200/2, -40 + 50/2, -50 + 50/2, 200, 50, 50, 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 = LcdCoverOriginalMk3()
show(part)