Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hidden methods in API

3 REPLIES 3
Reply
Message 1 of 4
aliensinearth
1472 Views, 3 Replies

Hidden methods in API

Hi Gentlmen,

 

When surfing on the net, I found a code element.get_BoundingBox (View v) method. But when I try to use in c#, the method is not listed in IntelliSense. It is not documented in the API also.

 

How this is working when not available in API?

Where is this method coming from (I mean which class has this method)?

How many hidden methods like this are available inside API?

 

Thank you

3 REPLIES 3
Message 2 of 4
stever66
in reply to: aliensinearth

I'm not sure why it doesn't show up in Intellisense, but if you download the Revit SDK, and look in the 2017 RevitAPI.chm help file, its listed in there under "BoundingBox Property" which you can find by searching for "get_BoundingBox":

 

 

 

Retrieves a box that circumscribes all geometry of the element.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.0.0)

Collapse imageSyntax

C#
public BoundingBoxXYZ this[
	View A_0
] { get; }
Visual Basic
Public ReadOnly Property BoundingBox ( _
	A_0 As View _
) As BoundingBoxXYZ
	Get
Visual C++
public:
property BoundingBoxXYZ^ BoundingBox[View^ A_0] {
	BoundingBoxXYZ^ get (View^ A_0);
}

Parameters

A_0
Type: Autodesk.Revit.DB..::..View

Collapse imageRemarks

Pass in a view to query view-specific (e.g., cut) geometry or nullNothingnullptra null reference (Nothing in Visual Basic) for model geometry. If the view box is not known or cannot be calculated, this will return the model box; if the model box is not known, this will return nullNothingnullptra null reference (Nothing in Visual Basic). The box will always be aligned to the default axes of the model coordinate system (thus no rotation should be applied to the return value). Also note that this bounding box volume may enclose geometry that is not obvious. For example, the "flip controls" that could be part of a family will be included in the computation of the bounding box even though they are not always visible in the family instance of the family.

Collapse imageExamples

CopyC#
private void GetElementBoundingBox(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Element element)
{
    // Get the BoundingBox instance for current view.
    BoundingBoxXYZ box = element.get_BoundingBox(document.ActiveView);
    if (null == box)
    {
        throw new Exception("Selected element doesn't contain a bounding box.");
    }

    string info = "Bounding box is enabled: " + box.Enabled.ToString();

    // Give the user some information.
    TaskDialog.Show("Revit",info);
}
CopyVB.NET
Private Sub GetElementBoundingBox(document As Autodesk.Revit.DB.Document, element As Autodesk.Revit.DB.Element)
    ' Get the BoundingBox instance for current view.
    Dim box As BoundingBoxXYZ = element.BoundingBox(document.ActiveView)
    If box Is Nothing Then
        Throw New Exception("Selected element doesn't contain a bounding box.")
    End If

    Dim info As String = "Bounding box is enabled: " & box.Enabled.ToString()

    ' Give the user some information.
    TaskDialog.Show("Revit", info)
End Sub

Collapse imageSee Also

 

.

Message 3 of 4
aksaks
in reply to: aliensinearth

I think these are good questions needing some answers to explain what is going on. I don't have too many answers.

 

First of all IntelliSense does work for me on this one. I tried it in 2015 and 2017 Community VS. In my case it is looking at Revit 2016 libs. The object browser appears to show it as an Element class property returning a BoundingBoxXYZ. Unlike most of the other as Element listings, there are no comments. It looks like the same applies to the other "get_" properties "get_Geometry" and "get_Parameter" (three variants). Why Intellisense is not working for you on this one, assuming it works in general for Revit items, I have no clue. I did try changing "Hide advanced members" with no effect. Sometimes I might go the the Object Browser in VS on my own hunting trip when IntelliSense seems to fail.

 

Finding nothing when searching the new online Revit API Docs is typical. I find this typical when searching in most AutoDesk help sites, even when entering terms that come straight out of the UI or as a test entering what I am already looking at. Searching for "get_BoundingBox" turns up nothing at Revit API Docs. Searching for "BoundingBox" does show BoundingBox as an Element property. Only when selecting "Example"  does it show using "get_BoundingBox". The other Element properties described in the Revit API Docs that do not use the "get_" have no examples. One might think there is something about the "get_" that is so obvious to the doc writers, presumably written and edited by trained programmers, such that they would think it needs no explanation.

 

Here is where it gets more fuzzy for me. Someone should chime in to correct. It seems to me AutoDesk has been gradually changing the "get_" and "set_" accessor and mutator methods with each new API version. Older code found online seems to often break in context with that. I'm thinking they are removing the "_" and capitalizing the name in addition to whatever other changes they are making. There is a style and technical reason behind this that someone ought to explain.

 

Revit API Docs shows Element Methods and Element Properties. The "get_" and "set_" added to the API doc property name for just the properties mentioned here is the Method name exposed for us to get and set the property. Intellisense shows these as properties via the box icon. Other Revit Element properties, the ones used without the "get_" and "set_", are the Method names exposed to for us to get and set the property. Intellisense shows these as methods via the wrench icon. I think both are actually methods.  

 

 

Message 4 of 4
aliensinearth
in reply to: aksaks

Thank you stever66. I shall try to download SDK and have a look.

 

Thank you aksaks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community