63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
"""Auto-converted from print-fan-support.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 PrintFanSupport(Part):
|
|
def __init__(self):
|
|
super().__init__()
|
|
sketch = self._sketch = Sketch(self.xy())
|
|
|
|
# union bodies
|
|
# translate([-4,-47,23]) cylinder(h=5, r=5)
|
|
self._add_cyl(-4, -47, 23, 5, 5)
|
|
# translate([-2,-57,23]) cube([5,15,30])
|
|
self._add_box(-2 + 5/2, -57 + 15/2, 23 + 30/2, 5, 15, 30)
|
|
# translate([-5,-52,23]) cube([8,10,5])
|
|
self._add_box(-5 + 8/2, -52 + 10/2, 23 + 5/2, 8, 10, 5)
|
|
# translate([-5,-48,45]) rotate([48,0,0]) cylinder(h=10,r=6,$fn=6) — angled hex, approx vertical
|
|
self._add_cyl(-5, -48, 45, 6, 10)
|
|
|
|
# cuts
|
|
# screw hole along angled axis — approx vertical
|
|
self._add_cyl(-5, -48, 45, 1.65, 30, cut=True)
|
|
# screw head pocket
|
|
self._add_cyl(-5, -48, 45, 3.1, 6, cut=True)
|
|
|
|
# lower screw
|
|
self._add_cyl(-5, -47, 10, 1.65, 25, cut=True)
|
|
self._add_cyl(-5, -47, 27, 3.1, 1.1, cut=True)
|
|
|
|
# large shape cuts
|
|
self._add_box(10 + 60/2, -85 + 50/2, 15 + 20/2, 60, 50, 20, cut=True)
|
|
self._add_box(-15 + 50/2, -71 + 20/2, 15 + 40/2, 50, 20, 40, cut=True)
|
|
self._add_box(-15 + 50/2, -41 + 20/2, 15 + 40/2, 50, 20, 40, cut=True)
|
|
self._add_box(-15 + 20/2, -39.5 + 20/2, 44 + 20/2, 20, 20, 20, cut=True)
|
|
self._add_box(-15 + 20/2, -60 + 20/2, 52.5 + 20/2, 20, 20, 20, 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 = PrintFanSupport()
|
|
show(part)
|