Get element outline

Get element outline

ottosson_mathias
Advocate Advocate
459 Views
3 Replies
Message 1 of 4

Get element outline

ottosson_mathias
Advocate
Advocate

I want to do a collision check between two element types, a generic model (provision for void) and cable trays, and I want to add a margin of 100mm to the void outline for each direction (in relation to the voids faces) to see if there are cable trays close enough to the void.

 

How can I get the outline of the void element? It's always a box with 6 sides that will be checked. But it can be rotated, so a regular bounding box is not enough as it will not follow the elements rotation.

 

ottossonmathias_0-1696505838022.png

 

A bounding box will just wrap the element like this and does not "rotate with" the element.

ottossonmathias_1-1696506426960.png

 

Thanks!

0 Likes
460 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Well, if the bounding box is too large, you can simply query the element for its true geometry. That will be exactly right. Then add the required 100 mm offset to that. Or, you can compromise between the two extreme options and create a convex hull of the element's vertices.

 

When you say 'outline', do you mean the 2D planar outline in plan view? If so, you are in luck. I have dealt with such issues repeatedly myself. Check out my article and GitHub repo:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

ottosson_mathias
Advocate
Advocate

Maybe I use the word "outline" wrong. I basically mean a rotated bounding box that wraps the element, since I want to extend the box in the direction of two opposite sides.

0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

That can easily be achieved. However, I do not think the Revit API provides any out-of-the-box functionality for that specific purpose, so you will have to do some custom geometric programming yourself to create what you need. That programming may be extremely simple depending on the element that you are working with. For instance, if it has a location curve, then you could just grab that curve, extend it in both directions by the desired amount, and offset the two end faces to match.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes