# Reference a geometry of generic model

**URL:** <https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059>\
**Category:** Revit\
**Tags:** revit, python, geometry\
**Created:** [September 25, 2019, 10:59am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059 "2019-09-25T10:59:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fluffyhugger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/fluffyhugger/32/54396_2.png) [@fluffyhugger](https://forum.dynamobim.com/u/fluffyhugger)\
**Post date:** [September 25, 2019, 10:59am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/1 "2019-09-25T10:59:20Z")

</div>

So I wan’t to get a geometrical reference of a generic model. I’m able to get solids but how to get a reference to its faces? I’m inspired by this post of @MartinSpence [Multiple Spot Coordinates](https://forum.dynamobim.com/t/multiple-spot-coordinates/40410/10)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/e/7e9bfea6d51a40c52d87e98ce117ad2278f10a15.png)

```
import clr

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument

opts = Options()
opts.ComputeReferences = True

floorSolid = UnwrapElement(IN[0]).get_Geometry(opts)

df = []

for i in floorSolid:
	df.append(i.GetInstanceGeometry())

OUT = df[0]
```

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [September 25, 2019, 11:28am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/2 "2019-09-25T11:28:01Z")

</div>

Like so:

```
import clr

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#clr.AddReference('RevitNodes')
#import Revit
#clr.ImportExtensions(Revit.Elements)
#clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument

opts = Options()
opts.ComputeReferences = True

gElem = UnwrapElement(IN[0]).get_Geometry(opts)

df = []

for gObj in gElem:
	if isinstance(gObj,GeometryInstance):
		for iObj in gObj.SymbolGeometry:
			if isinstance(iObj, Solid):
				for f in iObj.Faces:
					df.append(f.Reference)		

OUT = df
```

---

<div class="post-metadata">

**Author:** ![fluffyhugger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/fluffyhugger/32/54396_2.png) [@fluffyhugger](https://forum.dynamobim.com/u/fluffyhugger)\
**Post date:** [September 25, 2019, 11:33am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/3 "2019-09-25T11:33:24Z")

</div>

Thank you Sir! This is the part I’ve missed `SymbolGeometry` . Or rather didn’t knew about… How did you learned about this? Because I’ve called with `dir()` all attributes and that thing is not there…

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [September 25, 2019, 11:37am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/4 "2019-09-25T11:37:21Z")

</div>

You are welcome!  
I highly recommend RevitApiDocs:

[https://www.revitapidocs.com/2015/7a3b5ac1-c66d-9f81-a11d-9bcd4e026295.htm](https://www.revitapidocs.com/2015/7a3b5ac1-c66d-9f81-a11d-9bcd4e026295.htm)

---

<div class="post-metadata">

**Author:** ![fluffyhugger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/fluffyhugger/32/54396_2.png) [@fluffyhugger](https://forum.dynamobim.com/u/fluffyhugger)\
**Post date:** [September 25, 2019, 11:41am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/5 "2019-09-25T11:41:28Z")

</div>

Thanks! I’ve knew about the docs, but there’s less to non explanation about what goes where… And for a newbie with python it’s very problematic because there’s nobody to explain… 🙄

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [September 25, 2019, 11:45am UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/6 "2019-09-25T11:45:04Z")

</div>

Well, sometimes it is a bit of a trial and error. For me it would also be more logical to use GetInstanceGeometry rather than SymbolGeometry - but it did not work…

There is not much info about Python in RevitAPI context…usually you have to translate C# solutions (from eg. The Building Coder or official API forums).

It gets bit easier with time 😉

---

<div class="post-metadata">

**Author:** ![danail.momchilov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/danail.momchilov/32/152056_2.png) [@danail.momchilov](https://forum.dynamobim.com/u/danail.momchilov)\
**Post date:** [February 10, 2023, 12:05pm UTC](https://forum.dynamobim.com/t/reference-a-geometry-of-generic-model/41059/7 "2023-02-10T12:05:45Z")

</div>

Thanks for this hint! Such a small detail makes such a great difference 🙂
