use <MCAD/boxes.scad>


eps = 0.0001;

$preview = false;

// mirror([0, 0, 1])
// {
//     translate([0, 0, 1-eps]) roundedBox([15, 74, 2], 15/2, true, $fn = $preview ? 32 : 100);
    // KandM_14510_Mount();
// }

// KandM_14510_PressIn_Support(73);

module KandM_14510_Mount(floor_height = 1, cutout = false)
{
    Pick_T = 1.0;
    Pick_H = 13;
    Pick_W = 60;
    
	Outer_T = 7.5;
	Outer_H = Pick_H;
	Outer_W = 67.5;

	Wall_T = 2.0;

	if(cutout)
	{
		roundedBox([Outer_T + 2*Wall_T  , Outer_W + 2*Wall_T, 1*Outer_H], (Outer_T + 2*Wall_T)/2, true, $fn = $preview ? 32 : 100);
	}
	else
	{
		translate([0, 0, floor_height/2-eps])
		roundedBox([Outer_T + 2*Wall_T  , Outer_W + 2*Wall_T, floor_height], (Outer_T + 2*Wall_T)/2, true, $fn = $preview ? 32 : 100);
		translate([0, 0, -Pick_H/2])
		difference()
		{
			union()
			{
				roundedBox([Pick_T, Pick_W, Pick_H], Pick_T/2, true, $fn = $preview ? 32 : 100);

				difference()
				{
					roundedBox([Outer_T + 2*Wall_T  , Outer_W + 2*Wall_T, 1*Outer_H], (Outer_T + 2*Wall_T)/2, true, $fn = $preview ? 32 : 100);
					roundedBox([Outer_T             , Outer_W           , 2*Outer_H], Outer_T/2             , true, $fn = $preview ? 32 : 100);
				}
			}

			translate([0, 0, -3])
			rotate([0, 90, 0])
			cylinder(d=3.6, h=2*(Outer_W + 2*Wall_T), center=true, $fn = $preview ? 32 : 100);
		}
	}
}

module KandM_14510_PressIn_Support(height = 1)
{
	mirror([0, 0, 1])
	union()
	{
		rotate([0, 90, 0])
		cylinder(d=15, h=height, center=true, $fn = $preview ? 32 : 100);

		translate([0, 0, 15/2])
		cube([height, 9.5, 4], center=true);

		translate([0, 0, 15/2 + 4/2 + 3/2 - eps])
		roundedBox([height, 20, 3], 2, true, $fn = $preview ? 32 : 100);
	}
}