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: 

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

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
912 Views, 5 Replies

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

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?

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: Anonymous

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

Message 3 of 6
Anonymous
in reply to: jeremytammik

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.

Message 4 of 6
jeremytammik
in reply to: Anonymous

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

Message 5 of 6
Anonymous
in reply to: jeremytammik

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.

Message 6 of 6
jeremytammik
in reply to: Anonymous

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

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

Post to forums  

Autodesk Design & Make Report