# Read Lines from Revit and Split by Points

**URL:** <https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129>\
**Category:** Revit\
**Created:** [September 19, 2018, 1:13pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129 "2018-09-19T13:13:36Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 1:13pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/1 "2018-09-19T13:13:36Z")

</div>

Hey there,

i just want to readlines from Revit, offset them and then segment them by length (see picture)  
I can build it with the dynamo nodes, but i can’t proceed for each element line with the dynamo nodes, because i just can select one index of the list to procedd(offset,splittbypoints usw.)

 ![Problem](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/5/a5b4be13d0334778dbabe47911644235ca986ae7.jpeg)

So i want to rebuild this Nodes in python, so i can usw a “for”-loop for each element of the List with the Revit ModelCurves… =/

Can you please help me?

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [September 19, 2018, 1:52pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/2 "2018-09-19T13:52:59Z")

</div>

Hi, I’m not sure to understand what you want to achieve, but this might be a solution and you don’t need a Python Script.  
Your main error was to take the first item, instead of connecting directly the curves to the Curve.Offset block.

Below the input lines are offset and split by points at a fixed distance. In your Sequence block, the Amount of points should be calculated dividing the line lenght to the point distance. For example, if you have a 6m line, and you want to split it every 0.5m, you will need 12 points (or 11)

 ![OffsetDivideCurve](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/8/881223c6e4d557357946bc3e690c033ecabca9eb.png)

---

<div class="post-metadata">

**Author:** ![zhukoven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zhukoven/32/70962_2.png) [@zhukoven](https://forum.dynamobim.com/u/zhukoven)\
**Post date:** [September 19, 2018, 1:59pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/3 "2018-09-19T13:59:46Z")

</div>

@martin329, could you describe your problem with OOTB nodes? What’s the problem with them?

This is how you can manage your lines:

 ![WallsByCurves](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/9/395642a2cd6b31eec2038bb6d616af909c46b824.png)

[WallByCurves.dyn](https://forum.dynamobim.com/uploads/short-url/uPTb2XlegrV1wj7JSCwdNmHW4Gi.dyn) (19.0 KB)

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:08pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/4 "2018-09-19T14:08:36Z")

</div>

Hey there,

thanks for the fast replay.

And please excuse my bad english 😕

I want to creat segmented walls along an curve in revit.

So that it’s what it’s look like when i use my “first item method”:

![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/4/f47274493162e49455debae25a215c33f9614ada.jpeg)

and that’s what it’s look like when i delet the node “firstitem”:  
See next Post “Pic 2” (new users can just upload one picture)

now there is this error (fail ehile creating arc):  
See next Post “Pic 3”

Because of this Problem i want to rebuidl the Dynamo Nodes in Python to use the for Loop.  
Actually i’m here:

distance = IN[1]  
start = IN[2]  
amount = IN[3]  
step = IN[4]  
height = IN[5]  
level = IN[6]  
wallType = IN[7]  
strings = UnwrapElement(IN[0])  
walls =   
test =

for item in strings:  
w = CurveElement.Curve  
walls.append(w)

OUT = walls

So i get this reply:

See next Post “Pic 4”

Do you understand my probleme ? 🙂

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:09pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/5 "2018-09-19T14:09:14Z")

</div>

Pic 2

 ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/31dd252589df9ddf50f2fcbf635cb1258d7c562a.jpeg)

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:10pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/6 "2018-09-19T14:10:10Z")

</div>

Pic 3

![3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/387a6274ea926e279e2839a6f2cdfbe4e00c1e9d.jpeg)

---

<div class="post-metadata">

**Author:** ![zhukoven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zhukoven/32/70962_2.png) [@zhukoven](https://forum.dynamobim.com/u/zhukoven)\
**Post date:** [September 19, 2018, 2:12pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/8 "2018-09-19T14:12:28Z")

</div>

@martin329, please upload the full dyf by clicking this button:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/9/199e0b3f06d94db27bc9ddd3974968bfe45dd989.png)

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:15pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/9 "2018-09-19T14:15:38Z")

</div>

Sure =)

 ![Capture2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/e/5ee304a5d7a1e669c63afd4aa0092aa889f82392.png)

---

<div class="post-metadata">

