Get Units from parameter of element

How Get Units from parameter of element ?

it is wrong but for example:
IN[0] LIST if some element (elements)
list_display_type=UnwrapElement(IN[0]) Parameter from name xxx DisplayUnitType()

OUT=list_display_type >> DUT_CUBIC_METERS

This is an OOTB way.

3 Likes

Thanks!)
Can you show how do it in python ?

Sorry about that, but I am a bit of a python hack. Might have to let someone else answer that one. :grimacing:

1 Like

its ok) thanks for you answer :sunglasses: will see the another answers …

http://www.revitapidocs.com/2018/3a33606a-fcd4-485b-ed19-b3a879166726.htm

yes, ill see that,
its looks like:
DisplayUnitType { get; }
get - i m think it is parameter
The display unit type of the parameter

but how get the parameter from element ? (use the element and name of parameter) ?

That’s the most straight forward way. You can use Element.Parameter to get the element’s available parameters then filter by name.

how do it in python ?)

What are you wanting your workflow to be? Can you show your work so far?

i want to get units from any parameters of elements and convert them from project units

Hi,

MEPover package has a node called GetParameterAsProjectUnits which you can edit to see the Python code.

2 Likes

Is there a reason it has to be in Python? Clockwork and MEPover both have nodes that deal with project and internal units.

1 Like

this my code
https://pastebin.com/w0fqpVeu

i am create convert-block as def function from every unit , but i m want to do it automatically - convert all units of all parameters from selected elements in projectunits in one way

So are you looking to get all parameters from an element or only specific parameters?

all parameters, thats may be : string, float, flow e.t.c …
for string and float DisplayUnitType is INVALID, for anotner units it is exist…
and for all units of parameters from selected elements i want to convert to project units…

This will give you the parameter object, parameter name, and unit type for all parameters of a given element. That might get you started.

dataEnteringNode = IN
element = IN[0]
names = []
units = []

params = element.Parameters
for param in params:
	names.append(param.Name)
	units.append(param.UnitType)

OUT = params,names,units
3 Likes

Great! :grinning:
Thanks guys!
Im go to experimenting now )
Aaaand …answer from Giovanni_Brogiolo looks like as decision for my question)…I ll try…

why may be this mistake ?
Screenshot_9
Screenshot_10