# Isolate points from a list of points and lines

I know this will be easy for someone other than me. :oops: All I want to do is get a list of the points and leave everything else behind.

What about making the points and lines strings, then doing a filter by bool mask to get only the parts that start with â€śPointâ€ť. See image below.

I was just thinking about this yesterday, some type checking would be useful you should be able to do this easily with a python nodeâ€¦ something like

output = []

for item in list:

if item is type(item) is Line:

output.append(item)

OUT = output

Exactly what I was looking for Ben! Thanks.

@Michaelâ€¦I will try your approach as well, except I doubt my python skills are good enough to make it happen. :-?

It might be faster to use the â€śList.Filterâ€ť node in a combination with a query type of one of the involved geometries - i.e the X coordinate of a point(lines donâ€™t have an X) or the length of a curve(points donâ€™t have a length):

1 Like

Works great! Thanks Dimitar.

And as often is the case, solving one problem has exposed another! I have surfaces that I am offsetting different distances. I am trying to create a boundary to use to create area boundary lines. So I used Geometry.Intersect to find the points where surfaces intersect thinking I could then just create a surface between points from which I could get a boundary. The solutions above helped to isolate the points from other Geometry.Intersections (lines). I thought I would then use Surface.ByPerimeterPoints to create a surface from which I could get the boundary. Unfortunately as the image shows, Surface.ByPerimeterPoints apparently must draw curves and then create the surface. As the image shows, the point order creates lines that cross resulting in an error (canâ€™t create surface).

Can I resolve this problem by finding the intersections in a different way? I pretty much stumbled on the way to get the intersect points to appear, but maybe there is a way to get them to appear in the correct order?

I donâ€™t know how to actually accomplish this in Dynamo, but the my guess is that basic premise would be that the correct perimeter path would generate the shortest distance.

In your example image there are 5 points. The sum of the distances of line(P1/p2) +Line(P2/P3)+Line(P3/P4)+Line(P4/P5)+Line(P5/P1) would be the least of all possible combinations. (compare to say line(P1/p3) +Line(P3/P5)+Line(P5/P2)+Line(P2/P4)+Line(P4/P1))

There is a node under Clockwork that is called PointSequences.ShortestPath and PointSequence Accumulated Distance that I would guess could help solve this, although iâ€™m not sure how you would then retrieve the correct sequence of points to followâ€¦

Managed to figure out a solution. I revisited the Geometry.Intersect since it was testing too many elements for intersection. The first thing I did was isolate just the surface perimeter curves I was interested inâ€¦did that by first filtering out curves that didnâ€™t have a StartPoint = 0â€¦then I filtered the list again removing curves without an EndPoint = 0.

Next I Flattened the list and did Geometry.Intersect which when I did a List.Map and Flatten gave me a nice list of points collected (along with unnecessary lines) in the order I needed them.

Then I filtered the Points from Lines using the method Dimitar suggested above, List.Chop into Start and EndPoints and created PolyCurve.ByPoints.

Glad you figured it out Nelson. I spent a few minutes to see if what i suggested would work. I had to make a few changes to the PointSequence.Accumulated Distance node to get a closed perimeter distance (looping back from the last point in the sequence to the first). This worked with my simplistic example, but i donâ€™t know if it would always work out such that the shortest closed distance = the perimeter of points.)

Â