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)
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…
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
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…
I’ll be back on monday with a clear example! Thanks a lot for your help!
EDIT:
Hello again
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
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)
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!
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!
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:
If we extend each line and check the intersects like this:
Example:
Yellow - area of the polygon
Red - Extended line
.
.
.
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:
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.
There is probably a better way, but I don’t know it yet
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.