Original-Prusa-i3/Printed-Parts/SCAD/Heatbed-cable-clip_8mm.py

61 lines
2.2 KiB
Python

"""Auto-converted from Heatbed-cable-clip_8mm.scad — cadbuildr.foundation port."""
from cadbuildr.foundation import (
Part, Sketch, Point,
Square, Rectangle, Circle, RegularPolygon, RectangleRounded,
Extrusion, Lathe, Hole,
Cylinder, Box, Sphere, Cone,
show,
)
# Offsets applied from translate([-70,-110,0]) in SCAD call
OX, OY, OZ = -70, -110, 0
class HeatbedCableClip8mm(Part):
def __init__(self):
super().__init__()
sketch = self._sketch = Sketch(self.xy())
# body base cylinders (rotated 90 around X -> lying along Y, approximated as boxes)
self._add_box(75 + OX, 99 - 15/2 + OY, 28 + OZ, 26, 15, 26)
self._add_box(75 + OX, 101 - 2/2 + OY, 28 + OZ, 26, 2, 26)
# flat shelf tab
self._add_box(62.75 + 24.5/2 + OX, 84 + 8/2 + OY, 28 + 7/2 + OZ, 24.5, 8, 7)
# cut flat and shape
self._add_box(60 + 30/2 + OX, 82 + 20/2 + OY, 14 + 14/2 + OZ, 30, 20, 14, cut=True)
self._add_box(60 + 30/2 + OX, 72 + 20/2 + OY, 20 + 30/2 + OZ, 30, 20, 30, cut=True)
# cable opening — 8mm variant has r=5 (vs 4 in 4mm version)
self._add_cyl(61 + OX, 102 + OY, 28 + OZ, 4.3, 35, cut=True)
# screw heads
self._add_cyl(67 + OX, 88.8 + OY, 30.5 + OZ, 3.2, 10, cut=True)
self._add_cyl(83 + OX, 96 + OY, 31 + OZ, 3.2, 10, cut=True)
# screws
self._add_cyl(67 + OX, 88.8 + OY, 14 + OZ, 1.6, 35, cut=True)
self._add_cyl(83 + OX, 96 + OY, 14 + OZ, 1.6, 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 = HeatbedCableClip8mm()
show(part)