Reading Flow Rate and Head of Mechanical Equipment

Dear Friends,
i am trying to read Head (pressure value) and Flow Rate (L/s) parameters of mechanical equipment from Dy. However it is not reading correct values. Totally different values. What may be reason of this problem?

Hello kvusal,

Most likely it’s a problem with units, see altso this PR: https://github.com/DynamoDS/DynamoRevit/pull/1493

You can try this python script and see if you get better results:

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
if isinstance(IN[0], list):
	elements = UnwrapElement(IN[0])
else:
	elements = [UnwrapElement(IN[0])]
OUT = []
for element in elements:
	parameter = element.GetParameters(IN[1])[0]
	unitType = parameter.Definition.UnitType
	
	# Get the display unit for the unit type in the current document
	formatOption = doc.GetUnits().GetFormatOptions(unitType)
	displayUnit = formatOption.DisplayUnits
	
	#Convert the value with UnitUtils
	OUT.append(UnitUtils.ConvertFromInternalUnits(parameter.AsDouble(),displayUnit))

Hi @kvusal

Within revit it stores all values as feet (Feet², Feet³, etc) this is why when you get some values in dynamo it is reporting the revit database value not the value in the units of your project. The below image will help show you, see “Value” and “As Value String”.

There is a custom node from lunchbox package called “LunchBoxGetParameterValue” that reads the value as string. Here is an example.

1 Like

Kulkul thanks a lot.

2 Likes