~bsprague/car-parts

e0bd9dd80b388b689a8cc9b1778a2531ed0c270e — Brandon Sprague 4 months ago
Initial commit of trunk floor
3 files changed, 193 insertions(+), 0 deletions(-)

A .gitignore
A README.md
A TrunkFloor.scad
A  => .gitignore +2 -0
@@ 1,2 @@
*.dxf
*.svg

A  => README.md +9 -0
@@ 1,9 @@
# Car Parts

This repo holds the models for parts I've made for my car, a 2001-2005 Honda Civic. All parts are written in [OpenSCAD](https://openscad.org/). It currently just has one part, and hopefully I won't be adding too many more.

## TrunkFloor.scad

This is a rough replacement for the HDF/Masonite piece that goes in the trunk under the car fabric stuff. Mine had some, uh, water damage. Replacements online seemed silly expensive ($150+), and I couldn't find just like, a diagram of the part, so I measured my (sad, disintegrating, warped) one and made this rough approximation.

The real one has nice smooth curves and stuff, but aesthetics (and rounded edges, and OpenSCAD in general) aren't my strong suit, so sharp lines it is.

A  => TrunkFloor.scad +182 -0
@@ 1,182 @@
// Note, we're assuming all units are inches, be warned!

offset = 0.0001;
width = 32;
height = 35.75;

top_left_corner_width = 4.75;
top_left_corner_height = 1 + 5/8;

top_right_corner_width = 7.25;
top_right_corner_height = 1 + 5/8;
top_right_corner_start = width - top_right_corner_width;

bottom_left_corner_width = 2 + 5/8;
bottom_left_corner_height = 2;

bottom_right_corner_height = 2;
bottom_right_corner_width = 5.5;
bottom_right_corner_start = width - bottom_right_corner_width;

module top_left_corner() {
	translate([-offset, -offset])
	square([top_left_corner_width, top_left_corner_height]);
}

module top_right_corner() {
	translate([top_right_corner_start, -offset])
	square([top_right_corner_width + offset, top_right_corner_height]);
}

module bottom_left_corner() {
	translate([-offset, height-bottom_left_corner_height + offset])
	square([bottom_left_corner_width, bottom_left_corner_height]);
}

module bottom_right_corner() {
	translate([bottom_right_corner_start + offset, height-bottom_right_corner_height + offset])
	square([bottom_right_corner_width, bottom_right_corner_height]);
}

module bottom_left_wedge() {
	wedge_height = 0.25;
	base_y = height - bottom_left_corner_height - wedge_height;
	points = [
		[-offset, base_y+wedge_height + offset* 10],
		[-offset, base_y + offset* 10],
		[bottom_left_corner_width, base_y + wedge_height + offset* 10],
	];
	polygon(points);
}

module bottom_right_wedge() {
	wedge_width = 1.5;
	wedge_height = 3.75;
	points = [
		[width - wedge_width + offset, height-bottom_right_corner_height + offset * 10],
		[width + offset, height - bottom_right_corner_height - wedge_height],
		[width + offset, height-bottom_right_corner_height + offset * 10],
	];
	polygon(points);
}

module top_right_wedge() {
	wedge_width = 3.25;
	wedge_height = 0.75;
	points = [
		[width - wedge_width,  top_right_corner_height - offset * 10],
		[width + offset,  top_right_corner_height - offset * 10],
		[width + offset,  top_right_corner_height + wedge_height - offset * 10],
	];
	polygon(points);
}

module hole() {
	square([1,0.5]);
}

circle_center_x = top_left_corner_width + 10 + 3/8;

module circle_divit() {
	r = 4.25 / 2;
	depth = 1.5;
	center = depth - r;
	translate([circle_center_x, center], $fn=25)
	circle(r);
}

module left_half() {
	translate([-offset*2, -offset*2])
	square([circle_center_x + offset*4, height + offset*4]);
}

module right_half() {
	translate([circle_center_x-offset, -offset])
	square([width+offset*2, height+offset*2]);
}

module top_half() {
	translate([-offset, -offset])
	square([width + offset*2, height/2 + offset*2]);
}

module bottom_half() {
	translate([-offset, height/2-offset])
	square([width+offset*2, height+offset*2]);
}

module trunk_floor() {
	difference(){
		square([width, height]);

		union() {
			top_left_corner();
			top_right_corner();
			bottom_left_corner();
			bottom_right_corner();

			// The two holes at the top
			translate([top_left_corner_width + 1 + 1/8, 1])  hole();
			translate([top_right_corner_start - 2 - 1/8, 1])  hole();

			bottom_left_wedge();
			bottom_right_wedge();
			top_right_wedge();

			circle_divit();
		}
	};
}

shift_offset = 2;

// Top left
difference() {
	trunk_floor();
	union() {
		
		// top_half();
		bottom_half();
		// left_half();
		right_half();
	}
}

// Top right, shifted
translate([shift_offset, 0])
difference() {
	trunk_floor();
	union() {
		
		// top_half();
		bottom_half();
		left_half();
		// right_half();
	}
}

// Bottom left, shifted
translate([0, shift_offset])
difference() {
	trunk_floor();
	union() {
		
		top_half();
		// bottom_half();
		// left_half();
		right_half();
	}
}

// Bottom right, shifted
translate([shift_offset, shift_offset])
difference() {
	trunk_floor();
	union() {
		
		top_half();
		// bottom_half();
		left_half();
		// right_half();
	}
}