Graitec Blog

Welcome to the Graitec blog, we hope you enjoy the content and if so please subscribe to the blog or a category for automatic notifications when new posts are added.

subscribe to blog

Ray Casting and Bouncing in Dynamo

A couple of questions I have come across a few times are: Does Revit have a way to check the head clearance on stairs automatically, or would I need to use other software? Also can we use Revit for Line of sight calculations. Although these questions seem a little very dissimilar, they are not as far apart as you think.

In the past for the head clearance I would have probably told them to do a visual check by placing a section through the stairs, then placing dimension on the treads to check that we have adequate clearance.

Alternatively, I would recommend using NavisWorks and the shortest distance tool to check clearance. As for the line of sight, without using other software it would be very hard to do except for placing a camera at the view point and visually checking.

But using dynamo we can be a lot smarter, Dynamo has the ability to cast rays from a point, basically we can cast a ray from a point in any direction using the vector node to set the direction and plane. This opens up a whole range of options to us including line of sight calculations; great for sporting/entertainment venues, to calculation clearance on stairs or ramps.

Let’s have a look at working out the line of sight from a particular point. For this example, we will just calculate rays on a Horizontal plane, but we could cast rays in all directions both vertical and horizontal.

Person sat at desks visual representation

We want to have a visual representation of what can be seen by the person sat at desk in the above image.

First we have to Create a point in Dynamo that we are going to use as the Origin for the Ray Bounces.

Select Element and Create Origin Point

I’ve used the Select Model Element node, which will allow me to specify which object in the project I wish to use as my base point, I’ve then used the Element.GetLocation to get the coordinate of Items insertion point. As this would give me a z value of zero I would be calculating the rays across the floor and potentially under the walls. The Code Block is simply a number to represent eye level which I then add the coordinates by using the Point.Add tool.

RayBounce.ByOriginDirection

We now have the first piece of data we need to run a RayBounce. So now we need to set parameters for the Ray Direction, Max Bounces and the view in Revit we want to create them in. We will also need to Create the collision geometry in Dynamo from the Project, i.e. Walls Windows Columns.

First let’s create the nodes for the direction.

Set rotation angle for rays

Trust me it’s not as complicated as it looks. The first code box simply sets the number of rays I wish to generate around a 360 axis, in this case 60. The second code box divides 360, by 60 and then creates a range of angles. The Vector.x.Axis is the plane I am going to use, if I connected the Code Blocks to this node I would get a horizontal and vertical array. Vector.ZAxis is the axis of rotation.

Number of rays and range of angles code boxes

We only want one bounce and using the Views node we can select a 3D view from the model, in this case the default 3d View.

Now to visualise the Revit geometry within Dynamo.

Visualise Geometry

All we do is select the category we want and then select all of it (All Elements of Category), next we display the geometry by using the Element. Geometry node. We need to repeat the above nodes for category we need. These nodes are stand alone and will not need to be linked to anything else.

Dynamo Building Image

Once we have the geometry we can now link everything into the Ray bounce node and create the ray line.

Create the Ray Line

Here is the finished rays in Revit, not we can also set different colours for the rays based on length.

Finished Rays in Revit

This is just a simple introduction to Ray Bouncing in Dynamo, using the same technique on stairs, we can find the centre of a stair riser geometry and cast a ray vertically to the floor or ceiling above. By checking the length of this line based on a minimum headroom value we can check an entire model in one go and make sure we have the clearance we require.

Hope this has been useful. If you are interested in learning more about Dynamo or would like to take an Autodesk Revit Training Course, then contact Graitec today on (023) 8086 8947 or click the button below to request more information. 

Request More Information

Rate this blog entry:
Steel Stock Management & Purchasing Software
Graitec PowerPack - Openings Tool and how to use i...

Related Posts

autodesk reseller sept16v2
bottom logo

In order to provide you with the best online experience this website uses cookies.