# API usage of "get\_Geometry" command to retrieve element geometry

**URL:** <https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261>\
**Category:** Developers\
**Tags:** python\
**Created:** [November 17, 2019, 12:23pm UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261 "2019-11-17T12:23:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilia.s](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@ilia.s](https://forum.dynamobim.com/u/ilia.s)\
**Post date:** [November 17, 2019, 12:23pm UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/1 "2019-11-17T12:23:47Z")

</div>

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?

 ![get_geo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a31d520a5e43f5846e8203dfc20886781b69bfee.jpeg)

Thanks!

---

<div class="post-metadata">

**Author:** ![Przemyslaw\_Krauze](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/przemyslaw_krauze/32/108014_2.png) [@Przemyslaw\_Krauze](https://forum.dynamobim.com/u/Przemyslaw_Krauze)\
**Post date:** [November 17, 2019, 3:35pm UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/2 "2019-11-17T15:35:05Z")

</div>

You can read about Geometry Options [here](https://thebuildingcoder.typepad.com/blog/2010/01/geometry-options.html).  
But in one sentence: “the options class customizes the type of output you receive”.

---

<div class="post-metadata">

**Author:** ![ilia.s](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@ilia.s](https://forum.dynamobim.com/u/ilia.s)\
**Post date:** [November 18, 2019, 6:46am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/3 "2019-11-18T06:46:02Z")

</div>

Thanks!  
Any idea about the other issues with retrieving geometry?

---

<div class="post-metadata">

**Author:** ![jean](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jean/32/188752_2.png) [@jean](https://forum.dynamobim.com/u/jean)\
**Post date:** [November 19, 2019, 4:00am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/4 "2019-11-19T04:00:58Z")

</div>

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

```

> ![room-surfaces](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/6/f6a2a8885f6e5c94be55a23bd2c8092f9852a27b.png)

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [November 19, 2019, 4:53am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/5 "2019-11-19T04:53:53Z")

</div>

Similarly, you can use the Geometry property like this:

`geo = room.Geometry[Options()]`

I’m not sure why you can use both the method and the property…

---

<div class="post-metadata">

**Author:** ![ilia.s](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@ilia.s](https://forum.dynamobim.com/u/ilia.s)\
**Post date:** [November 19, 2019, 6:45am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/6 "2019-11-19T06:45:36Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![ilia.s](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@ilia.s](https://forum.dynamobim.com/u/ilia.s)\
**Post date:** [November 19, 2019, 6:48am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/7 "2019-11-19T06:48:08Z")

</div>

Thank you!  
Could you please elaborate on the usage of enums? What exactly do hey extract?

---

<div class="post-metadata">

**Author:** ![jean](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jean/32/188752_2.png) [@jean](https://forum.dynamobim.com/u/jean)\
**Post date:** [November 19, 2019, 7:44am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/8 "2019-11-19T07:44:47Z")

</div>

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.

More info about Enumerator: [https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable.getenumerator?view=netframework-4.8](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable.getenumerator?view=netframework-4.8)

---

<div class="post-metadata">

**Author:** ![ilia.s](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@ilia.s](https://forum.dynamobim.com/u/ilia.s)\
**Post date:** [November 19, 2019, 8:11am UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/9 "2019-11-19T08:11:13Z")

</div>

Awesome! Thanks.

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [March 25, 2023, 4:43pm UTC](https://forum.dynamobim.com/t/api-usage-of-get-geometry-command-to-retrieve-element-geometry/43261/10 "2023-03-25T16:43:39Z")

</div>

Hello,  
I tried your code, I’m learning, the Element.Solids node returns the same solid but in dynamo entity

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/38cd6b74e94de4973ea5a4e92858d94c3bb881c6.png)

If you have a generic list composed of several solids as in the example, is the solution adopted here “good”?

```auto
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

Col=UnwrapElement(IN[0])
#geo of family
geo=Col.get_Geometry(Options())
#get enum
enum=geo.GetEnumerator()
#skip two
next0=enum.MoveNext()
next1=enum.MoveNext()

geo_sol1=enum.Current

#skip one
next2=enum.MoveNext()

geo_sol2=enum.Current

vol_1=geo_sol1.Volume*0.3048**3
vol_2=geo_sol2.Volume*0.3048**3

geo_dynamo=geo_sol1.ToProtoType()
OUT = Col,geo,type(geo),type(enum),geo_sol1,geo_sol2,vol_1,vol_2,geo_dynamo

```

thanks  
Cordially  
christian.stan
