Created
June 18, 2024 19:46
-
-
Save XerxesZorgon/25800442ffd0fec3e7944a3eb2179ef0 to your computer and use it in GitHub Desktop.
OpenSCAD model of CSG tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shape parameters | |
sphereRadius = 0.65; | |
cylinderRadius = 0.3; | |
cylinderHeight = 1.1; | |
// Top level difference operation | |
difference(){ | |
// Intersection of cube and sphere | |
intersection(){ | |
// Red cube with unit sides | |
color("red", 1.0){ | |
cube([1, 1, 1], center = true); | |
} | |
// Blue sphere | |
color("blue", 1){ | |
sphere(r = sphereRadius, $fn = 128); | |
} | |
} | |
// Union of three cylinders centered on each axis | |
color("Lime", 1.0){ | |
union(){ | |
union(){ | |
cylinder(h = cylinderHeight, r = cylinderRadius, $fn = 128, center = true); | |
rotate([90,0,0]){ | |
cylinder(h = cylinderHeight, r = cylinderRadius, $fn = 128, center = true); | |
} | |
} | |
rotate([0,90,0]){ | |
cylinder(h = cylinderHeight, r = cylinderRadius, $fn = 128, center = true); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment