114 lines
4.1 KiB
Python
114 lines
4.1 KiB
Python
"""Auto-converted from x-end-motor.scad — cadbuildr.foundation port."""
|
|
from cadbuildr.foundation import (
|
|
Part, Sketch, Point,
|
|
Square, Rectangle, Circle, RegularPolygon, RectangleRounded,
|
|
Extrusion, Lathe, Hole,
|
|
Cylinder, Box, Sphere, Cone,
|
|
show,
|
|
)
|
|
|
|
rod_distance = 45
|
|
bearing_diameter = 14.95
|
|
thinwall = 3
|
|
bearing_size = bearing_diameter + 2 * thinwall
|
|
height = 58
|
|
|
|
class XEndMotor(Part):
|
|
def __init__(self):
|
|
super().__init__()
|
|
sketch = self._sketch = Sketch(self.xy())
|
|
|
|
# === x_end_base() ===
|
|
self._add_box(-15, -9, height/2, 17, 39, height)
|
|
self._add_box(-8 + 5/2, -28.5 + 1/2, 13.5/2, 5, 1, 13.5)
|
|
# bearing holder
|
|
self._add_box(-2 - bearing_size/4, 0, 29, 4 + bearing_size/2, bearing_size, 58)
|
|
self._add_cyl(0, 0, 29, bearing_size/2, 58)
|
|
# nut trap
|
|
self._add_cyl(0, -17, 0, 12.5, 13.5)
|
|
self._add_cyl(0, -17, 13, 12.5, 3)
|
|
|
|
# === x_end_motor_base extra: translate([-15,31,26.5]) cube([17,44,53], center) ===
|
|
self._add_box(-15, 31, 26.5, 17, 44, 53)
|
|
|
|
# === x_end_holes() (cuts) ===
|
|
# bearing bore
|
|
self._add_cyl(0, 0, 31, bearing_diameter/2 + 0.2, 62, cut=True)
|
|
# belt slot
|
|
self._add_box(-15, -10, 30, 10, 46, 28, cut=True)
|
|
# bottom rod
|
|
self._add_cyl(-15, -41, 6, 7.8/2, 50, cut=True)
|
|
# top rod
|
|
self._add_cyl(-15, -41.5, rod_distance + 6, 7.8/2, 50, cut=True)
|
|
# TR nut hole
|
|
self._add_cyl(0, -17, -1, 6.7, 14.51, cut=True)
|
|
|
|
# === x_end_motor_holes() ===
|
|
# Belt hole: translate([-20,-21+32,-12+30]) cube([10,25,22]) => approx
|
|
self._add_box(-20 + 10/2, 11 + 25/2, 18 + 22/2, 10, 25, 22, cut=True)
|
|
|
|
# Motor mounting screws (NEMA17: 31mm pattern)
|
|
for dy, dz in [(15.5, 15.5), (15.5, -15.5)]:
|
|
self._add_cyl(-1 + 32, 32 + dy, 30.25 + dz, 1.55, 30, cut=True)
|
|
self._add_cyl(-1 + 32, 32 - dy, 30.25 + dz, 1.55, 30, cut=True)
|
|
|
|
# Motor shaft opening (hex approx as cylinder)
|
|
self._add_cyl(0, 32, 30, 17, 70, cut=True)
|
|
|
|
# Material saving cutout
|
|
self._add_box(-10 + 32 + 60/2, 10 + 32 + 42/2, 12 + 30.25 + 42/2, 60, 42, 42, cut=True)
|
|
|
|
# Motor shaft details
|
|
self._add_cyl(-30, 19.05, 30, 3.5, 30)
|
|
|
|
# Waste pockets
|
|
self._add_cyl(-15, 7, 6, 5, 3.5, cut=True)
|
|
self._add_cyl(-15, 7, 51, 5, 3.5, cut=True)
|
|
|
|
# Rod contact windows
|
|
self._add_box(-17 + 4/2, 3 + 4/2, 55 + 10/2, 4, 4, 10, cut=True)
|
|
self._add_box(-17 + 4/2, 3 + 4/2, -8 + 10/2, 4, 4, 10, cut=True)
|
|
|
|
# Bearing stop
|
|
self._add_cyl(0, 0, 57, 8, 1)
|
|
self._add_cyl(0, 0, 56.5, 7, 2, cut=True)
|
|
|
|
# Bearing spacer
|
|
self._add_cyl(0, 0, 26, 8, 6)
|
|
self._add_cyl(0, 0, 25, 7.55, 8, cut=True)
|
|
|
|
# Belt tensioner body (approx as boxes)
|
|
self._add_cyl(-24, 9, 30.25, 4, 27)
|
|
self._add_box(-24, -18, 30.25, 10, 10.5, 10)
|
|
|
|
# Belt tensioner cuts
|
|
self._add_cyl(-24, 32 - 15.5 - 2.5, 30.25, 1.6, 35, cut=True)
|
|
self._add_cyl(-24, 32 - 15.5 - 4.5 - 30, 30.25, 3.2, 30, cut=True)
|
|
|
|
# corner cleanup cuts
|
|
self._add_box(-47 + 20/2, -40 + 80/2, 60 + 20/2, 20, 80, 20, cut=True)
|
|
self._add_box(-25 + 30/2, -37 + 20/2, 49 + 20/2, 30, 20, 20, cut=True)
|
|
self._add_box(-25 + 30/2, 23.5 + 20/2, 49 + 20/2, 30, 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 = XEndMotor()
|
|
show(part)
|