Read Lines from Revit and Split by Points

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.)

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?

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)

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

This is how you can manage your lines:

WallByCurves.dyn (19.0 KB)

Hey there,

thanks for the fast replay.

And please excuse my bad english :confused:

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

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 ? :slight_smile:

Pic 2

Pic 3

3

@martin329, please upload the full dyf by clicking this button:
image

Sure =)

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

Sorry for that, i edit it =D

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:

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

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!


Thanks =) this works !

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

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

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

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

10

Hi @martin329,
try this:

Hi @Mostafa_El_Ayoubi, that works fine =)

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

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

here’s a little something :

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

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