Revit.DB.Line to Reference not working

Hi there,

I am unable to simply get a Revit Lines’ Reference as I believe I should.

Here I have my Revit Lines

Yet when I try and call their Reference Property I am given nothing but nulls.


Any ideas why?


import clr
import sys

import System
from Autodesk.DesignScript.Geometry import *

import Revit

# Get the input curves from Dynamo
DSpolycurve = IN[0]

RevitLines = [x.ToRevitType() for x in DSpolycurve.Curves()]
Refs = [revit_curve.Reference for revit_curve in RevitLines]

OUT = Refs

@c.poupin I would love your wisdom on this one!

Hi @haganjake2 ,
Maybe I am wrong but: you created the input as DesignScript instances, so they have no references.

1 Like

You can create a dummy detail or model curve and use its reference.
Where are these Lines in Dynamo coming from?

Thanks both for your responses.

The curves are coming from a linked floor element. I am getting the perimeter curves for the floor using Element.Location.

I’d rather not draw dummy curves in my revit model if possible!

Try to get floor edges in python node. If you collect edges correctly, they have the property of Reference.

1 Like

you have to work and stay with the Revit geometries, then you will probably have to convert references from your linked model to your host model

Thanks @Deniz_Maral & @c.poupin - Ah ok it makes sense now.

I think I lacked the fundamental understanding of what a Reference was!

I need to filter the lines to make sure I’m getting just the perimeter curves so will have to do some python filtering but I think it should be possible.

Thanks for the guidance.

If either of you fancy a further challenge I’d love some help with this post also: