## Quick guide to Dynamo Space Analysis package

I was awed by Autodesk’s Project Rediscover when I read about it, the concept of visibility analysis (Or isovist analysis) was a new concept to me and prompted my curiosity on this subject. My first go-to was, of course … the Space Analysis Package in Dynamo, since Autodesk’s graph used that to perform the visibility analysis.

I’ll be honest, I had a pretty hard time trying to get it to work for the first time, as there weren’t much references other than the graph from Kean (where I was able to pick some clues from). While the graph provided used imported SAT solids, I wanted to use my Revit model for analysis instead. So this post goes out to those who are facing the same problems as I did.

For the purpose of this guide, I’ll be using one of the sample files in Revit, i.e. “rac_advanced_sample_project.rvt” and perform the analysis at the 1st level, “01 – Entry Level”. You can download the Dynamo file for reference below if you wish to. Let’s get started!

First, ensure that you have the package installed in Dynamo. Before we move on, please take note that this package allows only two-dimensional analysis. The points contained in the lattice will always be projected onto the “zero” plane, i.e. Z-coordinate = 0.

## The SpaceLattice node

Now, this node is the core of the entire package, where context is built from. It requires 3 inputs:

1. Bounding box, which defines the space for analysis. We can imagine the bounding box being chopped up into “grids” that are lined up against one another.
2. Barriers, acting as obstacles when viewed from one point to another.
3. Resolution, which defines the size of the “grids” that representing the space.

## Bounding box input

In order to get the entire Level 1 floor plan for analysis, it makes perfect sense to use the floor element at Level 1 (See highlighted below).

Since geometric transforms are not within the scope of this topic and that you probably have other better ways to get a bounding box, I’ll simply show a pseudo-code of my method (You can download the script if you wish to refer to it). .

1. Select Floor element
2. Get element geometry
3. Get highest surface using centroids
4. Get surface bounding box

## Barriers input

In this guide, we will only use walls as barriers but you could always add other elements of your interests as well.

While trying to get the wall profiles, I found that `Element.Geometry` didn’t work for Curtain walls so I had to find a workaround using `Element.GetLocation` instead.

We can see the image above doesn’t reflect the openings from doors, which I wanted… I had to perform some geometric transforms. Again, since geometric transforms are not within the scope of this topic, I’ll simply show a pseudo-code of my method (You can download the script if you wish to refer to it).

1. Get Level 1 Wall curves
2. Extrude curves into surfaces
3. Thicken surfaces into solids, Union them
4. Get Level 1 Door bounding box
5. Get cuboid of bounding box, Union them
6. Subtract both unions
7. Get Polysurface of subtracted geometry
8. Get surfaces of Polysurface
9. Get Perimeter curves of surfaces
10. Get Longest curve

## Resolution input

This is a simple one, just input your desired grid dimensions! For the purpose of this guide, I’ll use 200 mm. And there you go, your Lattice have been created!

## Visualization!

Now for the fun part, to visualize your lattice in Dynamo, simply plug your lattice into the `SpaceLattice.Points `and `SpaceLattice.Edges` nodes. Notice that the image reflects a blown up view of the top left area of the floor plan.

## Visibility Analysis

To perform the visibility analysis, we first have to create a ViewField to set the observer’s point. In this guide, I’ve used “Florence” as my observer.

Using Florence’s XYZ-coordinates and default radius as input to the `ViewField.BySpaceLatticeAndViewPoint` node, we can finally create our visibility grid using the `VisibilityGrid.ByViewField` node.

Now, the visibility grid contains all the analysis results and up to us to interpret it. First, plug the VisibilityGrid output into the `VisibilityGrid.Point` and `VisibilityGrid.Values` nodes.

We would get two lists of exact same sizes, one containing points, and another containing values from 0 to 1 (Get the hint?). This actually tells us “how visible” is the point at index from the View Point, with 0 being not visible at all. With that hint, we can simply filter out points that are not visible, i.e. value = 0. And boom, there we have it, visible points.

*Disclaimer* I actually have no idea what went behind the math derivation of the visibility values.

Now, we could play around with colors and make it look pretty by remapping ranges.

## Acoustics Analysis

You must have noticed the Acoustics component in the Space Analysis package. Good news! The approach is exactly the same as View Analysis. This time, instead of View Field and Visibility Grid, simply use Sound Field and Audibility Grid as a direct substitute instead.

*Again, I have little idea of what went behind the math derivation of the sound values, though I did study a little acoustics. I’d probably have to spend some time cracking it if I find any good use cases.

I hope this guide has helped you to get started on using the package to make cool stuff yourself!! You’ll probably have lots of fun just like I did!! Do share with me interesting use cases if you’d find or think of any, I’d love to hear from you.

1. Cal