Travel Distance Visualisation

The dynamo script places instances of a hexagonal detail item in a grid and colours them based on their distances from destination points (detail family also provided).

How to use:

  1. Select the surface face of a floor representing the circulation area. This is best done in a 3D view
  2. Place the “DET_Destination Point” families in a 2D plan view, temporarily isolate them, and select them as inputs for the node.
  3. Specify the maximum travel distance. Any grids beyond this distance will be shown in the third colour (current red)
  4. Before running the script, ensure that the “DET_Hexagon” family is loaded into the project
  5. Run the script with the 2D plan as your active view.

Result:

Script:

Hexagon Colour Map_Distance To Given Points.dyn (86.1 KB)

Families:

DET_Hexagon.rfa (372 KB)

DET_Destination Point.rfa (372 KB)

The script was formulated as a quick alternative to the built-in Revit “Path of Travel” node, providing an overall visualisation which can double as intuitive diagrams in presentation decks.

It utilised the Dijkstra algorithm routing through the centre points of a hexagonal grid, with the tolerance set to allow the path-finding to skip over one adjacent hexagon for more efficient travel. The attached PDF illustrates the tolerance setting and highlights some use-cases.

Travel Distance Visualisation.pdf (520.8 KB)

The script was developed in Dynamo v.3.6.2 and tested in Revit 2026.4. It utilises CPython3 code which was written by AI.

Have you checked out VASA? Does this in 3D as well as additional analysis.

A few suggestions:

  • For the Dijkstra algorithm, you can use the SciPy library (scipy.sparse.csr_matrix and scipy.sparse.csgraph.dijkstra)
  • For colors, you can use the Analysis Visualization Framework (AVF, Autodesk.Revit.DB.Analysis) directly on the floor face references

One of my frustrations with using LLMs for coding, specially in the Dynamo space is that the ability to use the Revit or DesignScript API is limited to the publicly available code.

Time and time again I see LLMs create helper functions, repetitive testing or wrappers for built-in API methods because the ‘knowledge’ of the API is so thin.

I assist my agent (when I use one) by utilising the Autodesk Help MCP and an extensive Revit and Dynamo API stub library for my IDE Visual Studio Code. This allows for discovery of methods that are not documented on the web as DesignScript is closed source. For example this is an excerpt from the python stub for the DesignScript Geometry Polygon class. Note how the Center() method is built in. No need for a helper.

class Polygon:
    PlaneDeviation: float
    """Returns maximum deviation from average plane of polygon."""
    Points: Array[Point]
    """Returns all the segment start / end points."""
    @staticmethod
    def ByPoints(points: IEnumerable[Point]) -> Polygon: ...
    def Center(self) -> Point:
        """Returns average point of corners of polygon"""
        ...
    def ContainmentTest(self, point: Point) -> bool:
        """
        Returns whether an input point is contained within the polygon...

Further little minor annoyances like creating a 3d point Point.ByCoordinates(px, py, z_level) when a 2d overload exists.

Finally it appears that the pathfinding is not checking for blocked areas or crossing blocked areas when calculating the distances

Cyril is correct that SciPy library, which is already available in Dynamo python (PythonNet3 and CPython3 engines), can be for more efficient as it uses compiled code and has built in algorithms for creating coordinate grids and shortest paths.

Check out the following page Red Blog Games - Hexagons it is an absolute goldmine of info on how to work with hex grids and pathfinding

Edit: You could also look at multi-source BFS [Breadth First Search] using a mask for non-traversable areas using Numpy

Interesting concept. I think I’ll take a swing at a pure python version for pyRevit. And get rid of the need for family dependency. Think is would be more flexible if it worked with rooms rather than floors.

hi @aaronrumple Just curious…wouldn’t there be the same challenges in pyrevit? (P.S. I’ve never really actually tried pyrevit.) ??? or ?

Yes - but that’s my preferred toolset for something of this scale. pyRevit just makes deployment and documentation (help files) simpler to push out to the office. And generally much more robust error checking and UI/UX for the end user. Making aa prrogram that does X is one thing. Dealing with people using the program is another.

yeah always :wink:

Here’s a working version in pyRevit (all python)
Basically the same as the dynamo version with a few tweaks for tetsting.
Select destination points > Run script > Select floor face
Changed to accept all valid units as input.

Github PyPiPie-TravelDistanceMap

yeah cheers :wink: could you show the codes here. for us there dont know pyrevit without github download…here is i for Dynamo. Forum.. :wink: and i am sure we can do the same in dynamo…maybe just another way :wink:

This is a demo of the VASA based solution I mentioned before, processing all portions of the traversable space (including stairs) across the entire project.

Sadly I can’t distribute the graph, but it’s pretty basic VASA use based on the tools therein.

Thanks. Exactly what I was thinking, but throwing a few more bells and whistles to include fire separations, rooms to include/exclude etc, etc…

This is kind of doing that, treating the egress stairs as the fire separation points.

The key piece (and why this feels slow on the first run) is not just utilizing the room geometry, as everything else is what gets you ‘traversable’ space (i.e. you can’t walk directly under the stairs without sufficient headroom); where you can’t fit between an opening, etc.). So you have to extract geometry of all classes which can obstruct egress which can take a bit. From there the voxelization should go pretty smoothly.