Path of travel, how to visualisize in python

Hello,

i want to compare path of travels from view to view! project leaders are suspecting that the paths ar not identical, and i want to check this…

my code tragigly shows nothing, only empty lists

i want also a geometry of my path, how ?

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

activeView = FilteredElementCollector(doc, doc.ActiveView.Id)
paths = activeView.OfClass(Analysis.PathOfTravel).ToElements()


times, speeds, lvls, views, fromRoom, toRoom = [],[],[],[],[],[]


for r in paths:
	time = r.get_Parameter(BuiltInParameter.PATH_OF_TRAVEL_TIME).AsDouble()
	times.append(time)
	lvl = r.get_Parameter(BuiltInParameter.PATH_OF_TRAVEL_LEVEL_NAME).AsString()
	lvls.append(lvl)
	view = r.get_Parameter(BuiltInParameter.PATH_OF_TRAVEL_VIEW_NAME).AsString()
	views.append(view)
	startLoc = r.get_Parameter(BuiltInParameter.PATH_OF_TRAVEL_FROM_ROOM).AsString()
	fromRoom.append(startLoc)
	endLoc = r.get_Parameter(BuiltInParameter.PATH_OF_TRAVEL_TO_ROOM).AsString()
	toRoom.append(endLoc)

OUT = activeView, paths, times, lvls, views, fromRoom, toRoom


KR
Andreas

If I recall the error on the Element.Geometry method has to do with the arrowhead. As such you can call for everything except the same item at the same index of the list.

To do so via Python would be the same as any other element: elem.get_Geometry(Options()) if memory and capitalization serve.

1 Like