misc uncomitted changes
[clinton/3d-models.git] / creepy-hand / creepy-hand-split.scad
1 // Simple openscad program to split the creepy hand so larger creepy
2 // hands can be made, or just so the hand can be removed to make it
3 // easier to put things on the hand.
4
5 // Copyright (c) 2019 Clinton Ebadi <clinton@unknownlamer.org>, GPLv3
6 // or at your option any later version.
7
8 // Can be used to split other things: just load whatever geometry you
9 // want and ensure the spot you want to split it at is centered on the
10 // origin.
11
12 // Creepy hand from http://www.thingiverse.com/thing:8174 by whosawhatsis, used with permission (CC BY)
13 // Modified by centering it on the origin (no actual changes)
14 // Defaults are for #10 threaded rod (hardware store doesn't sell metric rod here)
15 split_thing (part_spacing = 100, spacing = 25, bottom = false) {
16 scale ([2, 2, 2]) translate ([-2, 3, 0]) rotate ([0, 0, 40]) translate ([0, 0, 10]) import ("hand-centered.stl");
17 }
18
19 // TODO:
20
21 // - allow setting a z offset percentage to shift holes more into upper
22 // or lower piece
23
24 default_rod_d = 5.1; // loose fit on #10 threaded rod
25 default_depth = 20;
26 default_position_depth = 10;
27 default_spacing = 20;
28 max_model_dim = 1000;
29
30 $fa = 1;
31 $fs = 1;
32
33 // place child object, will be split on plane at z = 0
34 module split_thing (top = true, bottom = true, rod_d = default_rod_d, depth = default_depth, position_depth = default_position_depth, spacing = default_spacing, part_spacing = 50) {
35 module rod_mount () {
36 module rod () {
37 translate ([-spacing/2, 0, 0]) cylinder (d=rod_d, h=depth);
38 translate ([spacing/2, 0, 0]) cylinder (d=rod_d, h=depth);
39 translate ([0, -spacing/4, 0]) cylinder (d=rod_d, h=depth);
40 translate ([0, spacing/4, 0]) cylinder (d=rod_d, h=depth);
41 }
42
43 rod ();
44 mirror ([0, 0, 1]) rod();
45 }
46
47 module whole () {
48 difference () {
49 union () { children (); }
50 rod_mount ();
51 }
52 }
53
54 if (top) {
55 intersection () {
56 whole () children ();
57 translate ([-max_model_dim/2,-max_model_dim/2, 0]) cube (max_model_dim);
58 }
59 }
60 if (bottom) {
61 translate ([top ? part_spacing : 0, 0, 0]) {
62 rotate ([180, 0, 0]) {
63 intersection () {
64 rotate ([0, 0, 0]) whole () children ();
65 mirror ([0, 0, 1]) translate ([-max_model_dim/2,-max_model_dim/2, 0]) cube (max_model_dim);
66 }
67 }
68 }
69 }
70
71 }
72
73 //split_thing (part_spacing = 50, depth = 7, position_depth = 4, spacing = 12) {
74 // translate ([-2, 2, 0]) rotate ([0, 0, 40]) translate ([0, 0, 10]) import ("hand-centered_preview.stl");
75 // cylinder (d=30, h=40, center=true);
76 // /*rotate ([0, 0, 40])*/ scale ([2, 2, 2]) import ("hand-centered_preview.stl");
77 // scale ([2, 2, 2]) rotate ([0, 0, 40]) translate ([0, 0, 10]) import ("hand-centered_preview.stl");
78 //}
79