~bsprague/car-parts

6d1bc36ab70119ade71e731f19d62f918eb14ef9 — Brandon Sprague 4 months ago e0bd9dd
Formatting + comments
1 files changed, 135 insertions(+), 119 deletions(-)

M TrunkFloor.scad
M TrunkFloor.scad => TrunkFloor.scad +135 -119
@@ 5,178 5,194 @@ width = 32;
height = 35.75;

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

top_right_corner_width = 7.25;
top_right_corner_height = 1 + 5/8;
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_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_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 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_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_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_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 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 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]);
module hole()
{
    square([ 1, 0.5 ]);
}

circle_center_x = top_left_corner_width + 10 + 3/8;
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 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 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 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 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 bottom_half()
{
    translate([ -offset, height / 2 - offset ]) square([ width + offset * 2, height + offset * 2 ]);
}

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

		union() {
			top_left_corner();
			top_right_corner();
			bottom_left_corner();
			bottom_right_corner();
        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();
            // 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();
            bottom_left_wedge();
            bottom_right_wedge();
            top_right_wedge();

			circle_divit();
		}
	};
            circle_divit();
        }
    };
}

// We break it into four pieces initially so I can test it out on the laser
// cutter before using the CNC.
shift_offset = 2;

// Top left
difference() {
	trunk_floor();
	union() {
		
		// top_half();
		bottom_half();
		// left_half();
		right_half();
	}
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();
	}
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();
	}
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();
	}
translate([ shift_offset, shift_offset ]) difference()
{
    trunk_floor();
    union()
    {

        top_half();
        // bottom_half();
        left_half();
        // right_half();
    }
}