How to convert SystemObject into Element

Hello,
I created polyline with a python script. But when I want to use with other Dynamo node, I have the following message : Autodesk.DesignScript.Geometry.PolyCurve is expected but SystemObject is used


How can I manage this issue?
Thank in advance
Bruno

Hi Bruno, welcome! :wave:
Use the ToProtoType() method built into Dynamo for Revit

Example code

import random

import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import PolyLine, XYZ

ri = random.sample(range(1000), 27)
iters = [iter(ri)] * 3
points = [XYZ(x, y, z) for x, y, z in zip(*iters)]

pl = PolyLine.Create(points)

OUT = pl, pl.ToProtoType()

Result
image

1 Like

Hi Mike,
Thanks a lot. I just add the following lines and it works fine.

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

Best regards

Bruno

1 Like