Feed instead of meter(or centimeters), why?

Hello Dynos,

I have a small question, so my code worked very well, but i get “imperial” values inspite of “metric” ones, why?

OUT = UnwrapElement(IN[0]).get_Parameter(BuiltInParameter.ROOM_PERIMETER).AsDouble()

How can i use the Units from the open document?

KR

Andreas

Revit API internal unit is decimal feet, you have to convert it either manually (there are dynamo nodes that convert values between units) or using DisplayUnitType api:
https://www.revitapidocs.com/2020/9cc2c0ea-f59f-9d76-ce19-ae7eede03bbd.htm

2 Likes

Heads up: I believe that this API changes pretty significantly in 2021.

1 Like

Thank you … I use Revit 2018.3

I can`t solve it with any call for the current doc?

There’s no way around it. You’ll have to convert one way or the other :slight_smile:

OUT = UnitUtils.ConvertFromInternalUnits(UnwrapElement(IN[0]).get_Parameter(BuiltInParameter.ROOM_PERIMETER).AsDouble(), DisplayUnitType.DUT_METERS)

:slight_smile: it worked! i just copy paste something, i want to understand

DUT_ stays for what?

Excellent :slight_smile:

Display Unit Type is my best bet :wink:

3 Likes

Tip: you can dinamically change to the “correct” type using the Parameter DisplayUnitType property

1 Like