$fn = 100; h = 10; module block() { translate([-h, -h]) cube([2*h, 2*h, h]); }; module cut() { translate([0, -h/2, h/2]) rotate([45, 0, 0]) translate([-1.5*h, -1.5*h]) cube([3*h, 3*h, h]); }; module pyramid() { difference() { block(); cut(); rotate(90) cut(); rotate(180) cut(); rotate(270) cut(); } }; //polyhedron( // points=[ // [h,h,0], [h,-h,0], [-h,-h,0], [-h,h,0], [0,0,h] // ], // faces = [ // [1,4,0], [2,4,1], [2,3,4], [4,3,0], // [0,3,2,1] // ] //); module quarter_pyramid() { difference() { pyramid(); rotate([0,0,45]) translate([-2*h, 0, -h]) cube([h*4,h*4,h*4]); rotate([0,0,-45]) translate([-2*h, -4*h, -h]) cube([h*4,h*4,h*4]); rotate([0,0,-45]) translate([0, -4*h, -h]) cube([h*4,h*4,h*4]); } }; //quarter_pyramid(); module bottom() { children(); }; module top() { translate([0,0,2*h]) rotate([180,0,0]) children(); }; module north() { translate([0,h,h]) rotate([90,90,0]) children(); }; module south() { rotate([0,0,180]) north() children(); }; module east() { translate([h,0,h]) rotate([90,0,0]) rotate([0,-90,0]) children(); }; module west() { rotate([0,0,180]) east() children(); }; module pointy() { translate([0,0,-2*h]) top() pyramid(); }; module partA() { translate([0,-h,-h]) rotate([180,-90,90]) quarter_pyramid(); }; module partB() { translate([0,-h,-h]) rotate([180,-90,-90]) quarter_pyramid(); }; module partC() { translate([-h,h,-h]) rotate([0,180,90]) { union() { partA(); partB(); } } }; module partD() { translate([0,h,-h]) rotate([90, 0, 0]) partC(); } module partE() { rotate([0,0,180]) partD(); } module puzzle_piece() { pyramid(); pointy(); partA(); partB(); partC(); partD(); partE(); } module cutout() { translate([0, -2.8, 0]) rotate([45, 45, 0]) translate([-h, -h, 0]) translate([0, 4.2, 4.2]) cube([2*h, 2*h, 2*h]); } module puzzle_part(){ difference() { rotate([0,45,0]) puzzle_piece(); cutout(); translate([0, 2*h, 0]) cutout(); mirror([0, 180, 0]) translate([4, -15, h]) rotate([45, 0, 45]) block(); translate([4, -15, h]) rotate([45, 0, 45]) block(); }} // module solved_puzzle(){ bottom() puzzle_piece(); top() puzzle_piece(); north() puzzle_piece(); south() puzzle_piece(); east() puzzle_piece(); west() puzzle_piece(); } module step_0(){ bottom() puzzle_piece(); south() puzzle_piece(); west() puzzle_piece(); } module step_1(){ bottom() puzzle_piece(); south() puzzle_piece(); east() puzzle_piece(); west() puzzle_piece(); } module step_2(){ bottom() puzzle_piece(); south() puzzle_piece(); east() puzzle_piece(); west() puzzle_piece(); north() puzzle_piece(); } step_2();