150 lines
6.1 KiB
Python
150 lines
6.1 KiB
Python
"""Auto-converted from x-carriage.scad — cadbuildr.foundation port."""
|
|
from cadbuildr.foundation import (
|
|
Part, Sketch, Point,
|
|
Square, Rectangle, Circle, RegularPolygon, RectangleRounded,
|
|
Extrusion, Lathe, Hole,
|
|
Cylinder, Box, Sphere, Cone,
|
|
show,
|
|
)
|
|
|
|
# Bearing constants (from bearing.scad)
|
|
bearing_diameter = 14.95
|
|
thinwall = 3
|
|
bearing_size = bearing_diameter + 2 * thinwall
|
|
|
|
class XCarriage(Part):
|
|
def __init__(self):
|
|
super().__init__()
|
|
sketch = self._sketch = Sketch(self.xy())
|
|
|
|
# === x_carriage_base() ===
|
|
# Small bearing holder at x=-33/2, y=0 (horizontal, 1 bearing)
|
|
# horizontal_bearing_base(1): cube([24, 8+25, 12]) at z=6
|
|
self._add_box(-33/2, 0, 6, 24, 33, 12)
|
|
|
|
# Long bearing holder at x=-33/2, y=45 (2 bearings)
|
|
# horizontal_bearing_base(2): cube([24, 8+50, 12]) at z=6
|
|
self._add_box(-33/2, 45, 6, 24, 58, 12)
|
|
|
|
# Base plate
|
|
self._add_box(-34 + 34.5/2, -14 + 70.5/2, 0 + 7/2, 34.5, 70.5, 7)
|
|
self._add_box(-34 + 35/2, -15 + 7/2, 0 + 15/2, 35, 7, 15)
|
|
self._add_box(-42.5 + 52/2, 53.0 + 6.5/2, 0 + 15/2, 52, 6.5, 15)
|
|
|
|
# Upper motor screw block
|
|
self._add_box(-34 + 43.5/2, 56.8 + 19.7/2, 0 + 8/2, 43.5, 19.7, 8)
|
|
|
|
# Belt holder base
|
|
self._add_box(-42.5 + 52/2, 20 + 16/2, 0 + 7/2, 52, 16, 7)
|
|
self._add_box(-42.5 + 52/2, 18 + 16.3/2, 7 + 8/2, 52, 16.3, 8)
|
|
|
|
# cable tray blocks
|
|
self._add_box(-21 + 9/2, 23 + 12/2, 0 + 15/2, 9, 12, 15)
|
|
self._add_box(6.5 + 3/2, 32 + 5/2, 10 + 5/2, 3, 5, 5)
|
|
self._add_box(-42.5 + 4/2, 32 + 5/2, 10 + 5/2, 4, 5, 5)
|
|
self._add_box(-39.9 + 9/2, 11 + 2/2, 0 + 15/2, 9, 2, 15)
|
|
self._add_box(-39.9 + 9/2, 5.5 + 2/2, 0 + 15/2, 9, 2, 15)
|
|
self._add_box(-2 + 11.45/2, 5.5 + 2/2, 0 + 15/2, 11.45, 2, 15)
|
|
self._add_box(-2 + 11.45/2, 11 + 2/2, 7 + 8/2, 11.45, 2, 8)
|
|
self._add_box(-31 + 30/2, 11.5 + 1.5/2, 7 + 8/2, 30, 1.5, 8)
|
|
self._add_box(0 + 9.5/2, 11 + 22/2, 0 + 7/2, 9.5, 22, 7)
|
|
|
|
# === bearing holes (cuts) ===
|
|
# Small bearing: horizontal_bearing_holes_nozip_smooth(1)
|
|
# Main bore (along X): cutter_length=35, r=bearing_diameter/2+0.2
|
|
self._add_cyl(-33/2, 0, 12, bearing_diameter/2 + 0.2, 35, cut=True)
|
|
# Long bearing: horizontal_bearing_holes_nozip_smooth(2)
|
|
self._add_cyl(-33/2, 45, 12, bearing_diameter/2 + 0.2, 60, cut=True)
|
|
|
|
# ziptie cutouts
|
|
self._add_cyl(2 + 0.75, 45, 12, 10.8, 3.5, cut=True)
|
|
self._add_cyl(2 + 0, 45, 12, 9, 6, cut=True)
|
|
self._add_cyl(-38 + 0.75, 45, 12, 10.8, 3.5, cut=True)
|
|
self._add_cyl(-38 + 0, 45, 12, 9, 6, cut=True)
|
|
|
|
# ziptie head cuts
|
|
self._add_box(0 + 10/2, 52.5 + 10/2, 12 + 5/2, 10, 10, 5, cut=True)
|
|
self._add_box(-45 + 13.5/2, 52.5 + 10/2, 12 + 5/2, 13.5, 10, 5, cut=True)
|
|
|
|
# Extruder mounting holes
|
|
self._add_cyl(-7, 15.5, -1, 1.65, 20, cut=True)
|
|
self._add_cyl(-27, 15.5, -1, 1.65, 20, cut=True)
|
|
self._add_cyl(-7, 15.5, 4, 3.1, 4, cut=True)
|
|
self._add_cyl(-27, 15.5, 4, 3.1, 4, cut=True)
|
|
self._add_cyl(-7, 15.5, 7, 4, 30, cut=True)
|
|
self._add_cyl(-27, 15.5, 7, 3.5, 30, cut=True)
|
|
|
|
# Carriage slimmer cuts
|
|
self._add_box(-55.5 + 3 + 10/2, 19 + 40/2, -1 + 30/2, 10, 40, 30, cut=True)
|
|
self._add_box(12.5 - 3 + 10/2, 19 + 40/2, -1 + 30/2, 10, 40, 30, cut=True)
|
|
|
|
# fancy shape cuts
|
|
self._add_box(-37 + 50/2, -12 + 8/2, -6 + 25/2, 50, 8, 25, cut=True)
|
|
self._add_box(-35 + 6/2, -19.2 + 6/2, 0 + 16/2, 6, 6, 16, cut=True)
|
|
self._add_box(2 + 6/2, -20.4 + 6/2, 0 + 16/2, 6, 6, 16, cut=True)
|
|
self._add_box(7.5 + 20/2, 59.5 + 20/2, -18 + 40/2, 20, 20, 40, cut=True)
|
|
|
|
# final_cutout cuts
|
|
# bottom back mounting screws
|
|
self._add_cyl(-22, -11, 4, 1.65, 20, cut=True)
|
|
self._add_box(-24.8 + 5.6/2, -14 + 7/2, 10 + 2.1/2, 5.6, 7, 2.1, cut=True)
|
|
|
|
# x-carriage-back mounting screws
|
|
self._add_cyl(-4, 56, 0, 1.7, 40, cut=True)
|
|
self._add_cyl(-27.5, 56, 0, 1.7, 40, cut=True)
|
|
self._add_box(-30.3 + 5.6/2, 53 + 8/2, 8 + 2/2, 5.6, 8, 2, cut=True)
|
|
self._add_box(-6.8 + 5.6/2, 53 + 8/2, 8 + 2/2, 5.6, 8, 2, cut=True)
|
|
|
|
# center mounting screw
|
|
self._add_cyl(-16, 29, 0, 1.65, 40, cut=True)
|
|
self._add_box(-18.8 + 5.6/2, 26 + 12/2, 10.5 + 2.1/2, 5.6, 12, 2.1, cut=True)
|
|
|
|
# endstop hole
|
|
self._add_cyl(-8, -11, 11, 1.4, 10, cut=True)
|
|
|
|
# motor screws (upper)
|
|
self._add_cyl(2.5, 67.5, -50, 1.8, 100, cut=True)
|
|
self._add_cyl(2.5, 67.5, 7.5, 3.2, 7, cut=True)
|
|
self._add_cyl(-28.5, 67.5, 7.5, 3.2, 20, cut=True)
|
|
self._add_cyl(-28.5, 67.5, -1, 1.65, 20, cut=True)
|
|
|
|
# hold together screws clearance
|
|
self._add_cyl(-4.5, 25.5, -1, 2.2, 10, cut=True)
|
|
self._add_cyl(-28.5, 25.5, -1, 2.2, 10, cut=True)
|
|
|
|
# belt holder pin cuts
|
|
self._add_cyl(-22.5, 30.2, 7, 1.5, 100, cut=True)
|
|
self._add_cyl(-9.6, 29.7, 7, 1.5, 100, cut=True)
|
|
|
|
# filament sensor connector slot
|
|
self._add_box(-1.5 + 1/2, 62 + 5/2, -1.3 + 5/2, 1, 5, 5, cut=True)
|
|
self._add_box(-9 + 9/2, 70.6 + 15/2, -1.3 + 15/2, 9, 15, 15, cut=True)
|
|
|
|
# motor cable opening
|
|
self._add_box(0.5 + 8/2, 10 + 18/2, -1 + 6/2, 8, 18, 6, cut=True)
|
|
|
|
# filament hole
|
|
self._add_cyl(-14.199, 9.05, 0, 1.62, 40, 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 = XCarriage()
|
|
show(part)
|