Hi,
I`m trying to determine if an object is a solid or not. When I use the .Type node it returns Geometry as type of object as result of Geometry.Intersect action. That could also be a line. A workaround is to try to get the volume of an object. If that works it must be a solid… Is there an easier way to determine the type of object?
if Geometry.DoesIntersect(Vloervolume_Onder_Wand,Dyn_Wallvolume):
try: Geometry.Intersect(Vloervolume_Onder_Wand,Dyn_Wallvolume)[0].Volume
except: pass
Can you show us what you’re working with? Usually the geometry tells you what kind of geometry it is (solid, surface, line, point, etc.)
I copied part of the code below. It creates a solid wallvolume and clashes it with a solid floor volume by geometry.Intersect. There are 3 possible outcomes:
-
1 is no outcome, it doesnt clash.
-
2 it clashes with the floor (which volume is a bit higher than the revit geometry) and produces a solid
-
3 it clashes with the floor and produces a line of surface because the wall (for example insulation) only touches the floor on the side.
Based on the outcome the height of the wall is determined like in the below printscreen. It works but the calculation is heavy because of the try/except and the volume calculation which only serves the role of trying to determine if the result is a solid or not. There must be an easier way 
def Wand_Plaatsen_In_Model(self):
#TEMP.append([self.Family_Id, self.Level_Id])
Dyn_Wallsurface = Autodesk.DesignScript.Geometry.Curve.Extrude(self.Lijn_Dyn[0],Vector.ZAxis(),self.Hoogte*304.8)
Dyn_Wallvolume = Geometry.Translate(Dyn_Wallsurface.Thicken(self.Dikte_String,True),Vector.ZAxis(),-300)#float(Hoogte)*304,8))#Wand_Volume_Dyn = Geometry.Translate(Lijn_Dyn,Vector.ZAxis
Vloervolume_Onder_Wand = Dict_Levels.get(self.Level[0]).Dyn_Volumes_Vloer[0]
if Geometry.DoesIntersect(Vloervolume_Onder_Wand,Dyn_Wallvolume):
try:
Geometry.Intersect(Vloervolume_Onder_Wand,Dyn_Wallvolume)[0].Volume
except: self.Hoogte = Dict_Levels.get(self.Level[0]).Hoogte_Gevelspouwblad
else:
self.Hoogte = Dict_Levels.get(self.Level[0]).Hoogte_Gevelspouwblad
I’d say that’s reasonable. You’re going to have to get the actually intersection element to know if it’s a solid anyway.
But isnt there a node that says if an object is a solid or not?
| Nick_Boyts
June 24 |
I’d say that’s reasonable. You’re going to have to get the actually intersection element to know if it’s a solid anyway.
Have you checked this part of the API?
https://www.revitapidocs.com/2022/7a3b5ac1-c66d-9f81-a11d-9bcd4e026295.htm
I think this is the condition for a custom node you’re looking for:
if (null == solid || 0 == solid.Faces.Size || 0 == solid.Edges.Size)
Thats interesting. But I think this only applies to revit geometry not dynamo geometry.
But maybe Ill try just to create a string from the Geometry.Intersect result and see if the word solid is in there… I
ll post the result
Solved!
Its just as simple as reading out the result of the Geometry.Intersect action and then determin if the word Solid is in there. So no need for try except and volume calculations… 
if Geometry.DoesIntersect(Vloervolume_Onder_Wand,Dyn_Wallvolume):
if "Solid" in str(Geometry.Intersect(Vloervolume_Onder_Wand,Dyn_Wallvolume)[0]): pass
else: self.Hoogte = Dict_Levels.get(self.Level[0]).Hoogte_Gevelspouwblad
else:
self.Hoogte = Dict_Levels.get(self.Level[0]).Hoogte_Gevelspouwblad
1 Like
Good one!
My bad I referred only to your first post thinking it was geometry extracted from a Revit element.