module puzzle_line(a=20, b=15, z=40, h=10) {
	render()
	difference() {
		union() {
			cube([1, z, h]);

			hull() {
				translate([0,(z-a)/2,0])
				cube([0.5, a, h]);
				translate([1.5,(z-b)/2,0])
				cube([0.5, b, h]);
			}
		}

		hull() {
			translate([-0.5,(z-(a-1))/2,0])
				cube([0.5, (a-1), h]);
		  translate([0.5,(z-(b-1))/2,0])
				cube([0.5, (b-1), h]);
		}
	}
}

module contour(h=70) {
	for(r = [0:5]) {
		rotate([0,0,(r+0.5)*60])
		translate([10.9,-6.88,0])
	  {
			if( r%2 == 0 ) {
				mirror([1,0,0])
				translate([-1,0,0])
				puzzle_line(5.7, 3.2, z=6.88*2, h=h);
			} else {
				puzzle_line(4.5, 2.2, z=6.88*2, h=h);
			}
		}
	}
}

module contour_hull(h=1, a=5.7, b=3.2, z=6.88*2, a0=4.5,b0=2.2,z0=6.88*2) {
	render()
	difference() {
		union() {
			cylinder(d=27, h=h, $fn=6);

			for(r = [0:2]) {
				rotate([0,0,r*120-30])
				translate([10.9,-6.88,0]) {
					hull() {
						translate([-0.5,(z0-(a0-1))/2,0])
						cube([0.5, (a0-1), h]);
					  translate([0.5,(z0-(b0-1))/2,0])
						cube([0.5, (b0-1), h]);
					}
				}
			}
		}

		for(r = [0:2]) {
			rotate([0,0,30+r*120])
			translate([10.9,-6.88,0])
				mirror([1,0,0])
				translate([-1,0,0])
				{

				hull() {
					translate([-0.5,(z-(a-1))/2,0])
					cube([0.5, (a-1), h]);
				  translate([0.5,(z-(b-1))/2,0])
					cube([0.5, (b-1), h]);
				}
			}
		}
	}
}

module inner_contour(h=70) {
	for(r = [0:5]) {
		rotate([0,0,(r+0.5)*60])
		translate([10.5-1,-6,0])
	  {
			if( r%2 == 0 ) {
				mirror([1,0,0])
				translate([-1,0,0])
				puzzle_line(6, 4.4, z=6*2, h=h);
			} else {
				puzzle_line(4.5, 1, z=6*2, h=h);
			}
		}
	}
}

module inner_contour_hull(h=1, a=5.7, b=3.2, z=6.88*2, a0=4.4,b0=2.1,z0=6.88*2) {
	render()
	union() {
		cylinder(d=22.6, h=h, $fn=6);
		inner_contour(h=h);
	}
}

module inner(h=70) {
	{
		render()
		difference()
		{
			inner_contour(h=h);

			translate([-20,4,0])
			cube([40, 15, h]);
		}

		// back
		inner_contour_hull();

		// front
		translate([0,0,h])
		{
			front();
	
		color([0,0,1])
		{
			translate([0,4,10])
			text("220", size=6, halign="center", font="+Jakatar");

			translate([0,-8,10])
			text("Ω", size=10, halign="center", font="+Jakatar");
		}
		}
	}
}



module outer(h=70) {
	translate([0,0,-10])
	cylinder(d=15.5, h=10, $fn=6);

	contour(h=h);

	translate([0,0,0])
	contour_hull();
}


color([1,1,0])
translate([0,0,10])
inner(h=70);

color([0.7, 0.4, 0.4])
outer(h=70);