C# Revit API How do I setup CSharp?

I have a simple c# class using the Revit API but I’m confused how do I setup the class (.dll) for Dynamo to use.

I’ve had success importing a package (.dll) that isn’t using the Revit API, however, I would really like to use the Revit API. Does anyone have a template for c# class using the Revit API to be used in Dynamo? or an example of how you put together a dyn and .dll to work together to edit Revit Elements?

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

namespace SOM.RevitTools.TopoBuildingPad
    class BuildingPadEdge
        public void BuildingPad_edge(IList<CurveLoop> profileloops, Document doc)
            FilteredElementCollector buildingPad = new FilteredElementCollector(doc).OfClass(typeof(BuildingPad));
            BuildingPad b = null;
            foreach (BuildingPad pad in buildingPad)
                b = pad;

            ElementId activeViewId = doc.ActiveView.Id;

            Transaction t = new Transaction(doc, "trans");


Hi Danny,

Below is an example of C sharp dynamic interpreter package.


@Danny_Bentley see the DynamoRevit Repo on github for lots of nodes which use c# and the revit API.

1 Like

Yeah, and right of the bat if you are using the ZeroTouch model that @Michael_Kirschner suggested you want to use the Transaction Manager that Dynamo has wrapped for you instead of the API one you have in your code. Also, you don’t have to pass a document into a method like that since it will always be available via the Document Manager wrapper. The only exception would be if you are applying that method to a Family or a Linked Model in which case you should pass a specific document to the method.