Property Lines, access values?

2020-09-07_16h04_04
Hello,

When access a value that i don`t know what it is, can i do just trail and error (AsString, AsDouble,…)
How about Units like (m²)

OUT = UnwrapElement(IN[0]).get_Parameter(BuiltInParameter.PROPERTY_AREA)#????

KR

Andreas

Hi @Draxl_Andreas,

Use the Element Parameters Properties node :

1 Like

Thank you! it could help to find correct API-Vocabulary.

hmmmm :confused:

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

it is a bit of…

2020-09-08_08h59_25

Hi,

it might be that your parameter is null (for example: not found in the element)
After get_parameter it is worth checking if you’ve got the correct parameter object.
This worked for me:

import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
#The inputs to this node will be stored as a list in the IN variables.
e = UnwrapElement(IN[0])

p = e.get_Parameter(BuiltInParameter.PROPERTY_AREA)
if p:
	output = UnitUtils.ConvertFromInternalUnits(p.AsDouble(),DisplayUnitType.DUT_SQUARE_METERS)
else:
	output = None

#Assign your output to the OUT variable.
OUT = output

Also make sure that you are selecting a chain of property lines - rather then a single one. Single property line won’t have an area parameter.

obraz

1 Like

Thank you very much! I learn always a little bit more

2020-09-08_11h15_44

x.get_Parameter()

Can i find a list of these “constructors” - at the APIDocs i cant find get_Parameter, when i use dir() than i find GetParameters` or GetParameterByValueAndName or is get_Parameter from a other library or a Python-methode?

KR

Andreas

1 Like

‘get_parameter’ is kind of hidden - don’t ask me why…but it is a Revit API function (also in c#)
But most of the methods and properties are fortunately correctly described in api docs

1 Like

“hidden” :slight_smile:

That is for me as rooky a important information!

:slight_smile:
I am no trained coder myself, so have no idea how it exactly works…but for ‘get_parameter’ you will not get an autocompletion/hint either, when writing Revit macros in C#.

1 Like

Hello
the get_ prefix refers to a getter (Property).
A property getter function is generated when an property takes an argument ( .NET implementation)

example get_BoundingBox(View)

4 Likes

I will test it! get_ Do you recomment also learn “.NET” actually what can I learn regarding that?
I touch this topic just during installing Autodesk-Products (Framework Issues)

.NET is just the framework developed by Microsoft. For example C# is a .NET language. I think it helps a lot, if you do a C# video course to learn the basics of the C# syntax. If you have already knowledge of Python, you can compare it. And then it gets easier to understand the Revit API examples. In my opinion, Autodesk should extend the Revit API documentation with Python, to support the Dynamo Community

1 Like

I think also, like a dictionary, you have a word - antonimo, synonimo - at least to have one example.