Hello PyReviter,
i want to update my PathOfTravel… i already did a dynamo script an it works well, BUT with python i have trouble…
# PythonCode
__title__ = "PathOfTravelUpdate"
__author__ = "Andreas Draxl"
__version__ = "1.0"
__doc__ = "Version = 1.1"
#Date = "25.01.2022"
import os
from pyrevit import forms
from Autodesk.Revit.DB import *
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System")
from System.Collections.Generic import List
from System.Windows.Controls import ComboBoxItem
import wpf
PATH_SCRIPT = os.path.dirname(__file__)
uidoc = __revit__.ActiveUIDocument
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
def update_paths_of_travel(doc):
paths = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PathOfTravelLines)
success = []
for path in paths:
try:
path.Update()
success.append(True)
except: success.append(False)
return (success)
doc = DocumentManager.Instance.CurrentDBDocument
canceled = IN[0]
if canceled is True:
output = [False]
else:
transaction = Transaction(doc, "Bewegungspfadlinien aktualisieren")
transaction.Start()
output = update_paths_of_travel(doc)
transaction.Commit()
print ("PathOfTravels are updated")
Do i have errors in my template? how i have to modify my script
KR
Andreas