Filter points with by maximum distance from a set of points

Hi!

I am trying to setup a workflow where i based on intersections between walls and rafters, automatically place roof anchors based on the points collected.

But when getting to the point of creating the part which on the basis of an maximum distance input, ensures that families aren’t placed at every rafter, but with a maximum distance between the elements - i really start to struggle.

I have identified the start point, and the distance from this point, to the remaining points - i however cant really grasp the logic of how to filter the points from here.

Example:
First point at 0,0,0 and a maximum allowed distance of 3000.

Following rafters placed at:
1: 0,0,1000 (no anchors needed)
2: 0,0,2000 (no anchors needed)
3: 0,0,3000 (anchors needed!)
4: 0,0,4000 (no anchors needed)
5: 0,0,5000 (no anchors needed)
6: 0,0,5800 (anchors needed!)
7: 0,0,7000 (no anchors needed)
8: 0,0,8000 (anchors needed!)
9: 0,0,9000 (no anchors needed)

Have any of you had any luck in building a similar kind of logic?

I believe there are nodes like Geometry.DistanceTo may work here for you if you give it a range to be within.

you have to solve this by iteration or recursion.I think this will be a bit tricky with oob nodes. I have written a for loop in python that solve this by iteration and explained the logic behind, hope it make sense.maxdistancetopoint.dyn (13.9 KB)

1 Like

That is exactly what i needed, thanks!

Have just ran the python code - is there an easy way of looping the filtering on a list with multiple subslist, i seems that it doesnt expect to meet a list of lists :).
maxdistancetopoint.dyn

I have never gotten round to python - but i think i need to spend some time on getting my python game up to speed :slight_smile:

you just have to loop over the list of lists and in that loop run the loop i the script. ill have a look later today:)

but the code will only need minor change.if you wanna try

for k in Dist:
    Start=k[0]
    for i,j in Zip(k[:-1], k[1:]):
        #The lo0p in the script
1 Like

That did the trick! Amazing!

Is there any way to keep the list structure of the input within the python code?
I have made a brute workaround, but it would be much neater if it was easy to incorporate in the python code.

my solution will not work on an arbitrarily nested list but i have tweeked it so it works for a list of lists(2 levels) but it will not work for a flat list anymore. maxdistancetopointfrom list of lists.dyn (17.4 KB)

1 Like

Did the trick, thanks a lot!

1 Like