Isolate points from a list of points and lines


#1

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.

2015-01-14_1139


#2

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.

Point and Line Filter


#3

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


#4

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. :-?


#5

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):

2015-01-15_095504


#6

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).

2015-01-15_0836

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?

2015-01-15_0925


#7

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…


#8

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.2015-01-15_1154

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.

2015-01-15_1158

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

2015-01-15_1258


#9

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.)

 

shortest closed distance PointSequence Accumulated Distance Alteration