Get corner points of rooms

Dear all,

I’m trying to get the corner points of rooms with dynamo for hours. In some cases, the script is working but in many cases, the result ist wrong. (see picture attached)

Anybody out there with an idea?

Thanks in advance,
Martin

EDIT:
Seems as the node only works within a given / pre definied area (marked circle):

I think you need to show more of your graph
Better is to upload it so we can check.

Here you are :slight_smile: UPLOAD.dyn (27.5 KB)

I think you can find a solution here:

2 Likes

Unfortunately not, because I need a list of the corner points in clockwise order. Also any intersections with another room-walls are falsely detected as a corner. I’ve tried this already. In addition, it should start in the upper left corner…

Ok, I see.Then probably this one should work:

  • Get room points
  • Find the top-right one
  • Reorder list according to it

edit: I just read you need the top-left, in this case you have to reorder the list to find the maximum PointX, and if you have multiple points with same PointX, find the one with maximum PointY. It’s a bit longer but feasible

2 Likes

The same story: Walls of adjoining rooms are also recognized as start-points… But smart solution using the shift-node. I’ve never used it before!

Can you please be more specific? Show a simplified clear example, with few elements, otherwise nobody will understand. What are those arcs? Separation lines?

The graph I showed you works fine for me, no conflict with other walls etc…

1 Like

I’ll be back on monday with a clear example! Thanks a lot for your help!

EDIT:
Hello again :slight_smile:

I want to count / mark the corners of all selected rooms. In this example I want to mark the corners of Room 3 (should be a total of six, as the blue markers show). Unfortunately, the code returns seven corner points, which results of the intersection (red mark).

Upload 1: Image with the error
Upload 2: Dynamo Script
Upload 3: Revit file

2: UPLOAD_v3.dyn (31.9 KB)
3: Example.rvt (1.8 MB)

Sorry for the late reply, I saw your post only few days ago and I was a bit busy. Now I understand it a bit better.

My strategy at the moment is:

  • Find the tangent vector at every point
  • Compare the vectors: if the vector is equal to the previous one, you get a true, if there is a change of direction, so the vectors are not equals, you get a false.
  • Use this mask to remove unwanted points (those not at the corner)

Hope this help, sadly I have no time to work more in depth.

RoomTopRightCornerPoints.dyn (38.7 KB)

4 Likes

Works like a charme - thank you!

Are you able to separate or count somehow the number of outward and inward corner’s?
So this would be 1 outward cornerand 13 inward corners:

Never mind, i figured it out with some basic math.
I hope this helps someone too :slight_smile:

1 Like

I’m new to Dynamo, please tell me!

What do “4” and “2” mean when they are count nodes?

We can look at rooms as basic right-angled shapes (angles are ≈ 90°).

If you look at this room layout above, count the angles and separate them as inward and outward, you will see a pattern:

Angle counter 2000
Inward Corner Outward Corner + enclosed walls (in my case allways 4) Total Number of Corners
4 0 4
5 1 6
6 2 8
7 3 10
8 4 12
9 5 14
10 6 16
11 7 18
12 8 20
13 9 22
14 10 24
. . .
. . .
. . .

Room 0 has 4 inward corners and 0 outward,
Room 1 has 5 inward corners and 1 outward… and so on…

Hence the formula:
Inward-4 = Outward

As an input for the formula I’m getting the total number of corners (ToT). As we know the total is Inward + Outward.
With some basic math we get that:
Inward = (ToT+4)/2

I have attached a test project, and the purged script
1234.rvt (1.7 MB) (Revit 2022)
1234.dyn (123.8 KB) (Dynamo for Revit 2022)

you will need to have these packages installed:

Synthesize
WombatDynamo
archilab
Orchid

Good luck, and I hope this helps!

PS:
if you have irregular shapes you wont get whole numbers as values!

3 Likes

I understand !
Thank you for the very kind explanation. :blush:

I am very grateful for this script.
Is it possible to count the number of inside and outside corners as well as identify where they are? I can’t think of a way. Any help would be appreciated.

Yes, you can! :slight_smile:
The fun part is figuring out the math!
I was too lazy to go all the way for that, but,
The best way that I could think of is by comparing the position of extended boundary lines with the area of the initial shape.

Initial Shape:
image

If we extend each line and check the intersects like this:
Example:
Yellow - area of the polygon
Red - Extended line

image
image
.
.
.
we can see that the red line is touching the area, but not intersecting.
Here, we will find our Inward corners.

In these examples, the red line is intersecting the yellow area:
image
image
Here we will find our Outward corners.

Now I would probably intersect the points (green) that I already have from the Dynamo script posted and lines (red) to get the coordinates for new points. Also, filter out duplicates.
And after some list shuffling, merging and filtering, you should get the result you search for.
image

There is probably a better way, but I don’t know it yet :slight_smile:

1 Like

Get the room boundaries, turn them into vectors, compare angle to the previous boundary in the list. >180 internal corner, <180 external corner.

1 Like

i would like to thank you about this solution, i was searching for the same problem and found your solution, much appreciation to your effort and mindset.