-
Notifications
You must be signed in to change notification settings - Fork 0
/
Structures.scad
121 lines (109 loc) · 4.1 KB
/
Structures.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
generate="FCC";
cube_size=20;
thickness_of_plate=2;
module plate(XRotate,YRotate,Cube,plate_width){
intersection(){
rotate([XRotate,YRotate,0]) cube([(2.5*Cube),(2.5*Cube),plate_width],center=true);
cube(Cube,center=true);
}
}
//Body Centered Cubic
module BCC(cube_size,thickness_of_plate){
plate(45,0,cube_size,thickness_of_plate);
plate(-45,0,cube_size,thickness_of_plate);
plate(45,90,cube_size,thickness_of_plate);
plate(-45,90,cube_size,thickness_of_plate);
plate(0,45,cube_size,thickness_of_plate);
plate(0,-45,cube_size,thickness_of_plate);
}
//Simple Cubic
module SC(cube_size,thickness_of_plate){
plate(0,0,cube_size,thickness_of_plate);
plate(0,90,cube_size,thickness_of_plate);
plate(90,90,cube_size,thickness_of_plate);
}
//Face Centered Cubic
module FCC(cube_size,thickness_of_plate){
module HexPlate(cube_size,thickness_of_plate,ZRotate){
intersection(){
cube(cube_size,center=true);
rotate([0,-55,ZRotate]) cube([cube_size*sqrt(2),cube_size*sqrt(2),thickness_of_plate],center=true);
}
}
module TrianglePlate(cube_size,thickness_of_plate){
intersection(){
cube(cube_size,center=true);
translate([cube_size/2,cube_size/2,0]) rotate([55,0,135]) cube([2*cube_size*sqrt(2),2*cube_size*sqrt(2),thickness_of_plate],center=true);
}
}
module Complete(cube_size,thickness_of_plate){
union(){
//HEXAGONAL PLATES
HexPlate(cube_size,thickness_of_plate,45);
HexPlate(cube_size,thickness_of_plate,135);
HexPlate(cube_size,thickness_of_plate,225);
HexPlate(cube_size,thickness_of_plate,315);
//TRIANGULAR PLATES
TrianglePlate(cube_size,thickness_of_plate);
rotate([0,0,90]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,0,-90]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,0,-180]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,90,0]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,90,90]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,90,-90]) TrianglePlate(cube_size,thickness_of_plate);
rotate([0,90,-180]) TrianglePlate(cube_size,thickness_of_plate);
}
}
Complete(cube_size,thickness_of_plate);
}
module SC_BCC(cube_size,thickness_of_plate){
BCC(cube_size,thickness_of_plate);
SC(cube_size,thickness_of_plate);
}
module SC_FCC(cube_size,thickness_of_plate){
SC(cube_size,thickness_of_plate);
FCC(cube_size,thickness_of_plate);
}
module SC_BCC_FCC(cube_size,thickness_of_plate){
SC(cube_size,thickness_of_plate);
BCC(cube_size,thickness_of_plate);
FCC(cube_size,thickness_of_plate);
}
//SC BCC Frag produces the fragmented structure of SC-BCC which is compatible with SC
module SC_BCC_frag(cube_size,thickness_of_plate){
difference(){
BCC(cube_size,thickness_of_plate);
SC(cube_size,thickness_of_plate);
}
}
//BCC_SC Frag produces fragmented structures of SC-BCC which is compatible with BCC
module BCC_SC_frag(cube_size,thickness_of_plate){
difference(){
SC(cube_size,thickness_of_plate);
BCC(cube_size,thickness_of_plate);
}
}
///FCC_SC Frag produces fragmented structures of SC-FCC which is compatible with FCC
module FCC_SC_frag(cube_size,thickness_of_plate){
difference(){
SC(cube_size,thickness_of_plate);
FCC(cube_size,thickness_of_plate);
}
}
//SC_FCC Frag produces the fragmented structure of SC-FCC which is compatible with SC
module SC_FCC_frag(cube_size,thickness_of_plate){
difference(){
FCC(cube_size,thickness_of_plate);
SC(cube_size,thickness_of_plate);
}
}
if (generate=="BCC") BCC(cube_size,thickness_of_plate);
if (generate=="SC") SC(cube_size,thickness_of_plate);
if (generate=="FCC") FCC(cube_size,thickness_of_plate);
if (generate=="SC-BCC") SC_BCC(cube_size,thickness_of_plate);
if (generate=="SC-FCC") SC_FCC(cube_size,thickness_of_plate);
if (generate=="SC-BCC-FCC") SC_BCC_FCC(cube_size,thickness_of_plate);
if (generate=="SC-BCC(frag)") SC_BCC_frag(cube_size,thickness_of_plate);
if (generate=="BCC-SC(frag)") BCC_SC_frag(cube_size,thickness_of_plate);
if (generate=="FCC-SC(frag)") FCC_SC_frag(cube_size,thickness_of_plate);
if (generate=="SC-FCC(frag)") SC_FCC_frag(cube_size,thickness_of_plate);