Dynamo for Revit – Window numbering counter-clockwise from a user-picked start point on facade

Post text

Hello,

I’m working in Dynamo for Revit and I want to automatically number windows per floor, counter-clockwise around the building, starting from a user-defined start point.

What I want to achieve:

  • User picks a start point on a facade using “Select Point on Face”

  • That point defines Window 01

  • All windows on the same level are then:

    • sorted counter-clockwise

    • numbered sequentially (01, 02, 03, …)

  • Numbering restarts per level

  • The result is written to a shared instance parameter on Windows

Current approach:

  • Categories → Windows

  • All Elements of Category

  • Element.Location

  • Point.Subtract (window point – picked start point)

  • Python node using atan2(Y, X) to calculate angles

  • List.SortByKey for CCW sorting

  • Sequence → Number.ToString → String.PadLeft

  • Element.SetParameterByName

Questions:

  1. Is this the recommended approach for CCW sorting from a picked point in Dynamo?

  2. Is there a cleaner / more robust way to handle per-level grouping?

  3. Any pitfalls with Select Point on Face I should be aware of?

Thanks in advance!

Have you thought of creating a Room outside the Building and see what Windows the room has

A few things here.

  1. I wouldn’t use Python just to call atan; you are taking a performance hit this way.
  2. I am not sure your results will match your goal for many common building shapes. An L shape where the user wants to start on the end of the leg as one example; a U shape where they want to start almost anywhere, etc.. as the vectors won’t work o it cleanly. Boxes should be fine, but as soon as there is any obtuse angle in the perimeter you’re in for some issues.

My personal preference would be to get the exterior envelope at each level (I like a room at the exterior of the building for this, but there are a few ways to attain that info), build a PolyCurve from each curve loop, break the PolyCurve at the closest point to the picked point, sort the windows by their location point’s parameter on that line.

1 Like