Is it possible to detect an object on some specific distance from specific point using revit api.

Is it possible to detect an object on some specific distance from specific point using revit api.

prasannamurumkar
Advocate Advocate
714 Views
4 Replies
Message 1 of 5

Is it possible to detect an object on some specific distance from specific point using revit api.

prasannamurumkar
Advocate
Advocate

I have one point.I want to find if any object is present in top half circular portion of radius 2 meters.

 

1.know that to find any obstacle we could use reference intersector.

So fire reference intersector in Z direction and if object is present then we can easily get using proximity.

IList<ReferenceWithContext> refs = intersector.Find(point, XYZ.BasisZ);

 

this will retain object of only in z direction.

2.if want to get objects in top half spehrical portion what could be good way?

 

thank you.

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

jeremy_tammik
Alumni
Alumni

You could create a solid representing the volume of space that you are interested in and use an ElementIntersectsSolidFilter on that:

 

https://www.revitapidocs.com/2022/d0762dd5-1e9e-2453-0f40-5e109748f989.htm

  

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

prasannamurumkar
Advocate
Advocate

Hi thank you for reply.

I have multiple points that are on stairs of every step and stairs are also multiples.

And i want to make sure any obstacle is not present from 2.1meter from steps of stair.[i am able to get points of stairs steps.]

 

if decide to create solid at every point and then delete.

 this solution may take large time.

If any better workaround. could  anyone suggest.

 

 

[Link is not opening not sure may be issue with my personal PC as some specific links are not working. i will  search on your blog may be similar solution available]

 

 

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

The link above opens fine for me.

 

Yes, The Building Coder offers numerous alternative approaches as well. Look at the topic groups, e.g., Element Intersection and Collision Detection, 2D Booleans and Adjacent Areas and the element intersection articles in 3D Booleans, Cutting and Joining Elements:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5

  

 

 

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

RPTHOMAS108
Mentor
Mentor
Accepted solution

You don't need to delete the solid if it was never added to the document.

 

You can create a half sphere (GeometryCreationUtilities.CreateRevolvedGeometry) and use it within a ElementIntersectsSolidFilter. You should use an 'or' combination of BoundingBoxIntersectsFilter and BoundingBoxIsInsideFilter prior to this to cut down candidates.

 

You can test by creating direct shape objects and finding if they are in range of point:

 

Random noise objects found within distance of sphere and filtered again into two halvesRandom noise objects found within distance of sphere and filtered again into two halves

00:00:00.1296225
Filtered 271 out of 7000 objects
00:00:00.2004638
Filtered 271 into two sets

 

Random noise objects found within distance of sphere and filtered again into eight quadrantsRandom noise objects found within distance of sphere and filtered again into eight quadrants

00:00:00.1276687
Filtered 273 out of 7000 objects
00:00:00.1882211
Filtered 273 into eight sets