Translate generator to module
This commit is contained in:
parent
a1df26afeb
commit
39057113bc
@ -1,24 +1,35 @@
|
|||||||
INNER_X=60;
|
|
||||||
INNER_Y=60;
|
|
||||||
INNER_Z=30;
|
|
||||||
WALLSIZE=4;
|
|
||||||
|
|
||||||
OVERLAP_Z=WALLSIZE;
|
|
||||||
/*
|
/*
|
||||||
|
* hello.scad! :)
|
||||||
|
* It is possible to use this generator in two ways:
|
||||||
|
* - Simply, generate boxes (see [1])
|
||||||
|
* - Include this file to generate boxes in other SCAD files (see [2])
|
||||||
|
*
|
||||||
|
* [1] Generate boxes
|
||||||
|
* Uncomment one of the three following lines: */
|
||||||
|
// generate_box(INNER_X, INNER_Y, INNER_Z, WALLSIZE);
|
||||||
|
// generate_box(INNER_X, INNER_Y, INNER_Z, WALLSIZE, OVERLAP_Z);
|
||||||
|
// generate_box(INNER_X, INNER_Y, INNER_Z, WALLSIZE, OVERLAP_Z, [NOTCH_WIDTH, NOTCH_DEPTH]);
|
||||||
|
// Small example for a box width inner size 60x60x30, wall size 4, wall-sized overlap and a small notch:
|
||||||
|
generate_box(60, 60, 30, 4, 4, 5, 2);
|
||||||
|
/*
|
||||||
|
* [2] Include & Generate
|
||||||
|
* Copy and paste this line to another file: */
|
||||||
|
// use Box_Type2_Generator.scad;
|
||||||
|
|
||||||
|
/* Some explanations to the parameters:
|
||||||
|
* === OVERLAP_Z ===
|
||||||
* The size of the inner overlap size
|
* The size of the inner overlap size
|
||||||
* Set OVERLAP_Z to 0 to deactivate the overlap area at all.
|
* Set OVERLAP_Z to 0 to deactivate the overlap area at all.
|
||||||
* In most cases, it should be enough to set it to WALLSIZE.
|
* In most cases, it should be enough to set it to WALLSIZE.
|
||||||
*/
|
*
|
||||||
|
* === NOTCH_DEPTH ===
|
||||||
NOTCH_WIDTH=5;
|
|
||||||
NOTCH_DEPTH=2;
|
|
||||||
/*
|
|
||||||
* NOTCH_DEPTH < WALLSIZE for obvious reasons.
|
* NOTCH_DEPTH < WALLSIZE for obvious reasons.
|
||||||
* Set NOTCH_DEPTH to 0 to deactivate the notch at all.
|
* Set NOTCH_DEPTH to 0 to deactivate the notch at all.
|
||||||
* Idea behind the notch: you can secure the box lid with e.g. a rubber band
|
* Idea behind the notch: you can secure the box lid with e.g. a rubber band
|
||||||
*/
|
*/
|
||||||
|
|
||||||
difference() {
|
module generate_box(INNER_X, INNER_Y, INNER_Z, WALLSIZE, OVERLAP_Z, NOTCH_WIDTH, NOTCH_DEPTH) {
|
||||||
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
// The main box
|
// The main box
|
||||||
difference() {
|
difference() {
|
||||||
@ -42,4 +53,5 @@ difference() {
|
|||||||
translate([INNER_X/2-NOTCH_WIDTH/2+WALLSIZE, INNER_Y+WALLSIZE+NOTCH_DEPTH, 0])
|
translate([INNER_X/2-NOTCH_WIDTH/2+WALLSIZE, INNER_Y+WALLSIZE+NOTCH_DEPTH, 0])
|
||||||
cube([NOTCH_WIDTH, NOTCH_DEPTH, INNER_Z+WALLSIZE*6]);
|
cube([NOTCH_WIDTH, NOTCH_DEPTH, INNER_Z+WALLSIZE*6]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user