C# nodes - elements

I’m trying to start some custom node with zero touch. Everything ok (still I’m working on simple tasks) but I can’t extract as output the list of elements like in the screenshot. Other parameters are ok. I’m sure is easy and I’m missing something stupid!



Thanks

I think you need to mark them as Dynamo elements with ToDSType(True)

1 Like

Where exactly?

My guess would be:
elList.Add(doc.GetElement(e.Id).ToDSType(true))

I tried but it cannot find the definition

Ah I see you’re creating elements throught the Revit.DB… you’re right those don’t have the ToDSType method. Only elements in Revit.Elements have that method I believe.
I’m struggling with this myself at the moment, how can I get elements from Revit.DB to Revit.Elements so they can be used in Dynamo?

Its straightforward: you need to output the element from the Revit.Elements namespace (this is the Dynamo library that includes all the Revit wrapper classes).

You need to declare elList as Revit.Elements.Element as it wont cast from Autodesk.Revit.DB.Element (which is the current type of elList).

Then just call the ToDSType method as per @T_Pover instructions. When you output, the elements will be wrapped in the Dynamo Revit class rather than outputting as Revit API objects. Also, make sure you have all the relevant libraries referenced in your project and have added the appropriate using statements to access the classes/methods, otherwise you’ll get the warning messages - as you are getting - since it cant find the methods.

1 Like

Yes!
Thanks!