/projects/laboratory_trolley/
code_projectopenscad
// The bar used to build the base
//
// It's build by cutting out a shape on both ends
// of bar of dimension: length x 44 x 44
module base_bar(length) {
	translate([-length/2.0, -22, -22])
	difference() {
		cube(size = [length, 44, 44]);
		
		base_bar_cut(44);
		
		translate([length,0,44])
		rotate([0,180,0])
			base_bar_cut(44);
	}
}

// The shape to be cut out from the base bar
module base_bar_cut(width) {
	translate([-0.1, -0.1, width/2.0])
	cube(size=[width+0.1, width+0.2, width/2.0+0.1]);
	translate([-0.1, -0.1, -0.1])
	cube(size=[width/2.0+0.1, width/2.0+0.2, width+0.2]);
}

// The base
//
// It's build by 4 bars
// delta: give a positive value to disassemble the base
module base(length, width, delta) {
	translate([length/2.0, 22, 22]){

	base_bar(length);
	translate([0, width-44, 0])
	rotate([180, 0, 0])
	base_bar(length);

	translate([-(length/2.0)+22, (width/2.0)-22, 0])
	rotate([0 , 0, -90]) {
		translate([0,-delta,0])
		base_bar(width);
		translate([0, length-44+delta, 0])
		rotate([180, 0, 0])
		base_bar(width);
	}}
}

// Side bars
module sides() {
	translate([22, 22, 0])
	vertical_bar(600);

	translate([300-22, 22, 0])
	rotate([0, 0, 90])
	vertical_bar(600);

	translate([300-22, 500-22, 0])
	rotate([0, 0, 180])
	vertical_bar(600);

	translate([22, 500-22, 0])
	rotate([0, 0, 270])
	vertical_bar(600);
}

module vertical_bar(height) {
	translate([-22, -22, 0])
	difference() {
		cube(size=[44, 44, height]);

		translate([22, -0.1, -0.1])
		cube(size=[22.1, 44.2, 44.1]);
		translate([-0.1, 22, -0.1])
		cube(size=[44.2, 22.1, 44.1]);

		translate([22, -0.1, height-18])
		cube(size=[22.1, 44.2, 18.1]);
		translate([-0.1, 22, height-18])
		cube(size=[44.2, 22.1, 18.1]);
	}
}

// Top

module top(delta) {
	translate([150,22,0])
	top_bar(300-44);

	translate([150,500-22,0])
	rotate([0,0,180])
	top_bar(300-44);

	translate([22-delta,250,0])
	rotate([0,0,270])
	top_bar(500-44);

	translate([300-22+delta,250,0])
	rotate([0,0,90])
	top_bar(500-44);
}

module top_bar(length) {
	translate([-length/2.0, -22, 0])
	difference() {
		cube(size=[length, 44, 18]);
		
		translate([0,0,-0.1])
		linear_extrude(height=18.2) {
			polygon(points=[[-0.1,22-0.1], [22+0.1,44.1], [-0.1,44.1]], paths=[[0,1,2]]);
			polygon(points=[[length+0.1,22-0.1], [length-22+0.1,44.1], [length+0.1,44.1]], paths=[[0,1,2]]);
		}
	}
}

module wheel() {
	polygon(points = [ [0,0], [20,0], [23,15], [20,19], [14,19],[10,15], [0,0] ]);

	translate([0,0,10])
	polygon(points = [ [0,0], [20,0], [23,15], [20,19], [14,19],[10,15], [0,0] ]);

	translate([16,15,5])
	cylinder(10, 10, 10, true);
}

wheel();