Browse Source

add a new example

master
Nicolas Massé 8 years ago
parent
commit
c23e646af4
  1. 2
      README.md
  2. 8
      examples/moucharabieh/README.md
  3. BIN
      examples/moucharabieh/images/moucharabieh_panel.png
  4. BIN
      examples/moucharabieh/images/moucharabieh_pattern.png
  5. 74
      examples/moucharabieh/moucharabieh.scad

2
README.md

@ -8,7 +8,7 @@ surface.
Patterns are widely used in common objects, and so are the possible usages of
this module:
- [alveolar reinforcement](examples/reinforcement/)
- moucharabieh
- [moucharabieh](examples/moucharabieh/)
- decorative patterns
- surface texturing

8
examples/moucharabieh/README.md

@ -0,0 +1,8 @@
# A moucharabieh
This example shows how to build a panel with a moucharabieh pattern.
## Showcase
![pattern](images/moucharabieh_pattern.png?raw=true)
![the finished panel](images/moucharabieh_panel.png?raw=true)

BIN
examples/moucharabieh/images/moucharabieh_panel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
examples/moucharabieh/images/moucharabieh_pattern.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

74
examples/moucharabieh/moucharabieh.scad

@ -0,0 +1,74 @@
// First, include the module
use <../../pattern.scad>
// Define the base shape: a very modern moucharabieh
module moucharabieh(l = 10, w = 1) {
// epsilon is an infinitesimally small value that is added to the outter
// surfaces in order to get rid of the zero thickness artifacts induced
// by the "difference" operation.
epsilon = 0.1;
difference() {
// start with a plain square
square([ l, l ], center=true);
// and then dig the holes in it
union() {
for(i = [0 : 3]) {
rotate([ 0, 0, i*90 ])
union() {
translate([ l / 2 - w, l / 2 - w])
square([w + epsilon, w + epsilon]);
translate([ -l / 2 + 2 * w, l / 2 - w])
square([ l - 4 * w, w + epsilon ]);
translate([ -l / 2 + 2 * w, -l / 2 + 2 * w ])
square([ w, w ]);
translate([ -l / 2 + 2 * w, -l / 2 + 3 * w, 0 ])
rotate([ 0, 0, -45 ])
square([ sqrt(2 * pow(w, 2)), sqrt(pow(l/2 - 3*w, 2) + pow(l / 2 - 3 * w, 2)) - w]);
polygon(points = [ [ 0, w + sqrt(2 * w) ],
[ l / 2 - (w + sqrt(2 * w)), l/2],
[ -l/2 + (w + sqrt(2 * w)), l/2 ] ]);
}
}
rotate([ 0, 0, 45 ]) square([ sqrt(2 * w), sqrt(2 * w) ], center=true);
}
}
}
// Instanciate the base shape, once.
size = 10;
moucharabieh(l=size);
// Define our moves: how the pattern is sprayed
moves = [
[ size, 0 ], // For the first move, we will translate on x by two times the radius
[ 0, size ], // For the second move, we will translate on y by two times the radius
];
// Define the boundaries: the area to spray is defined by a rectangle
bounding_box = [
[ 0, 0 ], // Lower left corner
[ 100, 50 ] // upper right corner
];
translate([ 30, 0, 0 ]) union() {
// Spray our pattern in the bounding box
// and extrude it
linear_extrude(height = 1, center = true)
spray_pattern(bounding_box, moves)
moucharabieh(l=size, w=1);
// Build a border around the moucharabieh
border = 5;
linear_extrude(height = border, center = true) difference() {
polygon(points = [ bounding_box[0] - [ border, border ],
[ bounding_box[0].x - border, bounding_box[1].y + border ],
bounding_box[1] + [ border, border ],
[ bounding_box[1].x + border, bounding_box[0].y - border ] ]);
polygon(points = [ bounding_box[0],
[ bounding_box[0].x, bounding_box[1].y ],
bounding_box[1],
[ bounding_box[1].x, bounding_box[0].y ] ]);
}
}
Loading…
Cancel
Save