Skip to content

Instantly share code, notes, and snippets.

@rquackenbush
Created February 25, 2026 14:51
Show Gist options
  • Select an option

  • Save rquackenbush/6881742e558dea7d6d568fa8fd349d0b to your computer and use it in GitHub Desktop.

Select an option

Save rquackenbush/6881742e558dea7d6d568fa8fd349d0b to your computer and use it in GitHub Desktop.
Hello world in OpenSCAD
$cubeSize=10;
$cubeCountX=3;
$cubeCountY=3;
$cubeCountZ=5;
for(x = [1:1:$cubeCountX])
for(y = [1:1:$cubeCountY])
for(z = [1:1:$cubeCountZ])
color([x / $cubeCountX, y / $cubeCountY, z / $cubeCountZ])
translate([x * $cubeSize, y * $cubeSize, z * $cubeSize])
cube([$cubeSize, $cubeSize, $cubeSize]);
* color("red")
cube([$cubeSize, $cubeSize, $cubeSize]);
* color("blue")
translate([0,0,$cubeSize])
cube([$cubeSize,$cubeSize,$cubeSize]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment