Commit f01131c4 authored by Jan Koniarik's avatar Jan Koniarik
Browse files

fixed holes orientation

parent f4a2448b
include <tile.scad>
translate([24*2,24*2,0])
tile(T24, h=2);
//tile(T24, h=5);
//tile(T24, h=5, centered_hole=true);
//tile_H(T24, h=5);
//tile_raw_plate(T24, 2, 3, 2);
# Gallery of tile examples
## example/tile_T24_5mm.scad
![example/tile_T24_5mm](example/tile_T24_5mm.png)
## example/tile_T24_5mm_centered.scad
![example/tile_T24_5mm_centered](example/tile_T24_5mm_centered.png)
## example/tile_H_T24_5mm.scad
![example/tile_H_T24_5mm](example/tile_H_T24_5mm.png)
## example/tile_sandwitch.scad
![example/tile_sandwitch](example/tile_sandwitch.png)
## example/tile_T24_2mm.scad
......@@ -11,5 +11,5 @@
![example/tile_raw_plate_T24_2x3_2mm](example/tile_raw_plate_T24_2x3_2mm.png)
## example/tile_T36_5mm.scad
![example/tile_T36_5mm](example/tile_T36_5mm.png)
## example/tile_H_T24_5mm.scad
![example/tile_H_T24_5mm](example/tile_H_T24_5mm.png)
## example/tile_T24_5mm.scad
![example/tile_T24_5mm](example/tile_T24_5mm.png)
example/tile_H_T24_5mm.png

11.1 KB | W: | H:

example/tile_H_T24_5mm.png

12.4 KB | W: | H:

example/tile_H_T24_5mm.png
example/tile_H_T24_5mm.png
example/tile_H_T24_5mm.png
example/tile_H_T24_5mm.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_T24_2mm.png

10.1 KB | W: | H:

example/tile_T24_2mm.png

9.97 KB | W: | H:

example/tile_T24_2mm.png
example/tile_T24_2mm.png
example/tile_T24_2mm.png
example/tile_T24_2mm.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_T24_5mm.png

8.42 KB | W: | H:

example/tile_T24_5mm.png

8.09 KB | W: | H:

example/tile_T24_5mm.png
example/tile_T24_5mm.png
example/tile_T24_5mm.png
example/tile_T24_5mm.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_T24_5mm_centered.png

10 KB | W: | H:

example/tile_T24_5mm_centered.png

9.96 KB | W: | H:

example/tile_T24_5mm_centered.png
example/tile_T24_5mm_centered.png
example/tile_T24_5mm_centered.png
example/tile_T24_5mm_centered.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_T36_5mm.png

9.18 KB | W: | H:

example/tile_T36_5mm.png

8.82 KB | W: | H:

example/tile_T36_5mm.png
example/tile_T36_5mm.png
example/tile_T36_5mm.png
example/tile_T36_5mm.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_raw_plate_T24_2x3_2mm.png

8.54 KB | W: | H:

example/tile_raw_plate_T24_2x3_2mm.png

8.54 KB | W: | H:

example/tile_raw_plate_T24_2x3_2mm.png
example/tile_raw_plate_T24_2x3_2mm.png
example/tile_raw_plate_T24_2x3_2mm.png
example/tile_raw_plate_T24_2x3_2mm.png
  • 2-up
  • Swipe
  • Onion skin
example/tile_sandwitch.png

9.52 KB | W: | H:

example/tile_sandwitch.png

9.14 KB | W: | H:

example/tile_sandwitch.png
example/tile_sandwitch.png
example/tile_sandwitch.png
example/tile_sandwitch.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -13,112 +13,153 @@ function Tnut_h(class) = class[5];
function Tscrew_d(class) = class[6];
module tile(class, h, center = false, centered_hole = false) difference() {
tile_pos(class = class, h = h, center = center);
tile_neg(class = class, h = h, center = center,
centered_hole = centered_hole);
tile_pos(class = class, h = h, center = center);
tile_neg(class = class, h = h, center = center,
centered_hole = centered_hole);
}
module tile_neg(class, h, center = false, centered_hole = false) {
translate([ 0, 0, center ? 0 : h / 2 ]) for (alpha = [ 0, 180 ])
rotate([ alpha, 0, 0 ]) tile_screw_pos(class = class) tile_screw_hole(
class = class, h = h, centered_hole = centered_hole);
tile_center_hole(class, h + 2, center = center);
translate([ 0, 0, center ? 0 : h / 2 ]) for (alpha = [ 0, 180 ])
rotate([ alpha, 0, 0 ]) tile_screw_pos(class = class)
tile_screw_hole(class = class, h = h,
centered_hole = centered_hole);
tile_center_hole(class, h + 2, center = center);
}
module tile_pos(class, h, center = false)
linear_extrude(height = h, center = center, convexity = 10)
tile_relief(class = class, a = Ta(class), corner_r = Tcorner(class),
t = Tt(class), nut_d = Tnut_d(class));
module tile_H(class, h) color("purple") render() difference() {
top_offset = Ta(class) + h;
z_center = Ta(class) / 2 + h;
center_t = Tt(class) + 2 * Tnut_h(class);
union() {
translate([ 0, 0, z_center ])
cube([ Ta(class), center_t, Ta(class) + 2 * h ], center = true);
for (z = [ 0, top_offset ])
translate([ 0, 0, z ]) linear_extrude(height = h)
tile_base_shape(l = Ta(class), corner_r = Tcorner(class));
}
translate([ 0, 0, z_center ]) rotate([ 90, 0, 0 ]) {
tile_neg(class, h = center_t, center = true, centered_hole = true);
tile_center_hole(class, h = center_t, center = true);
}
for (z = [ 0, top_offset ])
translate([ 0, 0, z ]) tile_center_hole(class, h = h);
tile_screw_pos(class = class) translate([ 0, 0, h / 2 ])
tile_screw_hole(class = class, h = h);
mirror([ 1, 0, 0 ]) tile_screw_pos(class = class)
translate([ 0, 0, Ta(class) + h + Tt(class) ]) rotate([ 180, 0, 0 ])
tile_screw_hole(class = class, h = h);
tile_relief(class = class);
module tile_H(class, h, n = 1, center_t = undef) render()
difference() {
top_offset = n * Ta(class) + h;
z_center = n * Ta(class) / 2 + h;
center_t =
(center_t == undef) ? Tt(class) + 2 * Tnut_h(class) : center_t;
union() {
translate([ 0, 0, z_center ])
cube([ Ta(class), center_t, n * Ta(class) + 2 * h ],
center = true);
for (z = [ 0, top_offset ])
translate([ 0, 0, z ]) linear_extrude(height = h)
tile_base_shape(l = Ta(class),
corner_r = Tcorner(class));
}
for (i = [0.5:n])
translate([ 0, 0, h + i * Ta(class) ]) rotate([ 90, 0, 0 ]) {
tile_neg(class, h = center_t, center = true,
centered_hole = true);
tile_center_hole(class, h = center_t, center = true);
}
for (z = [ 0, top_offset ])
translate([ 0, 0, z ]) tile_center_hole(class, h = h);
mirror([ 1, 0, 0 ]) tile_screw_pos(class = class)
translate([ 0, 0, h / 2 ]) tile_screw_hole(class = class, h = h);
tile_screw_pos(class = class)
translate([ 0, 0, top_offset + Tt(class) ]) rotate([ 180, 0, 0 ])
tile_screw_hole(class = class, h = h);
}
module tile_box_side_pos() {
children();
for (alpha = [0:90:360]) rotate([ 90, 0, alpha ]) children();
rotate([ 180, 0, 0 ]) children();
}
module tile_box(class) difference() {
hull() {
r = Tt(class);
cube([ Ta(class) - r, Ta(class) - r, Ta(class) ],
center = true);
cube([ Ta(class), Ta(class) - r, Ta(class) - r ],
center = true);
cube([ Ta(class) - r, Ta(class), Ta(class) - r ],
center = true);
}
tile_box_side_pos() cylinder(d = Ta(class) / 2, h = Ta(class));
tile_box_side_pos() tile_screw_pos(class = class)
translate([ 0, 0, Ta(class) / 2 - Tnut_h(class) - 1.5 * Tt(class) ])
Mnut_sidehole(M2N, 10);
tile_box_side_pos() tile_screw_pos(class = class)
cylinder(d = Tscrew_d(class), h = 20);
}
module tile_raw_plate(class, x, y, t) {
for (i = [0:x - 1], j = [0:y - 1])
translate([ i * Ta(class), j * Ta(class), 0 ]) difference() {
tile_pos(class, h = t, center = false);
tile_screw_pos(class = class)
cylinder(d = Tscrew_d(class), h = 100, center = true);
}
for (i = [0:x - 1])
for (j = [0:y - 1])
translate([ i * Ta(class), j * Ta(class), 0 ])
difference() {
tile_pos(class, h = t, center = false);
tile_screw_pos(class = class)
cylinder(d = Tscrew_d(class), h = 100,
center = true);
}
}
// Implementation
// ------------------------------------
module tile_center_hole(class, h, center = false) {
cylinder(d = Ta(class) / 2, h = h, center = center, $fn = 8);
cylinder(d = Ta(class) / 2, h = h, center = center, $fn = 8);
}
module tile_base_shape(l, corner_r) {
hull() {
square([ l - corner_r * 2, l ], center = true);
square([ l, l - corner_r * 2 ], center = true);
}
hull() {
square([ l - corner_r * 2, l ], center = true);
square([ l, l - corner_r * 2 ], center = true);
}
}
module tile_relief(class, a, corner_r, t, nut_d) {
tile_base_shape(a, corner_r);
tile_base_shape(Ta(class), Tcorner(class));
}
module tile_screw_pos(class) {
for (alpha = [0:90:360])
rotate([ 0, 0, alpha ]) translate(Tscrew_coord(class)) children();
for (alpha = [0:90:360])
rotate([ 0, 0, alpha ]) translate(Tscrew_coord(class))
children();
}
module tile_plate(class, t) difference() {
linear_extrude(height = t) tile_base_shape(Ta(class), Tcorner(class));
linear_extrude(height = t) tile_base_shape(Ta(class), Tcorner(class));
mirror([ 1, 0, 0 ]) tile_screw_pos(class)
cylinder(d = Tscrew_d(class), h = t * 3, center = true);
mirror([ 1, 0, 0 ]) tile_screw_pos(class)
cylinder(d = Tscrew_d(class), h = t * 3, center = true);
}
module tile_screw_hole(class, h, centered_hole = false) {
layer_t = 0.3;
nut_e = sqrt(pow(Tnut_d(class), 2) - pow(Tnut_d(class) / 2, 2));
cylinder(d = Tscrew_d(class), h = h + 2, center = true);
if (centered_hole) {
for (alpha = [ 0, 180 ])
rotate([ alpha, 0, 0 ]) translate([ 0, 0, Tt(class) / 2 ]) {
cube([ nut_e, Tscrew_d(class), layer_t * 2 ], center = true);
rotate([ 0, 0, 30 ])
cylinder(d = Tnut_d(class), h = h, $fn = 6);
}
} else {
rotate([ 180, 0, 0 ]) translate([ 0, 0, Tt(class) - h / 2 ]) {
cube([ nut_e, Tscrew_d(class), layer_t * 2 ], center = true);
rotate([ 0, 0, 30 ]) cylinder(
d = Tnut_d(class), h = h - Tt(class) + Tnut_h(class), $fn = 6);
}
}
layer_t = 0.3;
nut_e = sqrt(pow(Tnut_d(class), 2) - pow(Tnut_d(class) / 2, 2));
cylinder(d = Tscrew_d(class), h = h + 2, center = true);
if (centered_hole) {
for (alpha = [ 0, 180 ])
rotate([ alpha, 0, 0 ])
translate([ 0, 0, Tt(class) / 2 ]) {
cube([ nut_e, Tscrew_d(class), layer_t * 2 ],
center = true);
rotate([ 0, 0, 30 ])
cylinder(d = Tnut_d(class), h = h, $fn = 6);
}
} else {
rotate([180,0,0])
translate([ 0, 0, Tt(class) - h / 2 ]) {
cube([ nut_e, Tscrew_d(class), layer_t * 2 ],
center = true);
rotate([ 0, 0, 30 ]) cylinder(
d = Tnut_d(class),
h = h - Tt(class) + Tnut_h(class), $fn = 6);
}
}
}
module tile_tube_hole(d) {
rotate([ 90, 0, 0 ]) cylinder(d = d, h = 100, center = true);
rotate([ 90, 0, 0 ]) cylinder(d = d, h = 100, center = true);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment