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
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
Thank you! it could help to find correct API-Vocabulary.
hmmmm
OUT = UnitUtils.ConvertFromInternalUnits(UnwrapElement(IN[0]).get_Parameter(BuiltInParameter.PROPERTY_AREA).AsDouble(),DisplayUnitType.DUT_SQUARE_METERS)
it is a bit of…
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.
Thank you very much! I learn always a little bit more
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
‘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
“hidden”
That is for me as rooky a important information!
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#.
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)
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
I think also, like a dictionary, you have a word - antonimo, synonimo - at least to have one example.