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: 

Outline vs BoundingboxXYZ in Revit API

9 REPLIES 9
Reply
Message 1 of 10
pieter4
700 Views, 9 Replies

Outline vs BoundingboxXYZ in Revit API

I am wondering what different use cases are for the Outline object vs the BoundingboxXYZ objects. They both seem to have a lot in common. They are both:

  • axis aligned bounding boxes
  • 3 dimensional
  • defined by a Min and Max value

The API also seems to use the term 'outline' and 'boundingbox' interchangeably. For example:

  • The BoundingboxIntersectsFilter actually takes in an Outline object instead of a BoundingBoxXYZ
  • View.Outline returns a BoundingboxUV instead of an Outline object

So far, I've been using BoundingBoxXYZ for most of my BoundingBox logic. Only recently I discovered that the Outline object has helpful methods like 'Add', 'Contains', 'ContainsOtherOutline', 'Intersects'. 

 

Are there any important distinctions between these two classes? Do they have different use cases? Basically, am I missing something here 🙂 ?

 

I am thinking of replacing most of my BoundingBoxXYZ methods with Outline objects, and create a conversion method to go from Outline to BoundingBoxXYZ for the cases where you'd still need them (like assigning a section box to a 3d view).

9 REPLIES 9
Message 2 of 10
jeremy_tammik
in reply to: pieter4

I do not believe it is worthwhile changing too much. On one hand, never change a running system. On the other hand, I do not believe the Outline class is used as much as it might be. Check out this quite extensive discussion of the Outline class behaviour:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 10
ricaun
in reply to: pieter4

The Outline is almost the same BoundingboxXYZ, and I know some differences.

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 4 of 10
pieter4
in reply to: jeremy_tammik

Thank you Jeremy. Of course the first thing I did when researching this was search for Outline on TheBuildingCoder 🙂 and I had already come across this article. It's because of this, that I realized that both Outlines and BoundigBox are AABB's (axis aligned bounding boxes). 
Message 5 of 10
pieter4
in reply to: ricaun

Thanks @ricaun !

Related to your last point: can you think of any practical implications of Outline not being an APIObject? It seems APIObject doesn't define a lot of helpful functionality?
Message 6 of 10
ricaun
in reply to: pieter4

Not sure what the APIObject does, probably some internal reference for RevitAPI object.

 

I guess not having APIObject is better.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 7 of 10
TripleM-Dev.net
in reply to: pieter4

Hi,

 

From the documentation a Outline can also be scaled/transformed... Outline , also it's min/max are absolute coordinates as boundingbox it's min/max points around it's origin + you have to take it's transform into account. (I often forget to account for that)

 

Message 8 of 10
pieter4
in reply to: TripleM-Dev.net

This is interesting. I was aware BoundingBoxXYZ has a tranformation but so far I've been ignoring it and my code has been working fine. When I call get_Boundingbox(null) on an element, the returned BoundingBoxXYZ seems to be absolute coordinates with respect to the internal origins. Maybe I've just been lucky so far.

I'm curious in what type of cases you've found BoundingBoxXYZ's with transforms on them?

Message 9 of 10
TripleM-Dev.net
in reply to: pieter4

Hi @pieter4,

 

I have several functions that deal with elements in links in relation to the current model (AutoVoid cut, Area-To-Area/Room matching for datatransfer between them, validating contours etc).

 

On occasion it can happen that a link internal origin isn't placed in the internal origin of the active model or other combinations of mixed origins (or even rotated), For intersecion checking I create Solids and use SolidUtils.CreateTransformed to create a solid relative to the current model position (or the other way current model to the link's coordinates system/origin)

 

If you take a BoundingBox of that transformed Solid, the boundingbox transform origin isn't (always) 0,0,0 (depends on the transform applied)

So if you use the boundingbox limits to create a outline for BoundingBoxIntersectsFilter it doesn't check in the correct place for intersections.

 

Originally I only had to deal with models where the linked model were in eachother internal origin, but suddenly I got strange results, intersections where none where or a cut misaligned, the cause: internal origin and project base point of a link weren't the same. So years ago I added some extensions for BoundingBoxXYZ and outline elements along with a wrapper for some XYZ collecting and generating a BoundinBoxXYZ/Outline or even a solid.

 

Last year I updated one of the function to increase the speed of the Intersection detection and AutoCut of walls with heavy use of BoundingBoxIntersectsFilter, ElementIntersectsSolidFilter, SolidUtils and BooleanOperationsUtils to cut down the evaluation of 1000's of walls agains structural framing (or whatever) in another model (or own model) from about 30-60min to about 10sec. with around 600-800 detections.

 

So if you retrieve the BoundingBoxXYZ directly from elements and pass them to Revit API function there will be no need to correct the coordinates. But manipulated elements with transform will likely also have a boundingBoxXYZ with a transform origin not 0,0,0

 

Sorry, became a longer post than intended.

- Michel

Message 10 of 10
pieter4
in reply to: TripleM-Dev.net

Thank you this is very helpful!

 

My use cases does not need to work with links, which probably explains why this has not been an issue so far. 

 

I too am planning to take more use of the builtin Revit API filters for boundingbox calculations (BoundingBoxIntersectsFilter specifically), which requires an Outline object as an argument, which is how I first ran into the Outline object. 

 

I'm glad I asked the question here. I feel I have a better understanding of the nuances now. Thanks all!

 

 

 

 

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

Post to forums  

Forma Design Contest


Rail Community