# Autodesk.Revit.DB.Reference to Curve

**URL:** <https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075>\
**Category:** Revit\
**Tags:** python\
**Created:** [September 18, 2018, 1:45pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075 "2018-09-18T13:45:50Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![thurevit3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thurevit3/32/51807_2.png) [@thurevit3](https://forum.dynamobim.com/u/thurevit3)\
**Post date:** [September 18, 2018, 1:45pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/1 "2018-09-18T13:45:51Z")

</div>

Hello Dynamo people.

I want to create Room Boundary Lines at the location of the reference planes from a family.  
In the family I named the Reference Planes "Front"and “Back”.  
With Dynamo I can collect these Reference Planes from the family in the project.  
Last step is to convert these (Autodesk.Revit.DB.Reference) to Curves or Lines, but i downt know how.  
Can anyone help me?

Thanx in advance

 ![Knipsel](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/b/2bffa6e1a02053e9e59229e51fb92cddb7380a34.png)

```
import clr
clr.AddReference(&quot;ProtoGeometry&quot;)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(&quot;RevitNodes&quot;)
import Revit
from Revit.Elements import *
clr.AddReference(&quot;RevitAPI&quot;)
from Autodesk.Revit.DB import *
clr.AddReference(&quot;RevitServices&quot;)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])
par1 = IN[1]
par2 = IN[2]
refs = list()

for el in elements:
doorrefs = list()
refin = FamilyInstance.GetReferenceByName(el, par1)
refex = FamilyInstance.GetReferenceByName(el, par2)
doorrefs.append(refin)
doorrefs.append(refex)

refs.append(doorrefs)

OUT = refs
```

---

<div class="post-metadata">

**Author:** ![GregX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gregx/32/56837_2.png) [@GregX](https://forum.dynamobim.com/u/GregX)\
**Post date:** [September 21, 2018, 5:32pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/2 "2018-09-21T17:32:01Z")

</div>

[http://www.revitapidocs.com/2018.1/536b3d7a-ec8d-29f6-5957-751468c98dd0.htm](http://www.revitapidocs.com/2018.1/536b3d7a-ec8d-29f6-5957-751468c98dd0.htm)  
`test=Element.GetGeometryObjectFromReference(doc.GetElement(el.Id),refin)`

I was trying with something like this but then if i try to convert both the reference and my test variable to dynamo geometry with .ToProtoType() I got errors…

I remembered having a similar issue but it was the opposite, convertin revit faces to references and I remember the node “RevitFaceReference.FromDynamoSurface”, but I can’t really understand its contenct (can’t find it in the API?) to try and understand what we could do to in orde to do the opposite…

Googling I found this:

> **[DynamoDS/Dynamo](https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration#geometryobjects)**
>
> Open Source Graphical Programming for Design. Contribute to DynamoDS/Dynamo development by creating an account on GitHub.

  

> **[API Access to Family Instance References](https://thebuildingcoder.typepad.com/blog/2017/05/api-access-to-family-instance-references.html)**
>
> Here is another Revit 2018 API enhancement that is obviously worth highlighting, since it immediately answers the question on getting a specific reference from a family instance raised in the Revit API discussion forum: Is it possible to get a named...

  

> **[How to Retrieve Dimensioning References](https://thebuildingcoder.typepad.com/blog/2015/05/how-to-retrieve-dimensioning-references.html)**
>
> Several cases recently came up asking how to obtain references to programmatically create dimensioning elements. These hints expand on the recently discussed topic of creating dimensioning between family instance insertion points. They were raised by...

---

<div class="post-metadata">

**Author:** ![GregX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gregx/32/56837_2.png) [@GregX](https://forum.dynamobim.com/u/GregX)\
**Post date:** [September 21, 2018, 5:41pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/3 "2018-09-21T17:41:27Z")

</div>

I also found this:

> **[Picking Pairs and Dimensioning Family Instance Origin](https://thebuildingcoder.typepad.com/blog/2014/11/picking-pairs-and-dimensioning-family-instance-origin.html)**
>
> We looked at various aspects of creating dimensioning in the past. There is still one glaring omission, though: how to dimension to a family instance origin point. Let's take a look at that, after quickly mentioning the official announcement of the...

  
[http://www.revitapidocs.com/2018.1/b3c10008-aba6-9eee-99c9-7e05ace75796.htm](http://www.revitapidocs.com/2018.1/b3c10008-aba6-9eee-99c9-7e05ace75796.htm)  
Right know I can’t cointinue to try and find out but maybe it’s a start. The NewAlignment method allows you to lock a reference to another (maybe like the lock in Revit’s UI), so maybe you could place a room line and then lock it to your references… ugh

Maybe also this  
[https://forums.autodesk.com/t5/revit-api-forum/geometry-returns-no-reference-for-familyinstance/td-p/6015366](https://forums.autodesk.com/t5/revit-api-forum/geometry-returns-no-reference-for-familyinstance/td-p/6015366)

---

<div class="post-metadata">

**Author:** ![Rabindra\_Adhikari](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rabindra_adhikari/32/31788_2.png) [@Rabindra\_Adhikari](https://forum.dynamobim.com/u/Rabindra_Adhikari)\
**Post date:** [September 26, 2018, 4:08am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/4 "2018-09-26T04:08:14Z")

</div>

I am stuck in the same area. What do we do with Autodesk.Revit.DB.Reference as output from the Python. Could anyone please guide us what we should do next?

---

<div class="post-metadata">

**Author:** ![Rabindra\_Adhikari](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rabindra_adhikari/32/31788_2.png) [@Rabindra\_Adhikari](https://forum.dynamobim.com/u/Rabindra_Adhikari)\
**Post date:** [November 13, 2018, 7:52pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/5 "2018-11-13T19:52:08Z")

</div>

@Jeremy_Tammik @Zach_Kron Any thoughts?

---

<div class="post-metadata">

**Author:** ![Jeremy\_Tammik](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jeremy_tammik/32/27993_2.png) [@Jeremy\_Tammik](https://forum.dynamobim.com/u/Jeremy_Tammik)\
**Post date:** [November 13, 2018, 8:41pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/6 "2018-11-13T20:41:41Z")

</div>

Simple. Read the docs, my friend.

doc.GetElement(Reference)

[https://apidocs.co/apps/revit/2019/4d674a3e-cd18-6b3d-b1b2-247713fe3c9f.htm](https://apidocs.co/apps/revit/2019/4d674a3e-cd18-6b3d-b1b2-247713fe3c9f.htm)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 13, 2018, 9:02pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/7 "2018-11-13T21:02:22Z")

</div>

Hey,

Away from my PC right now, I have a workflow which might be useful…

> [@Roof Gutter/Soffit by python script](https://forum.dynamobim.com/t/roof-gutter-soffit-by-python-script/28320/15):
>
> Hey, Here’s a working version of your python… [RoofGutterIndex.dyn](https://forum.dynamobim.com/uploads/short-url/pqcgNCVk5U1rZcDh0avqdW46PI8.dyn) (6.1 KB) I am not sure your method is so helpful though, because I don’t know how to check that the Index is the edge you want… Incidently, because you don’t have the Else statement, the Python doesn’t tell you if the edge is unable to have a gutter (as Martin’s does) Here’s a workflow as I outlined above… [RoofGutter.dyn](https://forum.dynamobim.com/uploads/short-url/lCTiLAcQpZG3RiCxTqQA3qLhdTs.dyn) (18.0 KB) Because it is node based, we get the 3D preview in Dynamo and can review which edge is chosen.…

I can have more of a look tomorrow.

Cheers,

Mark

Edit: I’m thinking of the first Python in there, it converts references to curves and makes them usable in Dynamo with the ToProtoType()… there is also the ToRevitType() method as defined here…

> **[Python 0.6.3 to 0.7.x Migration](https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration)**
>
> Open Source Graphical Programming for Design. Contribute to DynamoDS/Dynamo development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Rabindra\_Adhikari](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rabindra_adhikari/32/31788_2.png) [@Rabindra\_Adhikari](https://forum.dynamobim.com/u/Rabindra_Adhikari)\
**Post date:** [November 27, 2018, 1:14am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/8 "2018-11-27T01:14:04Z")

</div>

Hello Jeremy! Thanks for the reference. I did try using the doc.GetElement(Reference) method. It simply retrieves the family instance, the parent object where the reference plane resides. I am attempting to gather the reference planes used in the family so I can use Dimension.Byelements without having to create temporary lines if that makes sense. Is it even possible to duplicate the Revit’s way of adding dimensions? By tabbing repeatedly I could get to the same references and use them for dimensions.

 ![DynamoGetElementIssue%26Dimensions](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/1/c18933800bc93199d460b8502e3b08247404c39b.png)

---

<div class="post-metadata">

**Author:** ![Jeremy\_Tammik](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jeremy_tammik/32/27993_2.png) [@Jeremy\_Tammik](https://forum.dynamobim.com/u/Jeremy_Tammik)\
**Post date:** [November 27, 2018, 10:23am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/9 "2018-11-27T10:23:36Z")

</div>

yes, retrieving the intenal planes and edges of the family instance sound like the right thing to do and corresponds to the ui tabbing.

---

<div class="post-metadata">

**Author:** ![thurevit3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thurevit3/32/51807_2.png) [@thurevit3](https://forum.dynamobim.com/u/thurevit3)\
**Post date:** [November 27, 2018, 2:07pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/10 "2018-11-27T14:07:29Z")

</div>

You could use these References to create dimensions.  
But i was looking for a way to get the geometry of these References to create a Room Boundary Line.  
Anyone know how?

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 27, 2018, 5:04pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/11 "2018-11-27T17:04:10Z")

</div>

Hey,

(Should probably start a new thread and reference this one)

Is that because you want the boundaries to move with the curves? As if they are locked?

I’m not sure that is possible… The reference is an attribute of the geometry, not the other way round.

You can convert the boundary lines to room boundary curves, but obvs they lose the association. You could probably tweak the graph to delete and recreate the curves to keep them aligned.

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/f/cf57cca17019ac6f1d22a6fd8f5c5028f8623f00.png)

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![aversiyava](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aversiyava/32/62031_2.png) [@aversiyava](https://forum.dynamobim.com/u/aversiyava)\
**Post date:** [March 12, 2019, 8:17am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/12 "2019-03-12T08:17:16Z")

</div>

Does anybody got something in relationship of this in this time? I have the same issue: I’m able to get the references from a family instance and I want to creat a room separator using them, but I’m not able to create a line or a plane from references…

---

<div class="post-metadata">

**Author:** ![aversiyava](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aversiyava/32/62031_2.png) [@aversiyava](https://forum.dynamobim.com/u/aversiyava)\
**Post date:** [March 12, 2019, 9:33am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/13 "2019-03-12T09:33:49Z")

</div>

OK, I think I get it:

[http://www.revitapidocs.com/2018.2/fbd33f0f-2c2c-c001-8041-996bc0872b2b.htm](http://www.revitapidocs.com/2018.2/fbd33f0f-2c2c-c001-8041-996bc0872b2b.htm)

I have used the method _**SketchPlane Create(Document, Reference)**_ for creating a plane, and then I can use that plane for creating my lines in the model. I hope it helps.

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 12, 2019, 11:16am UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/14 "2019-03-12T11:16:53Z")

</div>

You can also use the `FamilyInstance Reference` node in _Genius Loci_ package that already includes this feature.

 ![References%20from%20a%20family%20instance%20to%20room%20separator](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/e/2e4547eb571e5381a379b556ca7d78c3d36c3803.png)

---

<div class="post-metadata">

**Author:** ![Rabindra\_Adhikari](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rabindra_adhikari/32/31788_2.png) [@Rabindra\_Adhikari](https://forum.dynamobim.com/u/Rabindra_Adhikari)\
**Post date:** [September 11, 2019, 4:54pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/15 "2019-09-11T16:54:07Z")

</div>

Well digging into further details I found the issue in how I was handling “refList” as python List. changing the line “refList = list()” to “refList = ReferenceArray()” solves this problem. It apparently is the value type mismatch.

---

<div class="post-metadata">

**Author:** ![thurevit3](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thurevit3/32/51807_2.png) [@thurevit3](https://forum.dynamobim.com/u/thurevit3)\
**Post date:** [September 13, 2019, 1:26pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/16 "2019-09-13T13:26:54Z")

</div>

With this information, can u make a python script which create Room Boundary Lines from family reference planes what mentioned above?

---

<div class="post-metadata">

**Author:** ![rab\_i](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rab_i/32/95802_2.png) [@rab\_i](https://forum.dynamobim.com/u/rab_i)\
**Post date:** [June 2, 2020, 4:31pm UTC](https://forum.dynamobim.com/t/autodesk-revit-db-reference-to-curve/26075/17 "2020-06-02T16:31:36Z")

</div>

I was able to do something like this. Look into your original post and replace

> refs = list()

to something like

> refs = ReferenceArray()

Here below is a node I made for my project and I was able to get the actual references. Give it a try.

> import clr  
> clr.AddReference(“ProtoGeometry”)  
> from Autodesk.DesignScript.Geometry import \*
> 
> clr.AddReference(“RevitNodes”)  
> import Revit
> 
> from Revit.Elements import \*
> 
> clr.AddReference(“RevitAPI”)  
> from Autodesk.Revit.DB import \*
> 
> clr.AddReference(“RevitServices”)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> dataEnteringNode = IN
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> 
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> #Input  
> elements=UnwrapElement(IN[0])  
> line = UnwrapElement(IN[1]).GeometryCurve  
> refList = ReferenceArray()
> 
> #Get Reference Planes from Families  
> for i in elements:  
> ref = FamilyInstance.GetReferenceByName(i,“Center (Left/Right)”)  
> #optionsView = Options.View(doc.ActiveView)  
> #refType = FamilyInstanceReferenceType.CenterLeftRight  
> #refName = FamilyInstance.GetReferences(i,refType)  
> #refElem = doc.GetElement(ref)  
> #refID = ref.ElementId  
> refList.Append(ref)  
> #refTypeA = Reference.ConvertToStableRepresentation(ref,doc)  
> #refTypeB = Reference.ParseFromStableRepresentation(doc, refTypeA)  
> #refList.append((refTypeB))
> 
> #Create Dimensions  
> dimension = doc.Create.NewDimension(doc.ActiveView, line, refList)
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> OUT = dimension
