> For the complete documentation index, see [llms.txt](https://gitbook.testingwaters.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.testingwaters.in/motion/cloth.md).

# Cloth

![](/files/-MC2mUEIqcUdjmbqunTY)

```d
obmx = obj1.BoundingBox.MaxPoint;
obmn = obj1.BoundingBox.MinPoint;
obcn = Point.ByCoordinates((obmx.X + obmn.X)/2 , (obmx.Y + obmn.Y)/2 , obmx.Z);

clt2 = clt1.Translate(Vector.ZAxis(), obmx.Z).PerimeterCurves();
clt3 = clt2.PointAtParameter(0..1..#(clt2.Length/2));

cll1 = Line.ByStartPointEndPoint(clt3<1>,obcn);
cll2 = PolyCurve.ByJoinedCurves(obj1.ProjectInputOnto(cll1,Vector.ByCoordinates(0,0,-1)));
cll3 = Line.ByStartPointDirectionLength(cll2.StartPoint,Vector.ZAxis(),cll2.Length-cll1.Length);

cld1 = NurbsCurve.ByPoints(cll3.EndPoint).Length/(clt2.Length/2);
cld2 = Math.Sqrt(Math.Pow(clt2.Length/(clt2.Length/2),2)-Math.Pow(cld1,2));

cld3 = List.Shuffle(List.Flatten(List.Transpose(List.Transpose([List.Cycle(0,Math.Floor(List.Count(cll3.EndPoint<1>)/2)),List.Cycle(cld2<1>,Math.Ceiling(List.Count(cll3.EndPoint<1>)/2)<1>)])<1>)<1>,-1)<1>);
dis1 = Vector.ByTwoPoints(Point.ByCoordinates(obcn.X,obcn.Y,List.MinimumItem(List.Flatten(cll3.EndPoint,-1).Z)),cll3.EndPoint);

clc1 = PolyCurve.ByJoinedCurves(obj1.PerimeterCurves());

clc2 = NurbsCurve.ByPoints(List.Clean(List.Flatten(cll3.EndPoint.Translate(dis1,cld3),-1),false),true);

srf1 = PolySurface.ByJoinedSurfaces(List.Flatten([obj1,Surface.ByLoft([clc1,clc2])],-1));
```

![](/files/-MC1jmMaU1higHlVJtls)

{% file src="/files/-MC1juXCro2\_qZBqxA2X" %}
Dynamo ver 2.8
{% endfile %}
