algorithmic modeling for Rhino
Hi All,
Big fan of grasshopper and these forums and I've always come here for help, this just happens to be the first time I couldn't find the answer to my question in a previous post.
I have a single discontinuous list of index numbers and I'd like to be able to generate a set of domains where each span of numbers would have its own domain. For example:
This list: 5,6,7,8,9,22,23,24,25,26,77,78,79,80,81...
Would give these domains: 5 to 9, 22 to 26, 77 to 81...
I'm at a loss as to how I can achieve this though. I know I can use the bounds function on the list but that would give a single domain, not several. In case it helps the list in question was generated by a true/false cull pattern from the complete list of indices so simply determining the indices of the beginning and end of each chunk of 'trues' in the cull pattern would work as well as it would give the same domains. I can post an example file if anyone would like but I figure this is a pretty general issue.
So anybody have any ideas on how to solve this multiple domains from a single list problem? Thanks in advance for any help at all, I'd really appreciate it!
James
Tags:
It's a bit of a long hike, but this is a solution:
The idea is:
This will delete any lone values, is that what you want?
--
David Rutten
david@mcneel.com
Wow, this is great. I can honestly say I never would have thought of using lines here. It's exactly what I needed, thank you. It does miss out on any single number domains (if that even counts as a domain) in the initial list but that's not an issue at all for what I need this for.
Once again, thanks!
The ancient Greeks treated all numbers as sticks with varying lengths. To them, all of algebra was geometry.
--
David Rutten
david@mcneel.com
That what I tried first too, but that solution only works if you know the lengths of each subdomain to feed into the S variable. Since that's not the case here Partition list doesn't seem to be the solution.
Ah! Now I see what info I missed and why my reply isn't contributing~ sorry about that.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by