# Select the longest vectors from different polygons

I would like to have a list of the longest vectors of the different polygons created, that is, with their coordinates and length. For example if I have two 4-sided or rectangular polygons, I will have 8 vectors of those 8 vectors I want my 2 longest vectors one for each polygon.

I attach an image how far I have come

Hi @henrybajana,

When you say â€śpolygonâ€ť do mean a Dynamo Polygon or Polycurve? From your screenshot it appears youâ€™re dealing with Polycurves. Keep in mind that Polycurves arenâ€™t always guaranteed to only contain line segments, so connecting the start/end points of each segment wouldnâ€™t always produce the same length as the segment itself. Not sure if that is a concern or not.

Hereâ€™s an example using a Dynamo Polygon.

Sorry, just realized you were looking to do this with multiple polygons. So essentially the longest side of each one.

2 Likes

Yes, I meant Polycurve, my fault. Thank you for the help me.
So in summary I wanted to know the greatest lengths of my vectors of the different closed polygons that I have in the model space. To see that everything is clear:

1. You got the start and end point of the curves
2. you created a list of those points
3. you created a polygon by points
4.and next what you showed me in the picture rigth?

Yes, thatâ€™s correct. Iâ€™m wondering though, do you need to use vectors? If you are trying to find the longest side of each polygon, then you could just use Curve.Length after Polycurve.Curves and get to the result instead of creating vectors. Then it would work if the source Polylines have arc segments, whereas using vectors is only valid for line segments.

I have a question when you explode your geometry you have 18 lines because you have 2 polygons of 9 lines each one. But when I explode my 2 polygon of 4 lines each one i have 16 linesâ€¦Why is that?

Not sure. Hereâ€™s an example for you.

SortingExample.dwg (489.8 KB)
SortingExample.dyn (25.3 KB)

1 Like

I really appreciate your help, thank you very much!

1 Like