New paste Repaste Download
module BallWithHole() {
  translate([2, 3, 7])
  scale([0.7, 0.5, 1])
  difference() {
    sphere(30);
    translate([0, 0, -31]) cylinder(r=10, h=62);
  }
  sphere(5);
}
module XDimensionBound(maxval=1000) {
  union() {
    translate([0, 1])
      projection()
      rotate([90, 0, 0])
      linear_extrude(maxval+1)
      projection()
      children();
    translate([0, -1])
      projection()
      translate([0, 1])
      rotate([-90, 0, 0])
      linear_extrude(maxval+1)
      projection()
      children();
  }
}
module XYPlaneIntersect(maxval=1000) {
  intersection() {
    XDimensionBound(maxval) children();
    rotate([0, 0, 90])
      XDimensionBound(maxval)
      rotate([0, 0, -90])
      children();
  }
}
module XZPlaneIntersect(maxval=1000) {
  intersection() {
    XDimensionBound(maxval)
      rotate([-90, 0, 0])
      children();
    rotate([0, 0, 90])
      XDimensionBound(maxval)
      rotate([-90, 0, -90])
      children();
  }
}
module YZPlaneIntersect(maxval=1000) {
  intersection() {
    XDimensionBound(maxval)
      rotate([0, -90, 0])
      children();
    rotate([0, 0, 90])
      XDimensionBound(maxval)
      rotate([0, -90, -90])
      children();
  }
}
module XYExtent(maxval=1000) {
  translate([0, 0, -1])
    linear_extrude(maxval+1)
    XYPlaneIntersect(maxval) children();
  mirror([0, 0, 1])
    translate([0, 0, -1])
    linear_extrude(maxval+1)
    XYPlaneIntersect(maxval) children();
}
module XZExtent(maxval=1000) {
  rotate([90, 0, 0]) {
    translate([0, 0, -1])
      linear_extrude(maxval+1)
      XZPlaneIntersect(maxval) children();
    mirror([0, 0, 1])
      translate([0, 0, -1])
      linear_extrude(maxval+1)
      XZPlaneIntersect(maxval) children();
  }
}
module YZExtent(maxval=1000) {
  rotate([0, 90, 0]) {
    translate([0, 0, -1])
      linear_extrude(maxval+1)
      YZPlaneIntersect(maxval) children();
    mirror([0, 0, 1])
      translate([0, 0, -1])
      linear_extrude(maxval+1)
      YZPlaneIntersect(maxval) children();
  }
}
module BoundingBox(maxval=1000) {
  intersection() {
    XYExtent(maxval) children();
    XZExtent(maxval) children();
    YZExtent(maxval) children();
  }
}
BallWithHole();
color("red", alpha=0.2) BoundingBox(100) BallWithHole();
Filename: None. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2025-03-22 19:39:56.942010. Pasted through web.