hi,
I have two lines and I have extracted their startpoints, endpoints
then I want to form a polygon by using polydon.bypoints or polycurve.bypoints, but the result is like this:
how can I make a rectangular polygon instead of crossing unwanted points?
Hi,
Unfortunately you won’t get a perfect method, because shapes are so variable…
If your points are being extracted in a very predictable way and always come out in the same order, then you can manually set the sequence.
If not, something that will often work, is to take an average point, then sort the points by angle around it.
Hope that helps,
Mark
1 Like
means I better rearrange my output points before making polygon?
thanks
Daan
July 25, 2022, 8:42am
4
Hi @newshunhk ,
You could use the ConvexHull node for this.
2 Likes
Hello,
Here is a method, not necessarily the fastest
have a good day
Cordially
christian.stan
3 Likes
Hello,
Here is an approach with a conditional in the Mr. @Mark.Ackerley approach, to always progress
Code Block
Line1;
VectLine1;
Line2;
VectLine2;
VectLine1==VectLine2?
[Line.ByStartPointEndPoint
(Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line1,0),
Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line2,0)),
Line.ByStartPointEndPoint
(Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line1,1),
Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line2,1))]
:
[Line.ByStartPointEndPoint
(Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line1,0),
Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line2,1)),
Line.ByStartPointEndPoint
(Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line1,1),
Autodesk.DesignScript.Geometry.Curve.PointAtParameter(Line2,0))];
have a good day
Cordially
christian.stan
3 Likes
A method utilizing only nodes, as that may be a bit easier for others to learn from.
4 Likes