National War Museum

Design Competition Entry
//Ashoka Chakra
chkC1=Circle.ByCenterPointRadius(Point.Origin(),190);
chkPc1=PolyCurve.ByPoints(Point.PruneDuplicates(Flatten(Point.ByCoordinates
({-4.3182,-2.9278,-1.6079,-5.552,0,5.552,1.6079,2.9278,4.3182},
{32.8,32.8903,33.4260,65.2,157.6,65.2,33.4260,32.8903,32.8})<1>.
Rotate(Point.Origin(),Vector.ZAxis(),(360..0..#25)<2>)),0.001),true);
chkA1=Arc.ByThreePoints(Point.ByCoordinates(-8.5,166.5),Point.ByCoordinates(0,158),
Point.ByCoordinates(8.5,166.5));
chkA2=List.DropItems(chkA1.Rotate(Point.Origin(),Vector.ZAxis(),360..0..#25),1).
Rotate(Point.Origin(),Vector.ZAxis(),7.5);
chkL2=Line.ByStartPointEndPoint(List.ShiftIndices(chkA2.StartPoint,-1),chkA2.EndPoint);
chkPc2=PolyCurve.ByJoinedCurves(Flatten(Transpose({chkA2,chkL2})));
chkSld1=chkPc1.ExtrudeAsSolid(Vector.ZAxis(),1).Union(chkC1.ExtrudeAsSolid
(Vector.ZAxis(),1).Difference(chkPc2.ExtrudeAsSolid(Vector.ZAxis(),1)));
chkSrf1=chkSld1.Intersect(Plane.XY());
//Data file
fil1=File.FromPath("..\DataExtraction\\boundaries.xls");
//Boundary
exl4=Excel.ReadFromFile(fil1,("Boundary"+(1..2))<1>,true);
exl5=List.DropItems(List.Transpose(exl4<1>)<1><2>,1);
exl6=Math.Round(String.ToNumber(exl5),3);
minXDed=718180;
minYDed=3167444;
enx2=List.GetItemAtIndex(exl6<1>,0)-minXDed;
eny2=List.GetItemAtIndex(exl6<1>,1)-minYDed;
stx2=List.GetItemAtIndex(exl6<1>,3)-minXDed;
sty2=List.GetItemAtIndex(exl6<1>,4)-minYDed;
ep2=Point.ByCoordinates(enx2,eny2);
sp2=Point.ByCoordinates(stx2,sty2);
bdpn1=List.SortByKey(sp2[0],{0,1,11,9,10,2,8,6,7,5,4,3});
bdry1=Polygon.ByPoints(bdpn1["sorted list"]);
bdpn2=List.SortByKey(sp2[1],{0,1,6,5,4,3,2});
bdry2=Polygon.ByPoints(bdpn2["sorted list"]);
bdry3=Polygon.ByPoints(Flatten({bdpn1["sorted list"][9..10],bdpn2["sorted list"][{1,0,6}]}));
bdry4=PolySurface.ByJoinedSurfaces({bdry1.Patch(),bdry3.Patch(),bdry2.Patch()}).PerimeterCurves();
//Trees
exl7=String.ToNumber(Transpose(Excel.ReadFromFile(fil1,("trees"),true)));
trpt1=List.FirstItem(List.SortByKey(Point.ByCoordinates(exl7[0]-minXDed,exl7[1]-minYDed,0),exl7[3]));
trbl1=bdry1.ContainmentTest(trpt1)||bdry2.ContainmentTest(trpt1);
trpt2=List.FilterByBoolMask(trpt1,trbl1)["in"];
trsl1=(Circle.ByCenterPointRadius(trpt2,0.5)).ExtrudeAsSolid(Vector.ZAxis(),0.5);
//Existing Buildings
exl1=Excel.ReadFromFile(fil1, ("Building"+(1..18))<1>,true);
exl2=List.DropItems(List.Transpose(exl1<1>)<1><2>,1);
exl3=Math.Round(String.ToNumber(exl2),3);
enx1=List.GetItemAtIndex(exl3<1>,0)-minXDed;
eny1=List.GetItemAtIndex(exl3<1>,1)-minYDed;
stx1=List.GetItemAtIndex(exl3<1>,3)-minXDed;
sty1=List.GetItemAtIndex(exl3<1>,4)-minYDed;
ep1=Point.ByCoordinates(enx1,eny1);
sp1=Point.ByCoordinates(stx1,sty1);
Line.ByStartPointEndPoint(sp1,ep1);
//Building 0
bg1dr1=Vector.ByTwoPoints(sp1[0][2],sp1[0][1]);
bg1pt1=sp1[0][1].Translate(bg1dr1,9);
bg1pt2=sp1[0][28].Translate(bg1dr1,2);
bg1pt3=sp1[0][19].Translate(bg1dr1,1);
bg1pt4=bg1pt3.Translate(18,-30,0);
bg1pt5=bg1pt4.Translate(0,0,12);
//Amphiteater
ampcir1=Circle.ByCenterPointRadius(bg1pt4,20).ExtrudeAsSolid(Vector.ZAxis(),-4);
ampcir2=Circle.ByCenterPointRadius(bg1pt4.Translate(Vector.ZAxis(),-4),12).ExtrudeAsSolid(Vector.ZAxis(),-1);
site1=PolyCurve.ByJoinedCurves(bdry4).ExtrudeAsSolid(Vector.ZAxis(),-8);
site2=(site1.Difference(ampcir1)).Difference(ampcir2);
//Corridor
crdDir1=Vector.ByTwoPoints(sp1[1][3],sp1[2][2]);
crdDir2=Vector.ByTwoPoints(sp1[14][0],sp1[1][3]);
crdPnt1=sp1[14][0].Translate(crdDir1,3).Translate(crdDir2,-45);
crdPln1=Plane.ByOriginNormal(crdPnt1,crdDir2);
crdSld1=Rectangle.ByWidthLength(crdPln1,9,6).Translate(0,0,4.5).ExtrudeAsSolid(crdDir2,290);
crdPnt2=crdPnt1.Translate(crdDir2,290).Translate(0,0,-2);
//Tunnel 1
tn1Dir1=Vector.ByTwoPoints(crdPnt2,bg1pt4.Translate(0,0,-2.25));
tn1Pln1=Plane.ByOriginNormal(crdPnt2,tn1Dir1);
tn1Sld1=Rectangle.ByWidthLength(tn1Pln1,3.5,6).ExtrudeAsSolid(tn1Dir1);
tn1Sld2=tn1Sld1.Difference(ampcir1);
//Tunnel 2
tn2Dir1=Vector.ByTwoPoints(bg1pt4.Translate(0,0,-2.25),sp2[0][1].Translate(0,0,-2.25));
tn2Pln1=Plane.ByOriginNormal(bg1pt4.Translate(0,0,-2),tn2Dir1);
tn2Sld1=Rectangle.ByWidthLength(tn2Pln1,3.5,6).ExtrudeAsSolid(tn2Dir1);
tn2Sld2=tn2Sld1.Difference(ampcir1);
//Vertical Transition
vt1Sld1=Circle.ByCenterPointRadius(crdPnt2.Translate(0,0,-2),8).ExtrudeAsSolid(Vector.ZAxis(),14);
crdSld2=Solid.ByUnion({crdSld1,tn1Sld2,vt1Sld1,tn2Sld2});
crdSld3=Solid.ByUnion({crdSld1,vt1Sld1});
site3=site2.Difference(crdSld2);
site4=site3.Explode()[10];
site5=site3.Explode()[0..9];
site6=site3.Explode()[12..15];
//Main Chakra
chkSrf2=chkSrf1.Scale(0.1).Translate(bg1pt4.X,bg1pt4.Y,11).Thicken(0.5);
chkSrf2A=chkSrf1.Scale(0.1).Translate(bg1pt4.X,bg1pt4.Y,11);
bg1dr2=Vector.ByTwoPoints(bg1pt1,bg1pt4);
bg1dr3=Vector.ByTwoPoints(bg1pt3,bg1pt4);
bg1dr4=Vector.ByTwoPoints(bg1pt2,bg1pt4);
bg1dr10=Vector.ByTwoPoints(sp1[0][10],sp1[0][15]);
bg1pt10=sp1[0][10].Translate(bg1dr10,-50);
bg1pt11=sp1[0][15].Translate(bg1dr10,20);
bg1dr11=Vector.ByTwoPoints(bg1pt4,bg1pt10);
bg1dr12=Vector.ByTwoPoints(bg1pt4,bg1pt11);
bg1pt12=(bg1pt10.Translate(0,0,18));
bg1pt13=(bg1pt10.Translate(0,0,21)).Translate(bg1dr11,3);
bg1pt14=(bg1pt11.Translate(0,0,18));
bg1pt15=(bg1pt11.Translate(0,0,21)).Translate(bg1dr12,3);
bg1ar10=Arc.ByThreePoints(bg1pt10,bg1pt12,bg1pt13);
bg1ar11=Arc.ByThreePoints(bg1pt11,bg1pt14,bg1pt15);
bg1sr10=Surface.ByLoft({bg1ar10,bg1ar11});
bg1ar1=Arc.ByThreePoints(bg1pt1,bg1pt3,bg1pt2);
bg1cr1=Circle.ByCenterPointRadius(bg1pt4,20);
bg1ar2=NurbsCurve.ByControlPoints({bg1pt1,(bg1pt1.Translate(0,0,15)).Translate(bg1dr2,4),(bg1pt1.Translate(0,0,45)).Translate(bg1dr2,25),bg1pt5},3);
bg1ar3=NurbsCurve.ByControlPoints({bg1pt3,(bg1pt3.Translate(0,0,18)).Translate(bg1dr3,0),(bg1pt3.Translate(0,0,45)).Translate(bg1dr3,21),bg1pt5},3);
bg1ar4=NurbsCurve.ByControlPoints({bg1pt2,(bg1pt2.Translate(0,0,15)).Translate(bg1dr4,3),(bg1pt2.Translate(0,0,45)).Translate(bg1dr4,21),bg1pt5},3);
bg1sr1=Surface.ByLoft({bg1ar2,bg1ar3,bg1ar4});
bg1cr1=PolyCurve.ByPoints({bg1pt4,bg1pt10.Translate(bg1dr10,12),bg1pt11.Translate(bg1dr10,-10)},true).Translate(Vector.ZAxis(),3);
bg1sl1=bg1cr1.ExtrudeAsSolid(Vector.ZAxis(),15).Difference(Circle.ByCenterPointRadius(bg1pt4,10).ExtrudeAsSolid(Vector.ZAxis(),25));
bg1sl2=(bg1sl1.Trim(bg1sr1,bg1pt4)).Trim(bg1sr10,bg1pt10);
bg1sr2=Flatten(bg1sl2.Explode())[{1,2,4}];
bg1sr11={bg1sr1,bg1sr10}.ToNurbsSurface();
bg1sr12=TSplineSurface.ByNurbsSurfaceUniform(bg1sr11,8,8,true,true,true);
bg1sr13=TSplineSurface.Thicken(bg1sr12,1,true);
bg1sr14=bg1sr12[0].WeldCoincidentVertices(0.001);
bg1msh1=bg1sr13.ToMesh(1,0.01);
bldg0=Flatten({bg1sr13,bg1sr13,bg1sl2});
//Function - Building Footprint
def bldBdr (sp1:var[]..[],ep1:var[]..[],bn,sq:var[]..[])
{
blps=List.SortByKey(sp1[bn],sq)["sorted list"];
blpe=List.SortByKey(ep1[bn],sq)["sorted list"];
blpn=Equals(blps<1>,List.ShiftIndices(blps,1)<1>)?blpe:blps;
bldg=PolyCurve.ByPoints(SetUnion(blpn,blpe),true);
return=bldg;
};
//Existing Building Footprint
bldg1=bldBdr(sp1,ep1,1,{0,1,3,2});
bldg2=bldBdr(sp1,ep1,2,{2,0,3,1});
bldg3=bldBdr(sp1,ep1,3,{0,2,1,3});
bldg4=bldBdr(sp1,ep1,4,{2,3,1,0});
bldg5=bldBdr(sp1,ep1,5,{3,0,1,2});
bldg6=bldBdr(sp1,ep1,6,{2,3,1,0});
bldg7=bldBdr(sp1,ep1,7,{1,2,3,0});
bldg8=bldBdr(sp1,ep1,8,{1,0,2,3});
bldg9=bldBdr(sp1,ep1,9,{2,0,3,1});
bldg10=bldBdr(sp1,ep1,10,{3,0,2,1});
bldg11=bldBdr(sp1,ep1,11,{1,0,2,3});
bldg12=bldBdr(sp1,ep1,12,{2,0,1,3});
bldg13=bldBdr(sp1,ep1,13,{2,3,1,0});
bldg14=bldBdr(sp1,ep1,14,{0,3,2,1});
bldg15=bldBdr(sp1,ep1,15,{2,3,1,0});
bldg16=bldBdr(sp1,ep1,16,{2,3,1,0});
bldg17=bldBdr(sp1,ep1,17,{2,3,1,0});
bldgs={bldg1,bldg2,bldg3,bldg4,bldg5,bldg6,bldg7,bldg8,bldg9,bldg10,bldg11,
bldg12,bldg13,bldg14,bldg15,bldg16,bldg17}.ExtrudeAsSolid(Vector.ZAxis(),12);
//Chakras on buildings
bldgs1=bldgs[{0,2,4,6,8,9,10,11,12,13,14,16}].Explode();
bld1Sr1=List.GetItemAtIndex(bldgs1<1>,{2,0,1,2,1,2,0,1,0,1,0,0}<1>);
bld1Cs1=bld1Sr1.CoordinateSystemAtParameter(0.5,0.5);
chkSrf3=((chkSrf1.Scale(0.02))<1>.Transform(bld1Cs1<2>)).Thicken(0.25);
//Dome
dmci1=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,2),3);
dmci2=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,2.25),2.75);
dmci3=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,2.25),2.5);
dmci4=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,2.75),2.25);
dmci5=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,3.65),1.75);
dmci6=Circle.ByCenterPointRadius(Point.ByCoordinates(0,0,4),0.5);
dmrc1=Rectangle.ByWidthLength(5.5432772,5.5432772).ExtrudeAsSolid(Vector.ZAxis(),1.5);
dmoc1=Polygon.RegularPolygon(dmci1,8).ExtrudeAsSolid(Vector.ZAxis(),-0.5).Rotate(Point.Origin(),Vector.ZAxis(),22.5);
dmoc2=Solid.ByLoft({Polygon.RegularPolygon(dmci1,8),Polygon.RegularPolygon(dmci2,8)}).Rotate(Point.Origin(),Vector.ZAxis(),22.5);
dmhm1=Solid.ByLoft({dmci3,dmci4,dmci5,dmci6});
dome1=Solid.ByUnion({dmrc1,dmoc1,dmoc2,dmhm1});
bld1Sr2=List.GetItemAtIndex((bldgs.Explode())<1>,({2,1,0,0,1,0,2,0,1,2,0,1,0,1,0,2,0})<1>);
bld1Sr3=List.GetItemAtIndex((bldgs.Explode())<1>,({0,3,2,2,3,3,0,2,3,0,2,3,2,3,2,0,2})<1>);
bld1Pt1=bld1Sr2.PointAtParameter(0.5,1);
bld1Pt2=bld1Sr3.PointAtParameter(0.5,1);
bld1Pt3=bld1Sr2.PointAtParameter(1,1);
bld1Dr1=Vector.ByTwoPoints(bld1Pt1,bld1Pt2);
bld1Dr2=Vector.ByTwoPoints(bld1Pt2,bld1Pt3);
//bld1Pt4=bld1Pt1<1>.Translate(bld1Dr1<1>,(6..#14..10)<2>);
bld1Pt4=bld1Pt1<1>.Translate(bld1Dr1<2>,(6..#14..10)<2>);
bld1Bl1=bld1Pt4.DoesIntersect(bldgs);
bld1Pt5=List.FilterByBoolMask(bld1Pt4,bld1Bl1)["in"];
bld1cs5=CoordinateSystem.ByOriginVectors(bld1Pt5<1>,bld1Dr2,bld1Dr1,Vector.ZAxis());
dome11=Solid.ByUnion(Flatten(dmrc1.Transform(bld1cs5)));
dome12=Solid.ByUnion(Flatten(Solid.ByUnion({dmoc1,dmoc2}).Transform(bld1cs5)));
dome13=Solid.ByUnion(Flatten(dmhm1.Transform(bld1cs5)));
domes={dome11,dome12,dome13};
//Direct Shape
dsCat1=Category.ByName("Generic Models");
dsSit1=DirectShape.ByGeometry(site4,dsCat1,Material.ByName(".site1"),"nwmSite");
dsTre1=DirectShape.ByGeometry(trsl1,dsCat1,Material.ByName(".trees1"),"nwmTrees");
dsTun1=DirectShape.ByGeometry(site5,dsCat1,Material.ByName(".tunnel1"),"nwmTunnel");
dsCrt1=DirectShape.ByGeometry(site6,dsCat1,Material.ByName(".court1"),"nwmCourt");
dsCrd1=DirectShape.ByGeometry(crdSld3,dsCat1,Material.ByName(".corridor1"),"nwmCorridor");
dsBl01=DirectShape.ByMesh(bg1msh1[0],dsCat1,Material.ByName(".building01"),"nwmFeature01");
dsBl02=DirectShape.ByMesh(bg1msh1[1],dsCat1,Material.ByName(".building02"),"nwmFeature02");
dsBl03=DirectShape.ByGeometry(bg1sl2,dsCat1,Material.ByName(".building03"),"nwmGarage");
dsBl11=DirectShape.ByGeometry(bldgs,dsCat1,Material.ByName(".building11"),"nwmBuildings");
dsDom1=DirectShape.ByGeometry(dome11,dsCat1,Material.ByName(".domes1"),"nwmDomes01");
dsDom2=DirectShape.ByGeometry(dome12,dsCat1,Material.ByName(".domes2"),"nwmDomes02");
dsDom3=DirectShape.ByGeometry(dome13,dsCat1,Material.ByName(".domes3"),"nwmDomes03");
dsChk1=DirectShape.ByGeometry(chkSrf2,dsCat1,Material.ByName(".chakra1"),"nwmChakra01");
dsChk2=DirectShape.ByGeometry(chkSrf3,dsCat1,Material.ByName(".chakra2"),"nwmChakra02");