Facade
Office Building Facade
1
//Bottom Curve West
2
bp1 = Plane.ByThreePoints(Point.ByCoordinates(-6,-10,0),Point.ByCoordinates(-6,6,2),Point.ByCoordinates(0,-10,0));
3
bc1 = NurbsCurve.ByPoints(Point.ByCoordinates([-7.5,-6,-5.5,-6,-7.5],[-12.5,-10,-4.5,1,3.5],2)).PullOntoPlane(bp1);
4
5
//Top Curve West
6
tp1 = Plane.ByThreePoints(Point.ByCoordinates(-6,-10,10.5),Point.ByCoordinates(-6,6.5,8.5),Point.ByCoordinates(0,-10,10.5));
7
tc1 = NurbsCurve.ByPoints(Point.ByCoordinates([-14.25,-6,-5.75,-7.5],[-11.75,-10,0.5,6.5],8.5)).PullOntoPlane(tp1);
8
9
//Vertical Curves
10
fc1 = NurbsCurve.ByPoints([bc1.StartPoint,Point.ByCoordinates(-10,-11,8),tc1.StartPoint]);
11
rc1 = NurbsCurve.ByPoints([bc1.EndPoint,Point.ByCoordinates(-7,4,8),tc1.EndPoint]);
12
13
ic1 = NurbsCurve.ByPoints([fc1.PointAtParameter(0.5),Point.ByCoordinates(-8.15,-11.5,5.75),rc1.PointAtParameter(0.5)]);
14
15
//MirrorPlane
16
mp1 = Plane.ByOriginNormal(Point.ByCoordinates(-0.5,0,0),Vector.XAxis());
17
18
//Surfaces
19
ls1 = Surface.ByLoft([bc1,ic1,tc1],[fc1,rc1]);
20
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));
21
tc2 = fc2.Project(tp1,Vector.ZAxis());
22
ts1 = PolyCurve.ByJoinedCurves(List.Flatten([tc2,tc1,Line.ByStartPointEndPoint(tc1.EndPoint,tc1.Mirror(mp1).EndPoint),tc1.Mirror(mp1)],-1)).Patch();
23
rs1 = ls1.Mirror(mp1);
24
tc3 = Line.ByStartPointEndPoint(Point.ByCoordinates(14.625,-12.516,11.583),Point.ByCoordinates(-14.625,-12.516,11.583));
25
ts2 = Surface.ByLoft(List.Flatten([tc2,tc3],-1));
26
fs1 = tc3.Extrude(Vector.ZAxis(),23);
27
ps1 = PolySurface.ByJoinedSurfaces(List.Flatten([ls1,ts1,rs1,ts2,fs1],-1));
28
pl1 = Plane.ByOriginNormal(Point.ByCoordinates(7.5,3.5,2),Vector.ByCoordinates(0,-1,1)).Translate(Vector.ByCoordinates(0,-1,1),0..40..1);
29
pc1 = List.Clean(PolyCurve.ByJoinedCurves(ps1.Intersect(pl1)),false);
30
pc2 = List.AddItemToEnd(List.LastItem(pc1).Translate(0,4,3),pc1);
31
pt1 = List.Transpose(pc2<1>.PointAtParameter(0..1..#10));
32
nc1 = NurbsCurve.ByPoints(List.TakeEveryNthItem(pt1<1>,2,0),3);
33
sr1 = Surface.ByLoft(nc1);
34
pt2 = sr1<1>.PointAtParameter((0.1..0.825..#15)<2>,(0.15..0.85..#10)<3>);
35
nr1 = sr1<1>.NormalAtParameter((0.1..0.85..#15)<2>,(0.15..0.85..#10)<3>);
36
cr1 = Solid.ByUnion(List.Flatten(Circle.ByCenterPointRadiusNormal(pt2,0.75,nr1).Patch().Thicken(0.25),-1));
37
fd1 = sr1.SubtractFrom(cr1).Thicken(0.1);
Copied!
Residence Remodeled
20150925-1.zip
3KB
Binary
1
Msk1=Rm.GetParameterValueByName("Comments")=="Road Facing";
2
RmFil=Flatten(List.FilterByBoolMask(Rm,Msk1)["in"]);
3
RmNam=RmFil.GetParameterValueByName("Name");
4
RmSlGm=Flatten(RmFil.Geometry());
5
RmTnSh=RmSlGm.ThinShell(100,200);
6
Rms=Solid.ByUnion(Flatten([RmSlGm,RmTnSh]));
7
8
RmBb=((BoundingBox.ByGeometry(Rms)).ToCuboid()).Translate(Vector.YAxis(),-100);
9
10
//Determining the pivot point of cutting planes
11
RmsBb=BoundingBox.ByGeometry(Rms);
12
MnX=RmsBb.MinPoint.X;
13
MxX=RmsBb.MaxPoint.X;
14
MnY=RmsBb.MinPoint.Y;
15
MxY=RmsBb.MaxPoint.Y;
16
MnZ=RmsBb.MinPoint.Z;
17
MxZ=RmsBb.MaxPoint.Z;
18
19
//Three Lines at corners to create plane reference points
20
RfLn1=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MnY,MnZ),Point.ByCoordinates(MxX,MnY,MnZ));
21
RfLn2=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MnY,MxZ),Point.ByCoordinates(MxX,MnY,MxZ));
22
RfLn3=Line.ByStartPointEndPoint(Point.ByCoordinates(MnX,MxY,MnZ),Point.ByCoordinates(MxX,MxY,MnZ));
23
24
//RfPn1=Flatten({RfLn1,RfLn2,RfLn3})<1><2>.PointAtParameter(0..1..#VerDiv)<3>;
25
RfPn1=Flatten([RfLn1,RfLn2,RfLn3])<1><2>.PointAtParameter(
26
[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>;
27
RfPn2=List.Flatten(RfPn1,1);
28
RfPl1=Plane.ByThreePoints(RfPn2[0],RfPn2[1],RfPn2[2]);
29
30
//Sweep Profile
31
RfSr1=Rms.Intersect(RfPl1);
32
RfCr1=RfSr1.PerimeterCurves();
33
RfMs1=(RfCr1.StartPoint.Y>=(MxY-100))&&(RfCr1.EndPoint.Y>=(MxY-100));
34
RfCr2=List.FilterByBoolMask(RfCr1,RfMs1)["out"];
35
RfMs2=(RfCr2.StartPoint.Z<=(MnZ+100))&&(RfCr2.EndPoint.Z<=(MnZ+100));
36
RfCr3=List.FilterByBoolMask(RfCr2,RfMs2)["out"];
37
RfCr4=Flatten(PolyCurve.ByJoinedCurves(RfCr3));
38
RfCr5=crvDir(RfCr4)[0]==crvDir(RfCr4)?RfCr4.Reverse():RfCr4;
39
RfCr6=List.DropItems(List.Sublists(RfCr5.StartPoint,0..1,1),-1);
40
41
l2=Transpose(RfCr6)[0].Translate(Vector.YAxis(),100);
42
RfCr7=Transpose([l2,Transpose(RfCr6)[1]]);
43
RfCr8=Line.ByBestFitThroughPoints(RfCr7);
44
RfCr9=PolyCurve.ByThickeningCurve(RfCr8,200,Vector.ZAxis());
45
46
//Creating the Exterior Solid Mass
47
ExSwCr=List.Reverse(RfCr9);
48
ExSwPr=List.DropItems((List.Reverse(RfCr5)),-1);
49
ExSwSl=Solid.ByUnion(Flatten((ExSwCr.SweepAsSolid(ExSwPr)).Intersect(RmBb)));
Copied!
1
//Graham scan to check line direction
2
//https://en.wikipedia.org/wiki/Graham_scan
3
def crvDir(crv:var){
4
p1=crv.PointAtParameter(0);
5
p2=crv.PointAtParameter(0.1);
6
p3=crv.PointAtParameter(1);
7
r=(p2.Y-p1.Y)*(p3.Z-p1.Z)-(p2.Z-p1.Z)*(p3.Y-p1.Y);
8
return=r==0?"colinear":(r<0?"clockwise":"counter clockwise");
9
};
Copied!
Last modified 10mo ago
Copy link