Working with Revit Elements in Zero Touch Plugin Development

Hello,

I am trying to write some C# code to load into Dynamo. Specifically, be able to pass in Revit elements, do some work, and output some stuff. I have slapped together a quick test code block which simply takes a list of elements and returns a list of their integer ids:

using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace WAIDynamo {

public class DynoDump {

public static List<int> GetElementIds(List<Element> elems) {
List<int> ids = new List<int>();
foreach (Element e in elems) {
ids.Add(e.Id.IntegerValue);
}
return ids;
}
}
}

When I drop my node into the definition, I get the following warning and the code does not execute:

Warning: Method resolution failure on: GetElementIds() - 0CD069F4-6C8A-42B6-86B1-B5C17072751B.

Am I missing an important step? I have successfully worked with other kinds of nodes created using the Zero Touch Plugin Development framework but I am running into problems when trying to work with Revit Elements. Any help would be appreciated.

Thanks!

I believe you are not actually passing in Revit elements as the elements in Dynamo are wrapped up with specific DynamoRevit wrappers so they can be traced in Revit. The method resolution failure means the method failed, maybe because a wrong type was passed.

I would check the actual type of the objects.

You may need to unwrap these elements and get the real revit elements out of them, please post to github if you need more details.

Ahh, I got ya. I see that I am to import the RevitNodes dll, not the RevitAPI. Thanks. Off to the races!

Where do i get Revitnodes dll?

Hi Moses,

the revitnodes.dll would normally have been built when you built the Dynamo project. It possible that when you read this DynamoRevit will have been pulled from Dynamo core, and so you may need to download and build the DynamoRevit project on github.