Hi everyone,
A bit of a noob question, but I realy have to figure this one out:
When I get the geometry of an element, I have to use the “get_Geometry(options)” syntax. (The same goes for bounding boxes). Why is that? What is the rule of thumb for applying the “get_” command and what does the “options” parameter mean?
Also, why the geometry solids are being output as a single object list?
hi @ilia.s, below is a sample usage of get_Geometry method. It is collecting Solid geometry and extracting Faces data from Room elements.
# dynamo version - 1.3.4
import clr
clr.AddReference("RevitAPI");
clr.AddReference("RevitNodes")
import Autodesk, Revit;
clr.ImportExtensions(Revit.Elements);
clr.ImportExtensions(Revit.GeometryConversion);
from Autodesk.Revit.DB import *
rooms = UnwrapElement(IN[0]);
result =[];
for room in rooms:
# geo of room
geo = room.get_Geometry(Options())
# get enum
enum = geo.GetEnumerator()
# skip one
next = enum.MoveNext()
# current geo
solid = enum.Current
# get faces
faces = solid.Faces
count = 0;
sub = []
# each face
for face in faces:
count +=1;
# omit first two (top,btn)
if count>2:
# face to dyn obj
sub.append(face.ToProtoType()[0])
# curves
#sub.append(face.GetEdgesAsCurveLoops()[0])
result.append(sub)
OUT = result
hi, @ilia.s, get_Geometry return value is a (kind of)list but it is unsubscriptable which means you can’t use indexing syntax like geo[0] to access list’s items.
But you can use loop or list concatenation or GetEnumerator to access this return value. So, here i used Enumerator and access the list’s item Solid object.