Arnaud
Arnaud

Reputation: 467

Revit API: 'Hidden' methods?

While using Revit API and browsing the "RevitAPI.chm" file (and browsing examples on the internet), I have noticed that some methods exist while not being listed neither in the "RevitAPI.chm" file nor suggested when using RevitPythonShell.

I explain. Let's say for instance that I have a "Space" Object, obtained with

s = FilteredElementCollector(doc).OfClass(SpatialElement).ToElements()

If I do, let's say (assuming s[0] is a valid Space object):

s[0].Geometry

I got an 'indexer object':

<indexer# object at 0x0000000000000049>

But if I do:

s[0].get_Geometry(Options())

Then I got my GeometryElement object. The same behavior goes with get_BoundingBox, for instance.

Now, that's fine, but the only way I could know about these get_something methods is by seeing examples (either on the "RevitAPI.chm", or on forums etc.). So that's kind of strange, isn't it? In the sense that these methods aren't actually listed.

So I guess my questions would be:

Thanks! Arnaud.

PS: Using Revit 2017, tests made with RevitPythonShell and pyRevit

Upvotes: 1

Views: 398

Answers (1)

Jeremy Tammik
Jeremy Tammik

Reputation: 8294

The methods prefixed by a lowercase get_ are automatically generated getter methods. The official Revit API provides and documents the BoundingBox property on the Element class. Rather inelegantly, this so-called property takes an argument. Therefore, the C# .NET implementation generates a property getter function for it.

Upvotes: 3

Related Questions