Original-Prusa-i3/Printed-Parts/SCAD/Einsy-base.py

156 lines
5.7 KiB
Python

"""Auto-converted from Einsy-base.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 EinsyBase(Part):
def __init__(self):
super().__init__()
sketch = self._sketch = Sketch(self.xy())
# === main_body() ===
# side panel
self._add_box(118.5/2, 92/2, 2/2, 118.5, 92, 2)
# upper panel
self._add_box(1.5/2, 92/2, 35/2, 1.5, 92, 35)
# rear panel
self._add_box(0 + 105.5/2, 90 + 2/2, 35/2, 105.5, 2, 35)
# upper panel frame reinforcement
self._add_box(5/2, 7/2, 1 + 34/2, 5, 7, 34)
# side panel reinforcement
self._add_box(9/2, 92/2, 1 + 3/2, 9, 92, 3)
self._add_box(98 + 9/2, 92/2, 4/2, 9, 92, 4)
# antenna posts
self._add_cyl(21, 81, 0, 2.5, 4.5)
self._add_cyl(79, 81, 0, 2.5, 4.5)
# ziptie block (approximate as small box)
self._add_box(0 + 5/2, 55 + 8/2, 22 + 10/2, 5, 8, 10)
self._add_box(25 + 8/2, 91.5 + 5/2, 22 + 10/2, 8, 5, 10)
# bottom side reinforcement
self._add_box(98 + 7.5/2, 86 + 6/2, 35/2, 7.5, 6, 35)
self._add_box(0 + 5.5/2, 85 + 7/2, 35/2, 5.5, 7, 35)
# screw mounting block
self._add_box(54 + 9.5/2, 84 + 7/2, 35/2, 9.5, 7, 35)
# frame side panel
self._add_box(20 + 80/2, 3/2, 5/2, 80, 3, 5)
# Einsy mounting holes (hex pockets — approx as cylinders)
self._add_cyl(102.5, 14, 1, 5.5, 7)
self._add_cyl(102.5, 75, 1, 5.5, 7)
self._add_cyl(7.5, 14, 1, 5.5, 7)
self._add_cyl(7.5, 75, 1, 5.5, 7)
# corner reinforcements
self._add_box(0 + 13/2, 75 + 16/2, 1 + 6/2, 13, 16, 6)
self._add_box(0 + 7.5/2, 70.25 + 11/2, 1 + 6/2, 7.5, 11, 6)
self._add_box(0 + 7.5/2, 7.75 + 11/2, 1 + 6/2, 7.5, 11, 6)
self._add_box(0 + 13/2, 0 + 14/2, 1 + 6/2, 13, 14, 6)
# frame mounting screw blocks
self._add_box(1 + 28/2, 4/2, 10/2, 28, 4, 10)
self._add_box(18.45 + 3/2, 4/2, 5.5/2, 3, 4, 5.5)
self._add_box(98 + 20.5/2, 4/2, 10/2, 20.5, 4, 10)
# door closing corner
self._add_cone(102, 88.5, 35, 2.5, 1, 3)
# doors pin upper
self._add_box(2 + 6/2, 85 + 7/2, 31 + 4/2, 6, 7, 4)
self._add_cone(4, 88.5, 35, 2.5, 1, 3)
# x-axis cables entry hole body (hex approx)
self._add_cyl(89, 2, 0, 6, 5)
# === cutouts() ===
# extruder cable holder cuts
self._add_box(-15 + 30/2, 0 + 60/2, 35 + 15/2, 30, 60, 15, cut=True)
self._add_box(-15 + 30/2, 24 + 8/2, 30 + 8/2, 30, 8, 8, cut=True)
self._add_cyl(-20, 28, 28, 5.5, 40, cut=True)
self._add_cyl(-3, 28, 28, 1.7, 24, cut=True)
# side cutout
self._add_box(12 + 85.5/2, 19 + 51/2, 1 + 3/2, 85.5, 51, 3, cut=True)
# Einsy M3 screws
self._add_cyl(7.5, 14, -1, 1.9, 10, cut=True)
self._add_cyl(102.5, 14, -1, 1.9, 10, cut=True)
self._add_cyl(102.5, 75, -1, 1.9, 10, cut=True)
self._add_cyl(7.5, 75, -1, 1.9, 10, cut=True)
# nut traps (hex approx as cylinders)
self._add_cyl(7.5, 14, -1, 3.2, 4, cut=True)
self._add_cyl(102.5, 14, -1, 3.2, 4, cut=True)
self._add_cyl(102.5, 75, -1, 3.2, 4, cut=True)
self._add_cyl(7.5, 75, -1, 3.2, 4, cut=True)
self._add_cyl(58.5, 88, -1, 3.2, 4, cut=True)
# ventilation holes (representative sample)
for i in range(-5, 9):
self._add_box(46 + i*5.5 + 3.65/2, 10.5 + (19+49)/2, -1 + 1.2/2, 3.65, 68, 1.2, cut=True)
self._add_box(46 + i*5.5 + 3.65/2, 10.5 + 18/2, -1 + 10/2, 3.65, 18, 10, cut=True)
# frame mounting screws (along Y)
self._add_cyl(16.5, 8, 5, 1.6, 10, cut=True)
self._add_cyl(110.5, 9, 5, 1.6, 10, cut=True)
# USB connector hole
self._add_box(-1 + 5.5/2, 41.5 + 13/2, 11 + 11/2, 5.5, 13, 11, cut=True)
# reset button
self._add_cyl(-2, 65, 14, 2, 10, cut=True)
# door closing screw
self._add_cyl(58.5, 88, -1, 1.9, 43, cut=True)
# main cable hole
self._add_cyl(-10, 28, 26, 6.8, 24, cut=True)
self._add_box(-15 + 30/2, 25 + 6/2, 30 + 10/2, 30, 6, 10, cut=True)
# lightening slots
self._add_box(100 + 5/2, 21 + 48/2, 2 + 5/2, 5, 48, 5, cut=True)
self._add_box(3 + 4.5/2, 21 + 48/2, 2 + 5/2, 4.5, 48, 5, cut=True)
# x axis cable hole
self._add_cyl(89, 2, -1, 4, 10, cut=True)
self._add_box(80 + 15/2, -5 + 5/2, -1 + 10/2, 15, 5, 10, cut=True)
# heatbed cable mounting reinforcement
self._add_box(63 + 15/2, 86.0 + 5/2, 0.5 + 34.5/2, 15, 5, 34.5)
self._add_cyl(75, 99, 28, 13, 9)
# heatbed screw cuts
self._add_cyl(67, 88.8, 20, 1.6, 15, cut=True)
self._add_cyl(83, 96, 20, 1.6, 15, cut=True)
self._add_cyl(61, 102, 28, 3.3, 35, 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 = EinsyBase()
show(part)