Units in Dynamo 1

I’m trying to get a handle on units, which I understand should be “unitless” and just appear as the values of whatever system is chosen in Revit, since v0.8. I just pulled the cooling and heating loads which are in IP in Revit (Btu/h) but seem to be coming out multiplied by a factor of 3.15ish. Anyone else noticing this?

Hi Ben,

Try using “Lunchbox Get Parameter” node it will give you exact values as in Revit.

It would be better if you can drop here screenshots of your graph.

I see the same issue with rebar elements. The Revit API uses feet as length unit, but dynamo is supposed to be unitless. Maybe we should gather some axamples and post an issue at github https://github.com/DynamoDS/DynamoRevit/issues

1 Like

Lunchbox Get Parameter node gives exact Units as in Revit:

Not working for me, revit 2017:

Looks like there’s been an API change:
This will work in 2017:

1 Like

Yes there has been API changes in 2017. Here is a complete listing of the changes:

I should have been a little more specific. I’m using Dynamo 1.0 and Revit 2016. Here is an example of the loads not coming through correctly. I still haven;t figured out how the btu/h (in Revit) is being converted. If it was being converted to Watts, which would make sense, then it should be 26431.94 [btu/h] / 3.412 = 7746.76 [W]. Mostly I’m trying to figure out what is happening here.

I’ve also notices that temperatures also come through incorrectly. The results I see in Dynamo are in Kelvin, but in Revit it is set to Fahrenheit. It’s easy enough to deal with, but inconsistent since I though Dynamo was now unit-less.

I did notice that the Lunchbox node works correctly, but I’d prefer to avoid using any packages to make it easy to distribute to others in my firm. Plus it seems like an issue in the default Dynamo node that needs to be addressed.

We’ve discussed this in a few threads. Seems that length and area (and what else?) are converted to the RVT’s current unit settings in Dynamo but other units remain as Revit internal units. See Revit API MEP Units & Conversion

I see. Looks like most of the basic architectural units remain unit-less in Dynamo but many of the others stay as default Revit units. Any idea what’s going on with my cooling loads though? They don’t seem to be in any recognizable units.

@Kulkul, I’ve been using the Lunchbox nodes, and you’re right, the units are always correct. However, it seems to add units and then convert the whole thing to a list of strings. I’ve been trying to edit the underlying code, but I’m not aware of another function to replace “AsValueString()” that doesn’t actually pull the units. Of course I could parse the strings afterwards to remove the space and the units, but that just seems messy and excessive. Any thoughts?

@bbrannon4 You could have a look at the UnitUtils class and the ConvertFromInternalUnits method:

http://revitapisearch.com/html/9cc2c0ea-f59f-9d76-ce19-ae7eede03bbd.htm

Perfect, thanks!

The link is dead,

Can you help me ?

Hello, @Konrad_K_Sobon is proposing a fix for this at this moment, but no responses from the developers yet. Take a look here: https://github.com/DynamoDS/DynamoRevit/pull/1493

You can use a python script with someting like this in the mean time, here is a link to the docs: http://www.revitapidocs.com/2017/128dd879-fea8-5d7b-1eb2-d64f87753990.htm

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

# Get parameter and unit type from element
element = UnwrapElement(IN[0])
parameter = element.GetParameters(IN[1])[0]
unitType = parameter.Definition.UnitType

# Get the display unit set for the unit type in the current document
formatOption = doc.GetUnits().GetFormatOptions(unitType)
displayUnit = formatOption.DisplayUnits

#Convert the value with UnitUtils
OUT = UnitUtils.ConvertFromInternalUnits(parameter.AsDouble(),displayUnit)