Interactive Preview & Customizer
3D STL viewer with browser-based OpenSCAD rendering on parameter changes.
Loading preview...
The side length of the cube in mm
step 1
The diameter of the holes
step 0.5
How far the holes extend (must be larger than cube size for through-holes)
step 1
Smoothness of the circular holes
step 1
WASM compiler loads on first parameter change.
Prompt
Create a cube with a hole on every face.
OpenSCAD Code
/* [Cube Settings] */
// The side length of the cube in mm
cube_size = 40; // [10:1:200]
/* [Hole Settings] */
// The diameter of the holes
hole_diameter = 20; // [2:0.5:150]
// How far the holes extend (must be larger than cube size for through-holes)
hole_length_offset = 2; // [1:1:10]
/* [Quality] */
// Smoothness of the circular holes
$fn = 64; // [32:8:128]
/* [Hidden] */
// Calculate total length to ensure clean cuts
total_hole_len = cube_size + hole_length_offset;
module cube_with_holes() {
difference() {
// Main Cube
cube(cube_size, center = true);
// Hole through X-axis (Left/Right faces)
rotate([0, 90, 0])
cylinder(h = total_hole_len, d = hole_diameter, center = true);
// Hole through Y-axis (Front/Back faces)
rotate([90, 0, 0])
cylinder(h = total_hole_len, d = hole_diameter, center = true);
// Hole through Z-axis (Top/Bottom faces)
cylinder(h = total_hole_len, d = hole_diameter, center = true);
}
}
// Render the final model
cube_with_holes();