From the course: Revit: Creating C# Plugins

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Projecting rays

Projecting rays

From the course: Revit: Creating C# Plugins

Start my 1-month free trial

Projecting rays

- [Instructor] Intersection filters are great for checking how two elements clash, but what if we want to check how elements relate that don't touch. To do that we need to project rays, which is the act of sending a vector from a location to see what it hits. It's a way for us to find elements in 3D. To do that, we need to use a class known as a reference intersector. This is used to construct an object that can be used to project a ray and find what it intersects. There are several different constructors that allow us to search for specific elements, all the firsts that it hits. Let's try this one. This will return the first element it intersects based on the filter we provide, such as a category filter. It also needs a target type which is an enumeration of the geometry type we plan to hit, and a view to check it in. Once we've created an object, we can get the intersections of the ray by calling the find, or find nearest methods from the reference intersector object. Both of these…

Contents