Pattern
1
//Parameters
2
w = 50;
3
l = 50;
4
nw = 10;
5
nl = 10;
6
7
h = (w/nw)*0.25;
8
t = 10;
9
10
//Base Surface
11
srf = Rectangle.ByWidthLength(w,l).Patch();
12
13
c1 = NurbsCurve.ByPoints(Point.ByCoordinates(-w/2,[-l/2,0,l/2],[0,t/3,0]));
14
c2 = NurbsCurve.ByPoints(Point.ByCoordinates(w/2,[-l/4,0,l/4],[t*3,t/2,0]));
15
//srf = Surface.ByLoft([c2,c1]);
16
17
//Points Grid
18
p00 = srf.PointAtParameter((0..1..#(nw*3)+1)<1>,(0..1..#(nl*3)+1)<2>);
19
n00 = srf.NormalAtParameter((0..1..#(nw*3)+1)<1>,(0..1..#(nl*3)+1)<2>);
20
21
//Quad 01
22
p10 = List.TakeEveryNthItem(p00,6,1);
23
n11 = List.TakeEveryNthItem(n00,6,1);
24
p11 = p10.Translate(n11,h);
25
p12 = List.TakeEveryNthItem(p00,6,2);
26
p13 = List.TakeEveryNthItem(p00,6,3);
27
p14 = List.TakeEveryNthItem(p11<1>,6,2);
28
p15 = List.TakeEveryNthItem(p11<1>,6,4);
29
p16 = List.TakeEveryNthItem(p13<1>,6,3);
30
p17 = List.TakeEveryNthItem(p12<1>,6,2);
31
p18 = List.Clean(List.Transpose(List.Transpose([p14,p15,p16,p17])<1>),false);
32
pg1 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p18,List.Count(p18<1><2>)>3)["in"]);
33
34
//Quad 02
35
p20 = List.TakeEveryNthItem(p00,6,4);
36
n21 = List.TakeEveryNthItem(n00,6,4);
37
p21 = p20.Translate(n21,h);
38
p24 = List.TakeEveryNthItem(p21<1>,6,3);
39
p25 = List.TakeEveryNthItem(p21<1>,6,1);
40
p28 = List.Clean(List.Transpose(List.Transpose([p17,p16,p24,p25])<1>),false);
41
pg2 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p28,List.Count(p28<1><2>)>3)["in"]);
42
43
//Quad 03
44
p31 = List.TakeEveryNthItem(p00,6,5);
45
p32 = List.TakeEveryNthItem(p00,6,6);
46
p36 = List.TakeEveryNthItem(p32<1>,6,2);
47
p37 = List.TakeEveryNthItem(p31<1>,6,3);
48
p38 = List.Clean(List.Transpose(List.Transpose([p25,p24,p37,p36])<1>),false);
49
pg3 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p38,List.Count(p38<1><2>)>3)["in"]);
50
51
//Quad 04
52
p41 = List.DropItems(p14,1);
53
p42 = List.DropItems(p15,1);
54
p48 = List.Clean(List.Transpose(List.Transpose([p36,p37,p42,p41])<1>),false);
55
pg4 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p48,List.Count(p48<1><2>)>3)["in"]);
56
57
//Tri 01
58
p57 = List.TakeEveryNthItem(p20<1>,6,3);
59
p58 = List.Clean(List.Transpose(List.Transpose([p16,p24,p57])<1>),false);
60
pg5 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p58,List.Count(p58<1><2>)>2)["in"]);
61
62
//Tri 02
63
p68 = List.Clean(List.Transpose(List.Transpose([p37,p24,p57])<1>),false);
64
pg6 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p68,List.Count(p68<1><2>)>2)["in"]);
65
66
//Tri 03
67
p77 = List.TakeEveryNthItem(p10<1>,6,2);
68
p78 = List.Clean(List.Transpose(List.Transpose([p77,p14,p17])<1>),false);
69
pg7 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p78,List.Count(p78<1><2>)>2)["in"]);
70
71
//Tri 04
72
p87 = List.DropItems(List.TakeEveryNthItem(p10<1>,6,2),1);
73
p88 = List.Clean(List.Transpose(List.Transpose([p36,p41,p87])<1>),false);
74
pg8 = Surface.ByPerimeterPoints(List.FilterByBoolMask(p88,List.Count(p88<1><2>)>2)["in"]);
75
76
//Quad 05
77
q14 = List.TakeEveryNthItem(p11<1>,6,0)<1>;
78
q15 = List.TakeEveryNthItem(p12<1>,6,6)<1>;
79
q16 = List.TakeEveryNthItem(p13<1>,6,5);
80
q18 = List.Clean(List.Transpose(List.Transpose([p15,q14,q15,q16])<1>),false);
81
qg1 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q18,List.Count(q18<1><2>)>3)["in"]);
82
83
//Quad 06
84
q24 = List.TakeEveryNthItem(p21<1>,6,5);
85
q25 = List.DropItems(p25<1>,1);
86
q28 = List.Clean(List.Transpose(List.Transpose([q24,q16,q15,q25])<1>),false);
87
qg2 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q28,List.Count(q28<1><2>)>3)["in"]);
88
89
//Quad 07
90
q34 = List.TakeEveryNthItem(p32<1>,6,6);
91
q35 = List.TakeEveryNthItem(p31<1>,6,5);
92
q38 = List.Clean(List.Transpose(List.Transpose([q34,q35,q24,q25])<1>),false);
93
qg3 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q38,List.Count(q38<1><2>)>3)["in"]);
94
95
//Quad 08
96
q44 = List.DropItems(p15,1);
97
q45 = List.DropItems(q14,1);
98
q48 = List.Clean(List.Transpose(List.Transpose([q44,q35,q34,q45])<1>),false);
99
qg4 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q48,List.Count(q48<1><2>)>3)["in"]);
100
101
//Tri 05
102
q54 = List.TakeEveryNthItem(p20<1>,6,5);
103
q58 = List.Clean(List.Transpose(List.Transpose([q16,q24,q54])<1>),false);
104
qg5 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q58,List.Count(q58<1><2>)>2)["in"]);
105
106
//Tri 06
107
q68 = List.Clean(List.Transpose(List.Transpose([q54,q24,q35])<1>),false);
108
qg6 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q68,List.Count(q68<1><2>)>2)["in"]);
109
110
//Tri 07
111
q74 = List.TakeEveryNthItem(p10<1>,6,0)<1>;
112
q78 = List.Clean(List.Transpose(List.Transpose([q14,q15,q74])<1>),false);
113
qg7 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q78,List.Count(q78<1><2>)>2)["in"]);
114
115
//Tri 08
116
q84 = List.DropItems(q14,1);
117
q85 = List.DropItems(q15,1);
118
q88 = List.Clean(List.Transpose(List.Transpose([q34,q84,q85])<1>),false);
119
qg8 = Surface.ByPerimeterPoints(List.FilterByBoolMask(q88,List.Count(q88<1><2>)>2)["in"]);
120
121
//Quad 09
122
r11 = List.TakeEveryNthItem(p21<1>,6,4);
123
r12 = List.TakeEveryNthItem(p20<1>,6,3);
124
r18 = List.Clean(List.Transpose(List.Transpose([p15,r11,r12,p16])<1>),false);
125
rg1 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r18,List.Count(r18<1><2>)>3)["in"]);
126
127
//Quad 10
128
r28 = List.Clean(List.Transpose(List.Transpose([p42,p37,r12,r11])<1>),false);
129
rg2 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r28,List.Count(r28<1><2>)>3)["in"]);
130
131
//Quad 11
132
r38 = List.Clean(List.Transpose(List.Transpose([r11,p15,q16,q54])<1>),false);
133
rg3 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r38,List.Count(r38<1><2>)>3)["in"]);
134
135
//Quad 12
136
r48 = List.Clean(List.Transpose(List.Transpose([r11,q54,q35,p42])<1>),false);
137
rg4 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r48,List.Count(r48<1><2>)>3)["in"]);
138
139
//Quad 13
140
r51 = List.TakeEveryNthItem(p11<1>,6,1);
141
r58 = List.Clean(List.Transpose(List.Transpose([r51,p77,p17,p25])<1>),false);
142
rg5 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r58,List.Count(r58<1><2>)>3)["in"]);
143
144
//Quad 14
145
r61 = List.DropItems(p77,1);
146
r62 = List.DropItems(r51,1);
147
r68 = List.Clean(List.Transpose(List.Transpose([p25,p36,r61,r62])<1>),false);
148
rg6 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r68,List.Count(r68<1><2>)>3)["in"]);
149
150
//Quad 15
151
r71 = List.DropItems(r51<1>,1);
152
r78 = List.Clean(List.Transpose(List.Transpose([r71,q25,q15,q74])<1>),false);
153
rg7 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r78,List.Count(r78<1><2>)>3)["in"]);
154
155
//Quad 16
156
r81 = List.DropItems(List.DropItems(r51,1)<1>,1);
157
r82 = List.DropItems(q74,1);
158
r88 = List.Clean(List.Transpose(List.Transpose([q25,r81,r82,q34])<1>),false);
159
rg8 = Surface.ByPerimeterPoints(List.FilterByBoolMask(r88,List.Count(r88<1><2>)>3)["in"]);
160
161
pn1 = List.Flatten([pg1,pg2,pg3,pg4,pg5,pg6,pg7,pg8,qg1,qg2,qg3,qg4,qg5,qg6,qg7,qg8,rg1,rg2,rg3,rg4,rg5,rg6,rg7,rg8],-1);
162
163
//Punctures
164
b11 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,2)<1>,6,2);
165
b12 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,3)<1>,6,3);
166
b13 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,2)<1>,6,0);
167
b14 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,3)<1>,6,5);
168
b21 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,5)<1>,6,3);
169
b22 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,6)<1>,6,2);
170
b23 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,5)<1>,6,5);
171
b24 = List.TakeEveryNthItem(List.TakeEveryNthItem(p00,6,6)<1>,6,0);
172
sp1 = List.Flatten([b11,b13,b21,b23],-1);
173
ep1 = List.Flatten([b12,b14,b22,b24],-1);
174
175
bl1 = Line.ByStartPointEndPoint(sp1,ep1).TrimByParameter(0.2,0.8);
176
tk1 = Math.Average(bl1.Length);
177
d01 = bl1.DistanceTo(srf.PointAtParameter(0.5,0.5));
178
tk2 = Math.RemapRange(d01,tk1/10,tk1/3);
179
dr1 = srf.NormalAtPoint(bl1.PointAtParameter(0.5));
180
sl1 = Solid.ByUnion(PolyCurve.ByThickeningCurve(bl1,tk2,dr1).Patch().Thicken(tk2));
181
182
pn2 = List.Flatten(pn1.SubtractFrom(sl1),-1);
Copied!
Last modified 1yr ago
Copy link