Retail Space Layout
Design Automation
Retail Space Layout Automation
20170511-1.zip
4KB
Binary
1
// Functions
2
//
3
//Shift if obstructed
4
//
5
def aisles(clm:var,dir:var,dirShf:var,aisleEdg:var,aisleWid:var,
6
aisleMin:var,shiftInc:var,aisleGap:var,nos:var)
7
{
8
return=[Imperative]
9
{
10
cnt = 0;
11
aisle = [];
12
while (cnt<nos)
13
{
14
clm2 = [];
15
aisleSrf = [];
16
aisleSrf1 = [];
17
aisleStartEdg = [];
18
shft = 0;
19
clm1=clm.Translate(dirShf.Reverse(),aisleWid-aisleMin);
20
clm2=PolySurface.ByJoinedSurfaces(clm.Intersect(clm1));
21
aisleEndEdg = aisleEdg.Translate(dir,aisleWid);
22
aisleSrf = Surface.ByLoft([aisleEdg,aisleEndEdg]);
23
if (dir==dirShf)
24
{
25
while (clm2.DoesIntersect(aisleSrf))
26
{
27
shft = shft + shiftInc;
28
aisleSrf = aisleSrf.Translate(dirShf,shft);
29
aisleEndEdg = aisleEndEdg.Translate(dirShf,shft);
30
}
31
aisleStartEdg = aisleEdg;
32
aisleSrf1 = Surface.ByLoft([aisleStartEdg,aisleEndEdg]);
33
}
34
else
35
{
36
while (clm2.DoesIntersect(aisleSrf))
37
{
38
shft = shft + shiftInc;
39
aisleSrf = aisleSrf.Translate(dirShf,shft);
40
aisleEndEdg = aisleEndEdg.Translate(dirShf,shft);
41
}
42
aisleStartEdg = aisleEndEdg.Translate(dirShf,aisleWid);
43
aisleSrf1 = Surface.ByLoft([aisleStartEdg,aisleEndEdg]);
44
}
45
aisle[cnt] = [aisleStartEdg,aisleEndEdg,aisleSrf1];
46
aisleEdg = aisleEndEdg.Translate(dir,aisleGap);
47
cnt = cnt + 1;
48
}
49
return = aisle;
50
}
51
};
52
//
53
//
54
55
//
56
//Module stacking
57
//
58
def modTrn(clm,dir,strEdg,gdlWid1,gdlWid2,gdlCnt,endkDpt)
59
{
60
return = [Imperative]
61
{
62
edg002 = [];
63
bln001 = [];
64
bln002 = [];
65
edg004 = [];
66
edg011 = [];
67
c = 0;
68
edg00a = aisles(clm,dir,dir,strEdg,endkDpt,endkDpt,0.01,0,1);
69
edg00b = List.TakeItems(Flatten(edg00a),2);
70
edg00c = List.GetItemAtIndex(Flatten(edg00a),1);
71
edg001 = aisles(clm,dir,dir,edg00c,gdlWid1,gdlWid1,gdlWid2,0,gdlCnt);
72
for (i in edg001)
73
{
74
edg002[c] = List.GetItemAtIndex(i,0);
75
c = c+1;
76
}
77
c=0;
78
dis001 = strEdg.DistanceTo(edg002);
79
for (i in dis001)
80
{
81
bln001[c] = i < (gdlWid1*gdlCnt)+gdlWid1;
82
c = c+1;
83
}
84
c=0;
85
edg003 = List.FilterByBoolMask(edg001,bln001)["in"];
86
for (i in edg003)
87
{
88
edg004[c] = List.TakeItems(i,2);
89
c = c+1;
90
}
91
c=0;
92
edg005 = List.LastItem(Flatten(edg004));
93
edg006 = aisles(clm,dir,dir,edg005,endkDpt,endkDpt,gdlWid2,0,1);
94
edg007 = List.GetItemAtIndex(Flatten(edg006),1);
95
edg008 = edg007.Translate(dir.Reverse(),endkDpt);
96
edg0a8 = [edg008,edg005];
97
edg009 = [edg008,edg007];
98
99
edg010 = List.AddItemToEnd(edg009,List.AddItemToEnd(edg0a8,List.AddItemToFront(edg00b,edg004)));
100
for(i in edg010)
101
{
102
bln002[c] = List.GetItemAtIndex(i,0).DoesIntersect(List.GetItemAtIndex(i,1));
103
c = c+1;
104
}
105
edg011 = List.FilterByBoolMask(edg010,bln002)["out"];
106
return = edg011;
107
}
108
};
109
//
110
//
111
112
//
113
//Aisles and Modules
114
//
115
def modAsl(clm,dir,strEdg,endEdg,gdlWid1,gdlWid2,gdlCnt,endkDpt,aslWidIdl,aslWidMin)
116
{
117
return = [Imperative]
118
{
119
c = 0;
120
d = 0;
121
dis002 = 0;
122
gdlCnt01 = gdlCnt;
123
aslEdg1 = [];
124
aslEdg2 = [];
125
aslEdg3 = [];
126
dis001 = endEdg.DistanceTo(strEdg);
127
aslEdge = strEdg;
128
strEdg1 = strEdg;
129
while (dis002<dis001)
130
{
131
if ((dis001-dis002) > ((gdlWid1*gdlCnt)+(endkDpt*2)+aslWidIdl))
132
{
133
gdlCnt01 = gdlCnt;
134
}
135
else
136
{
137
gdlCnt01 = Math.Floor((dis001-dis002-(endkDpt*2)-aslWidIdl)/(gdlWid1));
138
}
139
aslEdg1[c] = modTrn(clm,dir,strEdg1,gdlWid1,gdlWid2,gdlCnt01,endkDpt);
140
aslEdg2[c] = List.LastItem(Flatten(aslEdg1[c]));
141
aslEdg3[c] = Flatten(aisles(clm,dir,dir,aslEdg2[c],aslWidIdl,aslWidMin,0.01,0,1))[1];
142
strEdg1 = aslEdg3[c];
143
dis002 = strEdg1.DistanceTo(strEdg);
144
c = c+1;
145
d = d+5;
146
147
}
148
return = aslEdg1;
149
}
150
};
151
//
152
//
Copied!
1
//Alignment and Direction Control
2
flip = false;
3
frToRr = true;
4
lfToRg = true;
5
6
//Wall Fixture Depths
7
wallFxtRear = 0.48;
8
wallFxtLeft = 0.48;
9
wallFxtFrnt = 0.48;
10
wallFxtRght = 0.48;
11
12
//Gondola Dimensions
13
gndlWid001 = 1;
14
gndlWid002 = 0.5;
15
gndlDpt001 = 0.75;
16
gndlCntMax = 12;
17
endkDpt001 = 0.5;
18
19
//Aisle Widths
20
aslWidIdl = 2.4;
21
aslWidMin = 1.2;
22
23
//Boundary Perimeter
24
bnd001 = Rectangle.ByWidthLength(80,50);
25
26
//Columns
27
//clm001 = Rectangle.ByWidthLength(0.6,0.9);
28
clm001 = Rectangle.ByWidthLength(1,1);
29
clm002 = clm001.Translate(Vector.YAxis(),[-24,-13,0,12,24]);
30
clm003 = clm002<1>.Translate(Vector.XAxis(),(-36..36..12)<2>);
31
clm004 = Surface.ByPatch(Flatten(clm003));
32
clm005 = PolySurface.ByJoinedSurfaces(clm004);
33
34
//Boundary Edges
35
crv001 = bnd001.Explode();
36
rghtEdg0 = crv001[0];
37
rearEdg0 = crv001[1];
38
leftEdg0 = crv001[2];
39
frntEdg0 = crv001[3];
40
41
rghtEdg = flip?frntEdg0:rghtEdg0;
42
rearEdg = flip?leftEdg0:rearEdg0;
43
leftEdg = flip?rearEdg0:leftEdg0;
44
frntEdg = flip?rghtEdg0:frntEdg0;
45
46
//Directions
47
pnt001 = rearEdg.PointAtParameter(0.5);
48
pnt002 = frntEdg.PointAtParameter(0.5);
49
pnt003 = leftEdg.PointAtParameter(0.5);
50
pnt004 = rghtEdg.PointAtParameter(0.5);
51
dir001 = Vector.ByTwoPoints(pnt001,pnt002);
52
dir002 = Vector.ByTwoPoints(pnt002,pnt001);
53
dir003 = Vector.ByTwoPoints(pnt003,pnt004);
54
dir004 = Vector.ByTwoPoints(pnt004,pnt003);
55
56
//Trimmed Boundary Edges
57
rearEdg001 = Flatten(rearEdg.Trim(leftEdg.Translate(dir003,wallFxtLeft),rearEdg.Intersect(leftEdg)));
58
rearEdg002 = Flatten(rearEdg001.Trim(rghtEdg.Translate(dir004,wallFxtRght),rearEdg.Intersect(rghtEdg)));
59
frntEdg001 = Flatten(frntEdg.Trim(leftEdg.Translate(dir003,wallFxtLeft),frntEdg.Intersect(leftEdg)));
60
frntEdg002 = Flatten(frntEdg001.Trim(rghtEdg.Translate(dir004,wallFxtRght),frntEdg.Intersect(rghtEdg)));
61
leftEdg001 = Flatten(leftEdg.Trim(rearEdg.Translate(dir001,wallFxtRear),leftEdg.Intersect(rearEdg)));
62
leftEdg002 = Flatten(leftEdg001.Trim(frntEdg.Translate(dir002,wallFxtFrnt),leftEdg.Intersect(frntEdg)));
63
rghtEdg001 = Flatten(rghtEdg.Trim(rearEdg.Translate(dir001,wallFxtRear),rghtEdg.Intersect(rearEdg)));
64
rghtEdg002 = Flatten(rghtEdg001.Trim(frntEdg.Translate(dir002,wallFxtFrnt),rghtEdg.Intersect(frntEdg)));
65
66
//Rear Wall Fixtures
67
rearEdg003 = rearEdg002.Translate(dir001,wallFxtRear);
68
rearAsl001 = Flatten(aisles(clm005,dir001,dir001,rearEdg003,aslWidIdl,aslWidMin,0.01,0,1));
69
rearEdg004 = rearAsl001[1];
70
71
//Left Wall Fixtures
72
leftEdg003 = List.FirstItem(leftEdg002.Translate(dir003,wallFxtLeft));
73
//leftAsl001 = Flatten(aisles(clm005,dir003,dir003,leftEdg003,aslWidIdl,aslWidMin,0.01,0,1));
74
//leftEdg004 = leftAsl001[1];
75
76
//Front Wall Fixtures
77
frntEdg003 = frntEdg002.Translate(dir002,wallFxtFrnt);
78
frntAsl001 = Flatten(aisles(clm005,dir002,dir002,frntEdg003,aslWidIdl,aslWidMin,0.01,0,1));
79
frntEdg004 = frntAsl001[1];
80
81
//Right Wall Fixtures
82
rghtEdg003 = List.FirstItem(rghtEdg002.Translate(dir004,wallFxtLeft));
83
rghtAsl001 = Flatten(aisles(clm005,dir004,dir004,rghtEdg003,aslWidIdl,aslWidMin,0.01,0,1));
84
rghtEdg004 = rghtAsl001[1];
85
86
//Module Stacking - Longer
87
frRrMd001 = modAsl(clm005,dir002,frntEdg004,rearEdg,gndlWid001,gndlWid002,gndlCntMax,endkDpt001,1.8,1.2);
88
frntEdg006 = List.FirstItem(frRrMd001<1><2>);
89
90
//Module Stacking - Shorter
91
leftNos001 = ((leftEdg003.DistanceTo(rghtEdg003))/((gndlDpt001*2)+aslWidIdl))+1;
92
leftAsl002 = aisles(clm005,dir003,dir003,leftEdg003,aslWidIdl,aslWidMin,0.01,gndlDpt001*2,leftNos001);
93
leftEdg006 = List.TakeItems(leftAsl002<1>,2);
94
leftEdg007 = List.FirstItem(leftEdg006 <1>);
95
bln11 = leftEdg003.DistanceTo(leftEdg007)<leftEdg003.DistanceTo(rghtEdg003);
96
leftEdg008 = Transpose(List.FilterByBoolMask(leftEdg006,bln11)["in"]);
97
leftEdg009 = List.DropItems(List.LastItem(leftEdg008),-1).Translate(dir003,gndlDpt001);
98
99
//Module Placement Points
100
mdulPnt001 = Flatten((frntEdg006<1>.Intersect(leftEdg009<2>))<1><2>);
101
mdulPnt002 = List.DropItems(mdulPnt001<1><2>,1);
102
mdulPnt003 = List.DropItems(List.Sublists(mdulPnt002<1><2>,0..1,1)<1><2>,-1);
103
mdulPnt004 = List.FirstItem(mdulPnt003<1><2><3>);
104
mdulPnt005 = List.LastItem(mdulPnt003<1><2><3>);
105
mdulDis001 = Math.Round((mdulPnt004).DistanceTo(mdulPnt005),2);
106
mdulDis002 = List.Reverse((0..#(Math.Ceiling(mdulDis001))..gndlWid001)<1><2><3>);
107
mdulPnt008 = Flatten(mdulPnt005.Translate(dir001,mdulDis002)<1><2>);
108
//Module Start-End Points
109
mdulPnt009 = List.AddItemToFront(List.FirstItem(mdulPnt004<1><2>)<1><2>,mdulPnt008<1><2>);
110
mdulPnt010 = List.DropItems(List.Sublists(mdulPnt009<1><2>,0..1,1)<1><2>,-1);
111
mdulPnt011 = List.FirstItem(mdulPnt010<1><2><3>);
112
mdulPnt012 = List.LastItem(mdulPnt010<1><2><3>);
113
//Module Placement Points
114
mdulDis003 = Math.Round((mdulPnt011).DistanceTo(mdulPnt012),2);
115
mdulPnt013 = mdulDis003==gndlWid001?mdulPnt009.Translate(dir002,gndlWid001/2):mdulPnt009.Translate(dir002,gndlWid002/2);
116
//Placeholder Rectangles (To be deleted once Families are loaded)
117
mdulFml001 = Rectangle.ByWidthLength(Plane.ByOriginNormal(mdulPnt013,Vector.ZAxis()),gndlWid001,gndlDpt001*2);
118
mdulFml002 = Rectangle.ByWidthLength(Plane.ByOriginNormal(mdulPnt013,Vector.ZAxis()),gndlWid002,gndlDpt001*2);
119
mdulTyp001 = mdulDis003==gndlWid001?mdulFml001:mdulFml002;
120
//Module Rotation
121
mdulCir001 = Circle.ByCenterPointRadius(mdulPnt013,gndlDpt001);
122
mdulPnt014 = List.Clean((leftEdg009<1>.Intersect(mdulCir001<2>))<1><2>,false);
123
mdulDir001 = Vector.ByTwoPoints(List.FirstItem(mdulPnt014<1><2><3><4>),List.LastItem(mdulPnt014<1><2><3><4>));
124
mdulDir002 = Flatten(Transpose(mdulDir001)<1><2>);
125
mdulAng001 = Vector.XAxis().AngleWithVector(mdulDir002);
126
mdulTyp002 = mdulTyp001.Rotate(Plane.ByOriginNormal(mdulPnt013,Vector.ZAxis()),-mdulAng001);
127
mdulTyp003 = List.FilterByBoolMask(mdulTyp002,mdulTyp002.DoesIntersect(clm005))["out"];
Copied!
Copy link