# Facade

![Office Building Facade](/files/-MRj_8nisbmzSeDhKCrH)

```d
//Bottom Curve West
bp1 = Plane.ByThreePoints(Point.ByCoordinates(-6,-10,0),Point.ByCoordinates(-6,6,2),Point.ByCoordinates(0,-10,0));
bc1 = NurbsCurve.ByPoints(Point.ByCoordinates([-7.5,-6,-5.5,-6,-7.5],[-12.5,-10,-4.5,1,3.5],2)).PullOntoPlane(bp1);

//Top Curve West
tp1 = Plane.ByThreePoints(Point.ByCoordinates(-6,-10,10.5),Point.ByCoordinates(-6,6.5,8.5),Point.ByCoordinates(0,-10,10.5));
tc1 = NurbsCurve.ByPoints(Point.ByCoordinates([-14.25,-6,-5.75,-7.5],[-11.75,-10,0.5,6.5],8.5)).PullOntoPlane(tp1);

//Vertical Curves
fc1 = NurbsCurve.ByPoints([bc1.StartPoint,Point.ByCoordinates(-10,-11,8),tc1.StartPoint]);
rc1 = NurbsCurve.ByPoints([bc1.EndPoint,Point.ByCoordinates(-7,4,8),tc1.EndPoint]);

ic1 = NurbsCurve.ByPoints([fc1.PointAtParameter(0.5),Point.ByCoordinates(-8.15,-11.5,5.75),rc1.PointAtParameter(0.5)]);

//MirrorPlane
mp1 = Plane.ByOriginNormal(Point.ByCoordinates(-0.5,0,0),Vector.XAxis());

//Surfaces
ls1 = Surface.ByLoft([bc1,ic1,tc1],[fc1,rc1]);
fc2 = NurbsCurve.ByPoints(List.Flatten([tc1.StartPoint,Point.ByCoordinates([-6,0.5,5.5],[-11.75,-11,-11.75],8.5),tc1.StartPoint.Mirror(mp1)],-1));
tc2 = fc2.Project(tp1,Vector.ZAxis());
ts1 = PolyCurve.ByJoinedCurves(List.Flatten([tc2,tc1,Line.ByStartPointEndPoint(tc1.EndPoint,tc1.Mirror(mp1).EndPoint),tc1.Mirror(mp1)],-1)).Patch();
rs1 = ls1.Mirror(mp1);
tc3 = Line.ByStartPointEndPoint(Point.ByCoordinates(14.625,-12.516,11.583),Point.ByCoordinates(-14.625,-12.516,11.583));
ts2 = Surface.ByLoft(List.Flatten([tc2,tc3],-1));
fs1 = tc3.Extrude(Vector.ZAxis(),23);
ps1 = PolySurface.ByJoinedSurfaces(List.Flatten([ls1,ts1,rs1,ts2,fs1],-1));
pl1 = Plane.ByOriginNormal(Point.ByCoordinates(7.5,3.5,2),Vector.ByCoordinates(0,-1,1)).Translate(Vector.ByCoordinates(0,-1,1),0..40..1);
pc1 = List.Clean(PolyCurve.ByJoinedCurves(ps1.Intersect(pl1)),false);
pc2 = List.AddItemToEnd(List.LastItem(pc1).Translate(0,4,3),pc1);
pt1 = List.Transpose(pc2<1>.PointAtParameter(0..1..#10));
nc1 = NurbsCurve.ByPoints(List.TakeEveryNthItem(pt1<1>,2,0),3);
sr1 = Surface.ByLoft(nc1);
pt2 = sr1<1>.PointAtParameter((0.1..0.825..#15)<2>,(0.15..0.85..#10)<3>);
nr1 = sr1<1>.NormalAtParameter((0.1..0.85..#15)<2>,(0.15..0.85..#10)<3>);
cr1 = Solid.ByUnion(List.Flatten(Circle.ByCenterPointRadiusNormal(pt2,0.75,nr1).Patch().Thicken(0.25),-1));
fd1 = sr1.SubtractFrom(cr1).Thicken(0.1);
```

![](/files/-MRj_3TDcFjhZQ8lubAC)

![Residence Remodeled](/files/-LhLnQYAsMo8jLkvYVMY)

