Path of Travel and its Schedule

This post is about creating Path of Travel (a new feature introduced in 2020) and its travelled paths Schedule by using Revit Dynamo Application. To cover in a depth, post is presented into two sections:

  1. Creating Path of Travel and its Schedule with Dynamo OOTB nodes
  2. Creating Path of Travel with IronPython
PathOfTravel and Schedule Demo

The demo is to create evacuation plan for this floor plan as shown in figure 1.0. And we would like to know what is the shortest route, what is the distance and how long it will take to the Staircase(emergency exit) from each of the room. (You can download this demo Revit-2020 file from here.)

figure 1.0

Part One

So, let’s start our first part by launching dynamo in Revit 2020. The first step is to filter out the rooms by its Name which are the Staircase Room and the rest of the rooms as shown in figure 1.1.

figure 1.1

After getting the two filtered list, we are going to create PathofTravel by providing a Floorplan, rooms’ start(s) and end point(s) from Room.Location node, and a boolean value as the arguments for PathOfTravel.ByFloorPlanPoints node from dynamo node library. (figure 1.2)

figure 1.2

Now, we have got our paths of travel from the staircase to each of the rooms (figure 1.3). Additionally, you can add more obstacles from the Revit User Interface > Analysis tab > Route Analysis Setting and run the script again. (figure 1.4)

figure 1.3
figure 1.4

The next step is to create a PathOfTravel schedule with ScheduleView.CreateSchedule node from dynamo library. Provide the first argument, PathOfTravel Category from collecting its element, Name and Schedule Type as second and third arugments respectively. To add the schedule fields, we can query schedulable fields from the created schedule with ScheduleView.SchedulableFields node. Collect the items from the schedulable fields list by indexing and add to the created schedule by using ScheduleView.AddFields node. (figure 1.5)

figure 1.5

After the script execution, we will be seeing the Travelled Path Schedule as shown in figure 1.6.

figure 1.6

This is the end of our first part and you can download the complete script from here.

PathOfTravel & Schedule Script

Part Two

We can start our part two by deleting Path Of Travel (blue group) and Path Of Travel Schedule (yellow group) from the script as the demo below.

Path Of Travel_IronPython Demo

Import RevitAPI, RevitServices and from RevitDB Analysis namespace import PathOfTravel class. And import the DocumentManager and TransactionManager from RevitServices as usual. We are going to need one more class which includes dynamo type conversion methods, GeometryConversion.

#dynamo version 2.3.0
import clr
# import path of travel
from Autodesk.Revit.DB.Analysis import PathOfTravel
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import Revit
# Import geometry conversion extension methods

PathOfTravel Class in 2020

PathOfTravel Class is only available in Revit API 2020 version. It has quite a number of ways to create the paths. For this demo,we are going to use CreateMapped method, the third one from the method list below, which is the most appropriate to use and similar to PathOfTravel.ByFloorPlanPoints dynamo node from part one.

PathOfTravel Create methods

CreateMapped has three arguments/parameters ; a view, a list of point(s)(startpoint) and a list of point(s) (endpoint). But you may notice the type of points require are XYZ which is a Revit type point. So, we have to convert Dynamo type room location points into XYZ Revit type by using ToXyz() method from Revit.GeometryConversion namespace. (Dynamo to Revit/ Revit to Dynamo type conversion methods include in this namespace).

PathOfTravel.CreateMapped Method
# view input
view = UnwrapElement(IN[0])
# if not a list make a list
startpts = IN[1] if isinstance(IN[1],list) else [IN[1]]
# make dyn point to revit xyz point
startpts = [p.ToXyz() for p in startpts]
# make xyz
endpts = [IN[2][0].ToXyz()]
# current document 
doc = DocumentManager.Instance.CurrentDBDocument
# transaction start
# create path of travel
paths = PathOfTravel.CreateMapped(view,startpts, endpts)
# transaction end
# output paths
OUT = paths

Well, this is the end of part two, complete source code you can download here. Cheers!

PathOfTravel – Part Two

Revit API screenshot used from .


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.