**Author:** ![zhukoven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zhukoven/32/70962_2.png) [@zhukoven](https://forum.dynamobim.com/u/zhukoven)\
**Post date:** [September 19, 2018, 2:17pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/10 "2018-09-19T14:17:17Z")

</div>

That’s not readable 🙂  
Zoom in and take a snapshot, or upload your DYN file.

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:18pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/11 "2018-09-19T14:18:02Z")

</div>

Sorry for that, i edit it =D

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 2:57pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/12 "2018-09-19T14:57:15Z")

</div>

So in Python my Problem is this:

## I want to convert a ModelCurve from Revit to a Curve in Dynamo, so i used this Code

distance = IN[1]  
start = IN[2]  
amount = IN[3]  
step = IN[4]  
height = IN[5]  
level = IN[6]  
wallType = IN[7]  
strings = UnwrapElement(IN[0])  
walls =   
test =

for item in strings:  
i = CurveElement.Curve  
walls.append(i)

## OUT = walls

But i just get a List with: “IronPython.Runtime.Types.ReflectionProperty”

So with Dynamo Nodes i can do it like this:

 ![6](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/9/590f30a827d1010d3ebe93a26c811d5aa2c94165.jpeg)

How can i use the Command “CurveElement.Curve” in python?

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [September 19, 2018, 3:02pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/13 "2018-09-19T15:02:41Z")

</div>

Have you tried the solutions posted? In my case it works perfectly, without Python.  
I selected some parts of the wall, to show that are different pieces.  
If you want to have a continuos wall, you should first join your lines into a polycurve and the offset it.

Hope to have been helpful!

 ![OffsetDivideCurve%203](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/d/bda4552c71429fa1ce8ae64dce5f0a608b4eb466.png)  
 ![OffsetDivideCurve%202](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/1/d1d26bcdf26347c0c5aa5935b60955b3b88939d9.png)

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 19, 2018, 3:17pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/14 "2018-09-19T15:17:11Z")

</div>

Thanks =) this works !

But how can i use the “CurveElement.Curve” Node in Python O.O

---

<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:** [September 19, 2018, 3:33pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/15 "2018-09-19T15:33:11Z")

</div>

If you want to use dynamo nodes in python, you must import them.

```auto
clr.AddReference('DSCoreNodes')
from DSCore import *

```

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 20, 2018, 7:54am UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/16 "2018-09-20T07:54:40Z")

</div>

I import the ‘DSCoreNodes’ but there is still this failure

![10](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/d/bd70a68cc6c14fe3079ea4f905683cbdc0e190a6.jpeg)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [September 20, 2018, 9:12am UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/17 "2018-09-20T09:12:37Z")

</div>

Hi @martin329,  
try this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/f/afbf144c8f70306ca515fa54475c0c229cf57860.png)

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 20, 2018, 9:25am UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/18 "2018-09-20T09:25:31Z")

</div>

Hi @Mostafa_El_Ayoubi, that works fine =)

But just with one line, if i select more than one line, there is an failure =/

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [September 20, 2018, 9:32am UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/19 "2018-09-20T09:32:45Z")

</div>

2 solutions:  
-Loops!  
-Make it a custom node and play with list@level / lacing.

here’s a little something :

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/d/6d13a8959b25e265f443d2d36519a9ff0994f2d9.png)

```
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import*

#A definition to make sure you're always dealing with a list (even in you only have one input element
def toUnwrappedList(input):
	if isinstance(input,list):
		return UnwrapElement(input)
	else:
		return [UnwrapElement(input)]
		

rvtElems = toUnwrappedList(IN[0])
DynamoCvs = []
#Loop through unwrapped Revit ModelCurve elements and convert to DS Geometry
for rvtElem in rvtElems:
	DynamoCvs.append(rvtElem.GeometryCurve.ToProtoType())

OUT = DynamoCvs
```

---

<div class="post-metadata">

**Author:** ![martin329](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@martin329](https://forum.dynamobim.com/u/martin329)\
**Post date:** [September 20, 2018, 1:22pm UTC](https://forum.dynamobim.com/t/read-lines-from-revit-and-split-by-points/26129/20 "2018-09-20T13:22:04Z")

</div>

Thanks for this Help @Mostafa_El_Ayoubi =)  
I think i have to learn a lot in dynamo with python …