{% file src="/files/-LhM3DoHbWsGyKSv2zYJ" %}

```d
Msk1=Rm.GetParameterValueByName("Comments")=="Road Facing";
RmFil=Flatten(List.FilterByBoolMask(Rm,Msk1)["in"]);
RmNam=RmFil.GetParameterValueByName("Name");
RmSlGm=Flatten(RmFil.Geometry());
RmTnSh=RmSlGm.ThinShell(100,200);
Rms=Solid.ByUnion(Flatten([RmSlGm,RmTnSh]));

RmBb=((BoundingBox.ByGeometry(Rms)).ToCuboid()).Translate(Vector.YAxis(),-100);

//Determining the pivot point of cutting planes
RmsBb=BoundingBox.ByGeometry(Rms);
MnX=RmsBb.MinPoint.X;
MxX=RmsBb.MaxPoint.X;
MnY=RmsBb.MinPoint.Y;
MxY=RmsBb.MaxPoint.Y;
MnZ=RmsBb.MinPoint.Z;
MxZ=RmsBb.MaxPoint.Z;

//Three Lines at corners to create plane reference points
RfLn1=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MnY,MnZ),Point.ByCoordinates(MxX,MnY,MnZ));
RfLn2=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MnY,MxZ),Point.ByCoordinates(MxX,MnY,MxZ));
RfLn3=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MxY,MnZ),Point.ByCoordinates(MxX,MxY,MnZ));

//RfPn1=Flatten({RfLn1,RfLn2,RfLn3})<1><2>.PointAtParameter(0..1..#VerDiv)<3>;
RfPn1=Flatten([RfLn1,RfLn2,RfLn3])<1><2>.PointAtParameter(
[0,0.05,0.1,0.15,0.25,0.30,0.365,0.45,0.58,0.62,0.75,0.785,0.915,0.975,1])<3>;
RfPn2=List.Flatten(RfPn1,1);
RfPl1=Plane.ByThreePoints(RfPn2[0],RfPn2[1],RfPn2[2]);

//Sweep Profile
RfSr1=Rms.Intersect(RfPl1);
RfCr1=RfSr1.PerimeterCurves();
RfMs1=(RfCr1.StartPoint.Y>=(MxY-100))&&(RfCr1.EndPoint.Y>=(MxY-100));
RfCr2=List.FilterByBoolMask(RfCr1,RfMs1)["out"];
RfMs2=(RfCr2.StartPoint.Z<=(MnZ+100))&&(RfCr2.EndPoint.Z<=(MnZ+100));
RfCr3=List.FilterByBoolMask(RfCr2,RfMs2)["out"];
RfCr4=Flatten(PolyCurve.ByJoinedCurves(RfCr3));
RfCr5=crvDir(RfCr4)[0]==crvDir(RfCr4)?RfCr4.Reverse():RfCr4;
RfCr6=List.DropItems(List.Sublists(RfCr5.StartPoint,0..1,1),-1);

l2=Transpose(RfCr6)[0].Translate(Vector.YAxis(),100);
RfCr7=Transpose([l2,Transpose(RfCr6)[1]]);
RfCr8=Line.ByBestFitThroughPoints(RfCr7);
RfCr9=PolyCurve.ByThickeningCurve(RfCr8,200,Vector.ZAxis());

//Creating the Exterior Solid Mass
ExSwCr=List.Reverse(RfCr9);
ExSwPr=List.DropItems((List.Reverse(RfCr5)),-1);
ExSwSl=Solid.ByUnion(Flatten((ExSwCr.SweepAsSolid(ExSwPr)).Intersect(RmBb)));
```

```d
//Graham scan to check line direction
//https://en.wikipedia.org/wiki/Graham_scan
def crvDir(crv:var){
p1=crv.PointAtParameter(0);
p2=crv.PointAtParameter(0.1);
p3=crv.PointAtParameter(1);
r=(p2.Y-p1.Y)*(p3.Z-p1.Z)-(p2.Z-p1.Z)*(p3.Y-p1.Y);
return=r==0?"colinear":(r<0?"clockwise":"counter clockwise");
};
```

![](/files/-LhLnNUNRLQDZ8fkfkhg)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.testingwaters.in/projects-1/facade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
