Get BoundingBoxXYZ as shown in Revit Lookup tool

Get BoundingBoxXYZ as shown in Revit Lookup tool

mrensing
Enthusiast Enthusiast
1,092 Views
4 Replies
Message 1 of 5

Get BoundingBoxXYZ as shown in Revit Lookup tool

mrensing
Enthusiast
Enthusiast

I am working on getting the placement point of an Elevation View.  I am trying to get the same BoundingBoxXYZ that the Revit Lookup tool displays when the Elevation is inspected. The Images below illustrate what I am finding.

 

This is the basic testing setup.  10'x10' walls, with the lower left inside corner at XYZ 0, 0, 100'. The Center of the green crossing model lines is XYZ 5', 5', 100'. The elevation was placed as close as I could to that intersection. The green box around the elevation indicator  matches to the BoundingBoxXYZ of what the Revit Lookup tool reports.

Plan.jpg

 This is the Revit Lookup tool for the Elevation View.

RevitLookup BoundingBox.JPG

The next two images show attempts at retrieving the BoundingBoxXYZ via the API.

BoundingBoxActiveView.jpg

boundingBox1 is null, attempted to get BoundingBoxXYZ from the ActiveView. This is being run via an updater at time of creation, and the active view is the plan view it is being created in.

BoundingBoxElevation.jpg 

This shows the BoundingBoxXYZ of the elevation from the elevation. This BoundingBoxXYZ is also the same as the CropBox property of the elevation.  This Doesn't match the BoundingBoxXYZ reported via Revit Lookup.

 

So, how can I retrieve the same BoundingBoxXYZ that the Revit Lookup tool retrieves?

0 Likes
Accepted solutions (2)
1,093 Views
4 Replies
Replies (4)
Message 2 of 5

mrensing
Enthusiast
Enthusiast

Upon closer examination, the element displayed in plan view is a different element than the Elevation View.  The ElementId is off by 1.  The Elevation View in the Project Browser is the elevation that I access via the API.  What then is the elevation that is displayed on the plan?

0 Likes
Message 3 of 5

bhprest
Advocate
Advocate
Accepted solution

I am not familiar with how this object is referenced in the API, but the bounding box that you are snooping with the lookup tool is probably the arrow (the annotation itself). There may be a better way to do this, but I believe that you can pull the ViewSection object from the arrow element (and vis versa) via the GetDependentElements() method.

 

That being said, the placement point that you are looking for might actually be the Location property of the ElevationMarker that the ViewSection was created from. In your example, the ElevationMarker is the circular marker. Hopefully someone else can expand upon this, but I believe that the origin of the transform of the BoundingBoxXYZ of the ViewSection is not really related to the placement point of the ElevationMarker object.

Message 4 of 5

mrensing
Enthusiast
Enthusiast
Accepted solution

Thanks for the suggestions.  I was able to get get the arrow using get_DependentElements. Unfortunately, it doesn't have a location. I was able to get the Elevation Marker by using a FiltereedElementCollector for ElevationMarkers, and then checking them to see if they have the view that I am looking for.  ElevationMarkers, unfortunately, don't have locations points or curves either.  But I can grab the BoundingBoxXYZ of it, and find the midpoint of the box.  This will work for my purposes.  Thanks for your suggestions, got me moving in the right direction. 

0 Likes
Message 5 of 5

bhprest
Advocate
Advocate

Glad to hear it. My apologies about the Location property, I was mistaken about what that object does. It looks like you're on the right track though. 

0 Likes