232 lines
5.7 KiB
OpenSCAD
232 lines
5.7 KiB
OpenSCAD
/* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/* A side table. Units are supposed to be cm.
|
|
* You will need for this build:
|
|
* - 1 kind of lath
|
|
* - 1 kind of board
|
|
* - A saw (unless you have matching materials)
|
|
* - A drill
|
|
* - A screwdriver
|
|
* - A few screws
|
|
* - A rasp
|
|
* - A file and/or sandpaper (optional)
|
|
*
|
|
* For the windshields:
|
|
* - Another kind of lath
|
|
* - Magnets from cigarette paper packaging or bolts
|
|
*/
|
|
|
|
/* clang-format off */
|
|
include<vendor/roundedcube.scad>;
|
|
/* clang-format on */
|
|
|
|
$fs = 0.1;
|
|
|
|
table_width = 40.0; /* x */
|
|
table_depth = 30.0; /* y */
|
|
table_height = 80.0; /* z */
|
|
table_overhang = 2.0; /* Space between edge of table and leg. */
|
|
|
|
tabletop_height = 2.0; /* z */
|
|
|
|
leg_width = 4.0; /* x */
|
|
leg_depth = 4.0; /* y */
|
|
leg_height = table_height - tabletop_height; /* z */
|
|
|
|
module side_table()
|
|
{
|
|
echo("Leg height", leg_height);
|
|
|
|
module legs()
|
|
{
|
|
for (x = [table_overhang, table_width - leg_width - table_overhang])
|
|
{
|
|
for (y = [table_overhang, table_depth - leg_depth - table_overhang])
|
|
{
|
|
translate([x, y, 0])
|
|
{
|
|
cube(
|
|
[leg_width, leg_depth, table_height - tabletop_height]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module bracings()
|
|
{
|
|
z = leg_height - ceil(leg_height / 3);
|
|
echo("bracings start at height", z, "from bottom");
|
|
echo("bracings start at height", leg_height - z - leg_depth,
|
|
"from leg top");
|
|
|
|
for (x = [table_overhang, table_width - table_overhang - leg_width])
|
|
{
|
|
translate([x, table_overhang + leg_depth, z])
|
|
{
|
|
cube([
|
|
leg_width,
|
|
table_depth - (leg_depth * 2) - (table_overhang * 2),
|
|
leg_depth
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
|
|
module top()
|
|
{
|
|
translate([0, 0, table_height - tabletop_height])
|
|
{
|
|
roundedcube(size = [table_width, table_depth, tabletop_height],
|
|
radius = 0.3);
|
|
}
|
|
}
|
|
|
|
color("Tan")
|
|
{
|
|
legs();
|
|
}
|
|
|
|
if ((table_height / leg_width) > 10)
|
|
{
|
|
color("SandyBrown")
|
|
{
|
|
bracings();
|
|
}
|
|
}
|
|
|
|
color("BurlyWood")
|
|
{
|
|
top();
|
|
}
|
|
}
|
|
|
|
module windbreaks()
|
|
{
|
|
thickness = 1; /* x */
|
|
height = 4; /* z */
|
|
gap = 4; /* z */
|
|
margin = leg_width / 4; /* Between edge of tabletop and windbreaks. */
|
|
|
|
module magnets(length, h = 0.12, d = 0.5)
|
|
{
|
|
middle = thickness / 2;
|
|
for (y = [thickness * 2, length / 2, length - (thickness * 2)])
|
|
translate([middle, y, 0])
|
|
{
|
|
cylinder(h = h, d = d);
|
|
}
|
|
}
|
|
|
|
module windbreak(length)
|
|
{
|
|
difference()
|
|
{
|
|
color("SandyBrown")
|
|
{
|
|
cube([thickness, length, height]);
|
|
}
|
|
magnets(length = length);
|
|
}
|
|
}
|
|
|
|
module triangle(points, height)
|
|
{
|
|
linear_extrude(height)
|
|
{
|
|
polygon(points);
|
|
}
|
|
}
|
|
|
|
module side()
|
|
{
|
|
translate([0, 0, 0])
|
|
{
|
|
length = table_depth - (margin * 2);
|
|
|
|
difference()
|
|
{
|
|
windbreak(length);
|
|
translate([0, length - thickness, 0])
|
|
{
|
|
triangle(points = [[thickness, 0], [0, thickness],
|
|
[thickness, thickness]],
|
|
height = 4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module top()
|
|
{
|
|
translate([margin, table_depth - thickness - margin, 0])
|
|
{
|
|
length = table_width - (margin * 2);
|
|
|
|
rotate([0, 0, -90])
|
|
{
|
|
color("Tan")
|
|
{
|
|
difference()
|
|
{
|
|
windbreak(length);
|
|
triangle(points =
|
|
[
|
|
[0, 0], [thickness, thickness],
|
|
[thickness, 0]
|
|
],
|
|
height = 4);
|
|
translate([0, length - thickness, 0])
|
|
{
|
|
triangle(points = [[thickness, 0], [0, thickness],
|
|
[thickness, thickness]],
|
|
height = 4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
translate([0, margin, table_height + gap])
|
|
{
|
|
translate([0, 0, gap == 0 ? 0 : height / 2])
|
|
{
|
|
top();
|
|
}
|
|
|
|
/* Left */
|
|
translate([margin, 0, 0])
|
|
{
|
|
side();
|
|
}
|
|
|
|
/* Right */
|
|
translate([table_width - margin, 0, 0])
|
|
{
|
|
mirror([1, 0, 0])
|
|
{
|
|
side();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
side_table();
|
|
render()
|
|
{
|
|
windbreaks();
|
|
}
|