Numbering Doors Along PolyCurve


#1

In reference to my door numbering script here, I’m looking for a way to pull the clockwise locations of doors along the room’s perimeter polycurve instead of just radial from the center location of the room itself.

My other script should work for most instances, but the issue is when there are odd shaped rooms like this where radial numbering breaks:

I currently have the vector from room center to the room’s entry door (or 12 o’clock from center) to begin door numbering. I also have the polycurve of the room, so I need to correlate the start point of the entry door to the sequence of points around the room, which is where I’m stuck.

Logic:

  • Count n doors in each room
  • Divide polycurve by n
  • Sort those n points to go clockwise along polycurve - are these always in order by default?
  • Somehow correlate the start of my list with the entry door
  • Get keys of those points and sort my doors by those keys

I found this post about finding if points fall within a bounding box of the door, but I think I’d only need to find the point that falls within my Entry door and sort from there. I also looked at BVN’s Renumbering Rooms Graph, but it seems like overkill.


Point list in sequence
#2

The BVN node does exactly what you need it to do. Take a look at the code before dismissing it. You need to get the location of the the doors > geometry.closestPointTo the room polycurve, and then use Curve.ParameterAtPoint. This will give you ‘t’ parameters along the curve which you can sort in a clockwise direction.


#3

Hi. A possible workflow.

  1. For the wall perimeter curve, extract the unique points.
  2. Sort the points for the polycurve based around a centroid for the room to determine a direction only, clockwise or anti clockwise.
  3. Find the point closest to the location of the entry door and sort the points to create a polycurve that starts from this point.
  4. Then find the points closest to the locations on that curve.
  5. Sort these points by the parameter location on curve to order them before applying parameter values.

Sorry, I don’t have access to Dynamo till tomorrow to put a script together to show you.


#4

Wonder if a method similar to the select by spline technique would work here… I’ll look into it as well.