# Obtaining References from Edges in Python

**URL:** <https://forum.dynamobim.com/t/obtaining-references-from-edges-in-python/14543>\
**Category:** Uncategorized\
**Tags:** python\
**Created:** [September 4, 2017, 9:36pm UTC](https://forum.dynamobim.com/t/obtaining-references-from-edges-in-python/14543 "2017-09-04T21:36:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin.Bell](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kevin.bell/32/22476_2.png) [@Kevin.Bell](https://forum.dynamobim.com/u/Kevin.Bell)\
**Post date:** [September 4, 2017, 9:36pm UTC](https://forum.dynamobim.com/t/obtaining-references-from-edges-in-python/14543/1 "2017-09-04T21:36:30Z")

</div>

Hi All,

Continuing on with my ongoing quest to have a routine which automatically dimensions a square 3D face, I’ve written some code which allows the user to select a face, it then obtains the PlanarFace and its face Edges.

This works fine. It should be a case of obtaining the References to the edges which I’ll then use to create a dimension.

Luckily the Edge Class contains a Property called ‘Reference’ which returns a stable reference to the edge - perfect!

The problem is that when I call this, it returns Null, and I can’t work out why I don’t get a Reference.

Here’s the code:

```
 # Dynamo
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
selobject = UnwrapElement(IN[0])	# Object to select

#Get user to pick a face
selob = uidoc.Selection.PickObject(Selection.ObjectType.PointOnElement, "Pick something now")

#Get Id of element thats picked
selobid = selob.ElementId

#Get element thats picked
getob = doc.GetElement(selobid)

#Get face thats picked
getface = getob.GetGeometryObjectFromReference(selob)

#Get edges of face (returns a list the first object is the list of edges)
edgeloops = getface.EdgeLoops

#Select the first edge
dimedge1 = edgeloops[0][0]

#Select the third edge (the one opposite the first)
dimedge2 = edgeloops[0][2]

#Obtain a reference of the first edge
edgeref1 = dimedge1.Reference

#Obtain a reference of the thord edge
edgeref2 = dimedge2.Reference

#Assign your output to the OUT variable.
OUT = [selob, selobid, getob, getface, edgeloops, dimedge1, dimedge2, edgeref1, edgeref2]

```

I’d appreciate some advise on why I can’t obtain a Reference?

Thanks.
