February 18, 2020, 1:42pm
I would like to separate a lot of lines into 2 groups:
the line’s midpoint has a z value equal to any of the values written into a panel
the rest of the lines
With cross reference I managed to solve the first part, but the false values are still not the ones I would like to achieve.
The problem is that these are discrete z values, not a range, and I don’t know how to test the line midpoints for them at the same time without many OR gates.
Group_based_on_Z.gh (18.6 KB)
The seven values in your panel don’t include all of the possible values of ‘Z’ in your data:
February 18, 2020, 2:00pm
Yes, that’s the point, from all the possible values I would like to separate the ones on the panel list and the ones that are not part of it.
It could work with a true/false pattern, the problem is as I had no better idea I had to use a cross reference which messes with the false values.
Is this what you’re looking for?
Group_based_on_Z.gh (23.4 KB)
You can add
PShift (Shift Paths) to the Dispatch outputs to restore the original tree structure.
February 18, 2020, 2:51pm
Thank you for your work, this is the solution I was looking for!
I personally prefer Joseph’s one !
I’d just add shift path at the end to retrieve the same datastructure as the begining.
My solution starts by flipping the tree, so the lines are by level (and not by rows).
It just depends on what you need to do from here !
February 18, 2020, 3:13pm
I tried to implement Joe’s solution in my original code but, unfortunately it didn’t give the right true/false values for me with MM. (not really sure why, Similarity didn’t work either)
I need the original data structure, so I left out flipping and cleaning the tree (only graft + shift at the end) and it works just like I wanted! (had to use ‘similarity’ there also as ‘equality’ was missing some lines)
So at the end I used a hybrid solution, but thank you for suggesting MM/MA, I didn’t even think about it!
That lost me right at the beginning!
Well… It works with the data you presented and makes sense to me so what can I say? You must have missed something.
Did you graft the output of
Clean Tree at the beginning?
Did you see my comment about adding
PShift (Shift Paths) to the Dispatch outputs to restore the original tree structure?
February 18, 2020, 4:10pm
Yes, it worked perfectly in this small code for me too, however when I implemented it in my original, bigger code it didn’t work the same (I couldn’t find out why, it has to do something with decimal places, but Similarity should have solved it )
It is a mistery why it works different, because I internalised the lines from the bigger code.
Anyways, it is working now, so thank your for the help Joseph!
If you have LunchBox use sort duplicate values
Group_based_on_Z2.gh (24.9 KB)
If you have LunchBox…
I don’t. The pattern of lines in your image is not the same as what
@antoinemaesantoine and I got. We used different methods but got the same result, by appearance at least.
I asked him about Lunchbox.
It is not a problem the pattern can changed instead of serie or another method by joining all lines to reduce points and calculation
February 19, 2020, 10:18am
I didn’t know this component (I don’t use Lunchbox), but a good idea, thank you for sharing it!
If your goal were to filter alternate lines, as suggested by
@seghierkhaled’s first post, you could do this:
Group_based_on_Z_2020Feb19a.gh (19.6 KB)
This avoids the issue of matching Z values to a list while allowing for an arbitrary tolerance.