Creating List Partitions from a set of Booleans

I’m working on a script, and I’ve hit a small hiccup. I’m working on a corner based isovist script and one step involved trimming lines with regions to get the first section until the line hits an object. Now since the script uses vertices to do this, some of the curves require the first two sections, since they only intersect with the region at a tangent point. I got this all working so far, but now I want to create closed regions based off these curves, and what seems like the best approach is to partition the list of curves based on which curves intersect at a tangent or not. I have that list of curves sorted properly and converted into a list of boolean values

So my question is I have a list of boolean values, how can I create a list of partition sizes, based off of the values?

For example, say I have a list that’s FTTFTFTFTTFTTT. I want to turn that into a list that reads 1,3,2,2,3,3. Basically, I want to add up the values and cut off the count at each False value (value included)

Maybe not what you were expecting. I’m sure someone else will come up with a less geometrical solution

boolean (11.0 KB)

boolean (12.5 KB)


here is a fast solution in Python :slight_smile: (6.8 KB)