185 lines
6.9 KiB
OpenSCAD
185 lines
6.9 KiB
OpenSCAD
|
|
// -----------------------------------------------------------------------
|
|
// frame is a project to generate connectors to build a frame which can
|
|
// be used to build anything by combining the connections and the struts.
|
|
// It will, however, just produce parts for a frame, not the walls or
|
|
// plates to be used to hold any equipment.
|
|
//
|
|
// The frames consist of two kinds of elements:
|
|
// - struts: Currently just a straight line between two connectors.
|
|
// The strut has two endings which are a bit smaller than
|
|
// the strut and fit into the connectors.
|
|
// - connectors: The connectors in different variations
|
|
// --------------------------------------------------------------------
|
|
/* [Connector Options] */
|
|
// The kind of connections
|
|
Connector_kind = 0; // [ 0 : None, 1 : Strut, 2 : Minus, 3 : Plus, 4 : Three Flat, 5 : Three Corner, 6 : Four Corner, 7 : Five Connectors, 8 : Six Connectors ]
|
|
// The length of a strut without connectors
|
|
strut_length = 10; // [ 1.0 : 220.0 ]
|
|
// Use the attachment for struts?
|
|
strut_attachment = false;
|
|
|
|
/* [Hidden] */
|
|
// **********************
|
|
// ** Static Settings: **
|
|
// **********************
|
|
include <static.scad>
|
|
|
|
// --------------------------------------------------------------------
|
|
// a strut, beginning and ending with a connector.
|
|
// The connectors are a bit smaller than the holes in the
|
|
// connections to make them fit better.
|
|
// Please edit the connector_correction in static.scad to
|
|
// your needs.
|
|
// --------------------------------------------------------------------
|
|
module strut (strutlength, size, wall, correction, attachment) {
|
|
|
|
shift = wall + correction;
|
|
plugsize = size - 2 * shift;
|
|
translate ([0, shift, shift])
|
|
cube(plugsize);
|
|
translate([plugsize, 0, 0])
|
|
cube([strutlength, size, size]);
|
|
translate([plugsize + strutlength, shift, shift])
|
|
cube(plugsize);
|
|
if (attachment[0]) {
|
|
// the attachment is located on the front of the strut, but
|
|
// raised for the amount of thickness of the plate. The
|
|
// width of the attachment is variable but should not be too
|
|
// small.
|
|
translate([plugsize, -attachment[2], attachment[1]])
|
|
cube([strutlength, attachment[2], wall]);
|
|
}
|
|
}
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
// a single connector which connects to one side of a strut.
|
|
// Will be combined to multiple way connectors by adding, translating
|
|
// and rotating the required connectors
|
|
// --------------------------------------------------------------------
|
|
module connector(size = connector_length, wall = wall_thickness) {
|
|
difference () {
|
|
cube(size);
|
|
translate([wall, wall, wall])
|
|
#cube([size , size - 2 * wall, size - 2 * wall]);
|
|
}
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// a straight connection of two connectors
|
|
// --------------------------------------------------------------------
|
|
module minus(size, wall) {
|
|
cube(size);
|
|
translate ([size, 0, 0])
|
|
connector(size = size, wall = wall);
|
|
translate ([0, 0, size])
|
|
rotate (a = [0, 180, 0])
|
|
connector(size = size, wall = wall);
|
|
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// four connections with a 90 degree angle
|
|
// --------------------------------------------------------------------
|
|
module plus(size, wall) {
|
|
minus(size = size, wall = wall);
|
|
translate ([size, 0, 0])
|
|
rotate (a = [0, 0, 90])
|
|
minus(size = size, wall = wall);
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// A three way connector
|
|
// --------------------------------------------------------------------
|
|
module threeflat(size, wall) {
|
|
minus(size = size, wall = wall);
|
|
translate ([size, size, 0])
|
|
rotate (a = [0, 0, 90])
|
|
connector(size = size, wall = wall);
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// A three way connector to build the corners of a housing
|
|
// The basic building block for the connections. All others
|
|
// just add a connector to the previous one.
|
|
// --------------------------------------------------------------------
|
|
module threecorner(size, wall) {
|
|
cube(size);
|
|
translate ([size, 0, 0])
|
|
connector(size = size, wall = wall);
|
|
translate ([size, size, 0])
|
|
rotate (a = [0, 0, 90])
|
|
connector(size = size, wall = wall);
|
|
translate ([size, 0, size])
|
|
rotate (a = [0, 270, 0])
|
|
connector(size = size, wall = wall);
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// A four way connector used either as a stand in the four corners
|
|
// or for a new section between the bottom and the top
|
|
// --------------------------------------------------------------------
|
|
module fourcorner(size, wall) {
|
|
threecorner(size = size, wall = wall);
|
|
translate ([0, 0, size])
|
|
rotate (a = [0, 180, 0])
|
|
connector(size = size, wall = wall);
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// basicly a plus with a connection on the top
|
|
// --------------------------------------------------------------------
|
|
module fiveway(size, wall) {
|
|
fourcorner(size = size, wall = wall);
|
|
rotate (a = [0, 0, 270])
|
|
connector(size = size, wall = wall);
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// a plus with a connection on the bottom and the top,
|
|
// like a star ...
|
|
// --------------------------------------------------------------------
|
|
module sixway(size, wall) {
|
|
fiveway(size = size, wall = wall);
|
|
rotate (a = [0, 90, 0])
|
|
connector(size = size, wall = wall);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
module main() {
|
|
if (Connector_kind == 0) {
|
|
echo("No connection selected. Please select one of the connector types");
|
|
}
|
|
else if (Connector_kind == 1) {
|
|
strut(strutlength = strut_length,
|
|
size = CONNECTOR_LENGTH,
|
|
wall = WALL_THICKNESS,
|
|
attachment = [strut_attachment, PLATE_THICKNESS, PLATEHOLDER_WIDTH],
|
|
correction = CONNECTOR_CORRECTION);
|
|
}
|
|
else if (Connector_kind == 2) {
|
|
minus(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 3) {
|
|
plus(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 4) {
|
|
threeflat(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 5) {
|
|
threecorner(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 6) {
|
|
fourcorner(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 7) {
|
|
fiveway(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
else if (Connector_kind == 8) {
|
|
sixway(size = CONNECTOR_LENGTH, wall = WALL_THICKNESS);
|
|
}
|
|
}
|
|
|
|
// Do it!
|
|
main(); |