Which function should I use when I need to get the area of an element?
For example, I know how to get the category or element id of an element,
just simply type elem.Category.Name, then I can get it.
But now i need to get the area of a floor,
which function should I use?
Thanks a lot!
The area of a floor is stored in the parameters. Using the API, you can access the area information from a floor by extracting the specific Area parameter. YOu can do this either by using the string "Area" as the parameter name or use BuiltIn parameters and in this case you will have to use the built-in parameter called Host_Area_Computed. For more on how to work with parameters, please take a look at the SDK samples contained in the Revit installation folder.
Usually for any query like this, please make use of the Revit Snoop tool called Revit LookUp. This is also part of the Revit SDK. Using this, you can access all the information on any Revit element without even writing a single line of code. I am attaching a screenshot of how the LookUp tool looks like and how I got the information I have just provided using this tool.
Anotther great resource for API related queries in The Building Coder blog by Jeremy Tammik.