88 lines
3.4 KiB
Python
88 lines
3.4 KiB
Python
"""Auto-converted from heatbed-cable-cover.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 HeatbedCableCover(Part):
|
|
def __init__(self):
|
|
super().__init__()
|
|
sketch = self._sketch = Sketch(self.xy())
|
|
|
|
# base block: translate([-18,0,0]) cube([36,36,9])
|
|
self._add_box(-18 + 36/2, 0 + 36/2, 0 + 9/2, 36, 36, 9)
|
|
|
|
# heatbed pcb support rails
|
|
self._add_box(-17 + 3/2, 0 + 20/2, 4 + 2/2, 3, 20, 2)
|
|
self._add_box(14 + 3/2, 0 + 20/2, 4 + 2/2, 3, 20, 2)
|
|
self._add_box(-17 + 14/2, 0 + 2/2, 4 + 2/2, 14, 2, 2)
|
|
self._add_box(3 + 14/2, 0 + 2/2, 4 + 2/2, 14, 2, 2)
|
|
|
|
# inner cut
|
|
self._add_box(-15 + 30/2, -0.5 + 16/2, -3 + 9/2, 30, 16, 9, cut=True)
|
|
|
|
# cable opening along Y
|
|
self._add_cyl(0, 37, 3, 3.3, 15, cut=True)
|
|
|
|
# large inner panel cut
|
|
self._add_box(-15 + 30/2, 15 + 22/2, -6 + 9/2, 30, 22, 9, cut=True)
|
|
|
|
# inner edge 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(2.5 + 8/2, 15 + 8/2, 0 + 6/2, 8, 8, 6, cut=True)
|
|
self._add_box(-10.5 + 8/2, 15 + 8/2, 0 + 6/2, 8, 8, 6, cut=True)
|
|
self._add_box(6.96 + 5/2, 19.45 + 10/2, 0 + 6/2, 5, 10, 6, cut=True)
|
|
self._add_box(-6.96 + 10/2, 19.45 + 5/2, 0 + 6/2, 10, 5, 6, cut=True)
|
|
self._add_box(3.96 + 5/2, 18.45 + 6/2, 0 + 6/2, 5, 6, 6, cut=True)
|
|
self._add_box(-3.96 + 6/2, 18.45 + 5/2, 0 + 6/2, 6, 5, 6, cut=True)
|
|
self._add_box(0, 20, 0.5, 11, 11, 11, cut=True)
|
|
self._add_box(2 + 8/2, 14 + 13/2, -1 + 6/2, 8, 13, 6, cut=True)
|
|
self._add_box(-9.88 + 8/2, 15.21 + 13/2, -1 + 6/2, 8, 13, 6, cut=True)
|
|
|
|
# outer edge cuts
|
|
self._add_box(-18.0 + 11/2, 32 + 11/2, -1 + 11/2, 11, 11, 11, cut=True)
|
|
self._add_box(18 + 11/2, 32 + 11/2, -1 + 11/2, 11, 11, 11, cut=True)
|
|
|
|
# heatbed terminal screw pockets
|
|
self._add_cyl(8.5, 7.5, 0, 3.25, 8.6, cut=True)
|
|
self._add_cyl(-8.5, 7.5, 0, 3.25, 8.6, cut=True)
|
|
|
|
# clip nut pockets (m3_head approx)
|
|
self._add_cyl(11, 30, 0, 3.15, 4, cut=True)
|
|
self._add_cyl(-11, 30, 0, 3.15, 4, cut=True)
|
|
|
|
# hold screw
|
|
self._add_cyl(0, 7.5, 0, 3.15, 4, cut=True)
|
|
|
|
# LED window
|
|
self._add_box(-2.5 + 5/2, -1 + 3.5/2, -4 + 10/2, 5, 3.5, 10, cut=True)
|
|
|
|
# chamfer edges
|
|
self._add_box(-20 + 40/2, 0 + 5/2, 6.5 + 5/2, 40, 5, 5, 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 = HeatbedCableCover()
|
|
show(part)
|