66 lines
2.5 KiB
Python
66 lines
2.5 KiB
Python
"""Auto-converted from Heatbed-cable-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,
|
|
)
|
|
|
|
# Offsets applied from translate([-70,-110,0]) in SCAD call
|
|
OX, OY, OZ = -70, -110, 0
|
|
|
|
class HeatbedCableClip(Part):
|
|
def __init__(self):
|
|
super().__init__()
|
|
sketch = self._sketch = Sketch(self.xy())
|
|
|
|
# body base cylinders (rotated 90 around X -> lying along Y)
|
|
# approximate as boxes with cylinder cross-section -> use cylinders oriented via radius
|
|
# translate([75,99,28]) rotate([90,0,0]) cylinder(h=15, r=13)
|
|
# lying along Y at x=75, z=28; approximate as box
|
|
self._add_box(75 + OX, 99 - 15/2 + OY, 28 + OZ, 26, 15, 26)
|
|
# translate([75,101,28]) rotate([90,0,0]) cylinder(h=2, r1=9, r2=13) -> cone approx box
|
|
self._add_box(75 + OX, 101 - 2/2 + OY, 28 + OZ, 26, 2, 26)
|
|
|
|
# flat shelf tab
|
|
# translate([62.75,84,28]) cube([24.5,8,7])
|
|
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 (angled — approximate as vertical cylinder cut)
|
|
self._add_cyl(61 + OX, 102 + OY, 28 + OZ, 3.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 = HeatbedCableClip()
|
|
show(part)
|