So i’m trying to find a way to determine if a solid has a hole inside of it
For example, in this picture we can see that the solid has a hole inside of it.
How do i get that in dynamo?
Thank you!
So i’m trying to find a way to determine if a solid has a hole inside of it
For example, in this picture we can see that the solid has a hole inside of it.
How do i get that in dynamo?
Thank you!
You could examine the perimeter curves of each face. Group the curves into curve loops. Faces with more than one curve loop have an opening/recess.
This is a fast, not very elegant, valid for one object at a time, script. The idea is the same suggested by @Andreas_Dieckmann, you can use Loops property to get the boundaries of your faces. If you get more loops that faces, than you have a hole.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
element = UnwrapElement(IN[0])
faces = []
loops = []
for elements in element:
faces.append(elements)
a = elements.Loops
loops.append(a)
r = List.Flatten(faces,1)
c = len(r)
t = List.Flatten(loops,1)
d = len(t)
if c == d:
out = "no holes"
else:
out = "it has holes"
OUT = out
It’s a just a draft, it has to be improved a lot, for example allowing multiple input, but one has to start from something
What is a curve loop? how do i implement that?
Unfortunately i can’t improve this code… i don’t know anything about the revit API
Loops are the boundaries of the solid faces. If a face has one hole, it has two boundaries: one outside (the face) and one inside (the hole).
Maybe someone can help, or I will try in the next days
This should work:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
element = IN[0]
result = []
for walls in element:
loops = []
faces = []
for face in walls:
loop = face.Loops
loops.append(loop)
faces.append(face)
c = len(List.Flatten(faces,1))
d = len(List.Flatten(loops,1))
if c == d:
result.append(False)
else:
result.append(True)
OUT = result
It did exactly what is ment to do. However it didnt work. For instance,
The highlighted door has a hole in it, but the code said it didn’t. I think that the semanthics of the code is not the proper one for this application.
Anyway, i’m really thankfull for all your help
It depens on what you consider as a hole. I attach a picture to better explain:
In my opinion a hole is only case #2. I consider #3 and #4 to have a non-rectangular outline, but I would not say they have a hole.
I understand what you mean, but in order to get a script, we need first a definition. A script based on how many faces has a solid doesn’t work, because you can have irregular walls.
Maybe a different approach would be to find out if a wall is hosting a door/window/etc…? But that would work for Revit walls, not for generic solids.
If we’re talking Revit elements you could actually just compare the original geometry with the actual geometry of the element:
All these solutions are great work but we won’t know which is best because we were never told why it was needed…
@ramoon.bandeira would you be able to explain a bit more? It may be that the best solution is something completely different
Apologies for butting in,
Mark
I need to get all the walls in revit that has a hole of walls or windows inside of it. it is necessary for the budgeting workflow we use here in our city.
I managed to get both the walls that serve as hosts for walls and windows, and the joined walls for that.
I filtered the walls that were joined to it and was not paralell to the original wall. it is going well so far… but this last step i cant overcome…
i’ll check it out
!
It worked. THANK YOU!!!
I was playing a little mindgame just now
A wall that has had a door, but was later filled in by a wall (same type)
Is there a hidden bar behind it? I’ll have a Scotch and toast you guys Zach Kron knows the handshake!
Filter by demolition phase perhaps?