module trackball(x, y, z, tbBoxLength, tbDiameter, openingWidth, openingHeight, grooveWidth, grooveHeight, offset){ //translate([]) cube([]); translate([x, y, z]) { difference() { union() { translate([0,(openingWidth - grooveWidth + offset) / 2,0]) color("olive") cube([tbBoxLength, grooveWidth - offset, grooveHeight]); translate([0, offset / 2, grooveHeight]) color("green") cube([tbBoxLength, openingWidth - offset, openingHeight]); } translate([- offset, openingWidth / 2, openingHeight + grooveHeight]) rotate([90 + atan(24/(openingWidth/2)), 0, 0]) cube(cutBlock); } translate([tbBoxLength / 2, openingWidth / 2, openingHeight + grooveHeight]) color("teal") sphere(d = tbDiameter); } }