Original-Prusa-i3/Printed-Parts/SCAD/heatbed-cable-cover-clip.py

72 lines
2.8 KiB
Python

"""Auto-converted from heatbed-cable-cover-clip.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 HeatbedCableCoverClip(Part):
def __init__(self):
super().__init__()
sketch = self._sketch = Sketch(self.xy())
# base body: translate([-15,15.5,-3]) cube([30,20.5,6])
self._add_box(-15 + 30/2, 15.5 + 20.5/2, -3 + 6/2, 30, 20.5, 6)
# inner cuts
self._add_box(3.5 + 10.5/2, 2 + 15/2, 0 + 6/2, 10.5, 15, 6, cut=True)
self._add_box(-14 + 10.5/2, 2 + 15/2, 0 + 6/2, 10.5, 15, 6, cut=True)
self._add_box(3.5 + 7/2, 15 + 8/2, 0 + 6/2, 7, 8, 6, cut=True)
self._add_box(-10.5 + 7/2, 15 + 8/2, 0 + 6/2, 7, 8, 6, cut=True)
self._add_box(-7 + 14/2, 15 + 11/2, 0 + 6/2, 14, 11, 6, cut=True)
self._add_box(3 + 7/2, 14 + 13/2, 1 + 6/2, 7, 13, 6, cut=True)
self._add_box(-9.88 + 7/2, 15.21 + 13/2, 1 + 6/2, 7, 13, 6, cut=True)
# cables cut — main cylinder along Y
self._add_cyl(0, 36, 3, 4, 187, cut=True)
# m3 nut pockets (approximate as cylinders)
self._add_cyl(-11, 30, 0, 3.15, 4, cut=True)
self._add_cyl(11, 30, 0, 3.15, 4, cut=True)
# thermistor cable entry (angled — approximate as vertical cylinder)
self._add_cyl(0, 22, 4, 3, 15, cut=True)
# edge cuts
self._add_box(-18.0 + 11/2, 32 + 11/2, -5 + 15/2, 11, 11, 15, cut=True)
self._add_box(18 + 11/2, 32 + 11/2, -5 + 15/2, 11, 11, 15, cut=True)
# cable rims: outer ring minus inner
self._add_cyl(0, 36, 3, 4.5, 10)
self._add_cyl(0, 37, 3, 3, 17, cut=True)
# trim the rim
self._add_box(0, 18 + 20/2, 3 + 6/2, 30, 20, 6, cut=True)
self._add_box(0, 27 + 2/2, -5 + 16/2, 30, 2, 16, cut=True)
self._add_box(0, 30 + 2/2, -5 + 16/2, 30, 2, 16, cut=True)
self._add_box(0, 33 + 2/2, -5 + 16/2, 30, 2, 16, cut=True)
self._add_box(-4 + 8/2, 20 + 11/2, 0 + 6/2, 8, 11, 6, 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 = HeatbedCableCoverClip()
show(part)