# Return Edge element from Python script

**URL:** <https://forum.dynamobim.com/t/return-edge-element-from-python-script/65243>\
**Category:** Revit\
**Created:** [June 17, 2021, 1:51pm UTC](https://forum.dynamobim.com/t/return-edge-element-from-python-script/65243 "2021-06-17T13:51:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [June 17, 2021, 1:51pm UTC](https://forum.dynamobim.com/t/return-edge-element-from-python-script/65243/1 "2021-06-17T13:51:09Z")

</div>

Hi,  
according to this post: [Get the element of the selected edge](https://forum.dynamobim.com/t/get-the-element-of-the-selected-edge/23489)

I try to return the edge element I can keep working with on Dynamo.  
I want the edge in order to use “Edge.AdjacentFaces” node.

if I use “edge.ToDSType()” I get an error the Edge element has no attribute “ToDSType”/  
if I return “edge” I got a “Revit.DB” element I can’t keep using on Dyanmo.

![2021-06-17 16_27_35-Window](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/3/e3724308a51f7533f6f9966a6ecb1988dec147ed.png)

```auto
import clr

clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

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

sel1 = uidoc.Selection
ot1 = Selection.ObjectType.Edge
refs = sel1.PickObjects(ot1, "Select the desired edges and press Finish")
edges = []
for i in xrange(len(refs)):
	el1 = doc.GetElement(refs[i].ElementId)
	edge = el1.GetGeometryObjectFromReference(refs[i])
	edges.append(edge.GetFace(0).ToProtoType())
	edges.append(edge.GetFace(1).ToProtoType())

	
OUT = edges,el1,edge.AsCurve().GetEndPoint(0).ToPoint(),edge

```

I solve the issue by returning the faces from the script but I still want to expand my knowledge about return edge element.
