Alternative of ReferenceIntersector (its slow) for raycasting in Revit API

Anonymous

Alternative of ReferenceIntersector (its slow) for raycasting in Revit API

Anonymous
Not applicable

I am doing raycasting using below code.


ReferenceIntersector intersector = new ReferenceIntersector(uidoc.ActiveView as View3D);
IList<ReferenceWithContext> references = intersector.Find(point1, point2 - point1);
foreach (ReferenceWithContext reference in references)
{
ElementId id = reference.GetReference().ElementId;
}

 

It takes around 13 seconds to do around 10,000 ray casting in this situation.

Is there any efficient way to do ray casting in Revit API. 

Are there any alternatives of ReferenceIntersector?

0 Likes
Reply
914 Views
5 Replies
Replies (5)

jeremytammik
Autodesk
Autodesk

No, sorry.

  

Is that really slow? Is that not very fast, actually?

 

Would you like to share a reproducible case including a sample model and benchmarking code?

 

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

 

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Anonymous
Not applicable

In my current project, I might need to do maybe 100,000 or more ray casting, and doing Ray casting using ReferenceIntersector  might be inefficient. 

Unfortunately, I won't be able to share a reproducible case. 

Me and my team are trying to see what else can we do to increase the efficiency. 

Thanks for replying.

0 Likes

jeremytammik
Autodesk
Autodesk

I implemented a specific raytracing functionality twice over, using the Revit raytracer and the threejs one in the Forge viewer:

 

https://thebuildingcoder.typepad.com/blog/2017/03/threejs-raytracing-in-the-forge-viewer.html

 

That might provide a viable alternative for you too.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Anonymous
Not applicable

Thanks for the idea.

I am still a bit confused by that documentation.

I am working with .NET framework. I'll be implementing it in C#. I can see first, we need Mesh objects, and then we can call RayCaster Object. I am also searching for how to get Meshes of an element or a Family Type.

Is there any documentation or GitHub page where I can find examples of implementing RayCaster in Revit API, using .NET framework?

Thank you again.

0 Likes

jeremytammik
Autodesk
Autodesk

RayCaster is for use in the browser JavaScript implementation. No support for .NET, no support for C#.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes