How to use C# method in Dynamo

Long story short: how do I use C# in Dynamo?

I am trying to get each Space’s Specified Outside Airflow from a list of diffusers. (Made Specified Outside Airflow a shared parameter but it did not work how I hoped)

A diffuser’s Room Calculation Point populates its schedule with data from the space it is above (Name, Number, Specified Outside Air…)

(Image 1)

Using Element.GetParameterValueByName on a diffuser element returns nothing for Space: Specified Outside Air because that parameter is assigned to the space, not the diffuser

(Image 2)

I need a way to match each diffuser with its space in dynamo. My best idea is a large cross product list made from Space.IsPointInsideSpace

(Image 3)

Space.Location returns the location od the diffuser itself (outside of the spaces’ bounding boxes)

I have found two sources mentioning this Method, GetSpatialElementCalculationPoint…

(Image 4)
(Image 5)

… but it does not work in a Code Block and it is not Python Script.

How do I implement this method?

Hi @wumaccarone and welcome

Try using the FamilyInstance.Space property directly, then get the value parameter (Outside Airflow) from the space

To clarify a bit, you can use C# in Dynamo by writing your own Zero-Touch Nodes and then loading those nodes into your environment. To use the API directly within Dynamo you would use Python.

The space name you’re seeing in the schedule actually comes from a Property not a Parameter (similar but not the same).

Are you saying to use FamilyInstance.Space on my list of spaces? Sorry if I am misunderstanding, but I am already able to get the Specified Outside Airflow from the space. My issue is assigning that to the diffuser (Air Terminal) above the space.

Sorry, I am not super familiar with what Zero-Touch nodes and APIs are. Based on what I see on google, is it true I need to have ZeroTouchEssentials.cs and Visual Studio downloaded?

Also, with regards to property vs parameter, I do not see an easy equivalent to Element.GetParameterValueByName for properties. Do you know how I would access this property for my diffuser?

To build zero touch nodes you need to create DLLs which are compiled code which makes them run faster, and also keeps them ‘closer’ to Revit’s native API calls. Pre-compiled means you need to write what you want to code to do effor you bring it into Dynamo, unlike Design Script or Python which are runtime languages which allows you to change what they do as you go. Dynamo calls to the custom code in the DLL are exposed as new nodes which you can assemble and call with design script, but the way they work is set in stone.

To build a dll You don’t need visual studio which varies a cost, but you need something to compile code with. There are a lot of free to low cost options for getting started - Visual Studio Code would be a good option.

Your other option would be to use a Python node to access the property, which I don’t think would be too difficult.

Something like this

1 Like

you could something here if your terminals not hit the space, or try set the room calculation point

1 Like

That worked perfectly, thank you. You’re a hero

1 Like