Add Date And Time

In Model element who did and date and time, how to create using pyrevit?

image

1 Like

@Thennarasu ,

f.e. i use it for the runtime…

import time
doc = __revit__.ActiveUIDocument.Document

# ╦  ╦╔═╗╦═╗╦╔═╗╔╗ ╦  ╔═╗╔═╗
# ╚╗╔╝╠═╣╠╦╝║╠═╣╠╩╗║  ║╣ ╚═╗
#  ╚╝ ╩ ╩╩╚═╩╩ ╩╚═╝╩═╝╚═╝╚═╝ VARIABLES
#====================================================================================================


time_start = time.time()

# 1️⃣ Get All Doors
doors = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements()
filter_tuerOeffnung = [i for i in doors if i.get_Parameter(BuiltInParameter.ELEM_FAMILY_PARAM)
.AsValueString() == "Tuer_Oeffnung"]

print('Es gibt {} Türöffnungen'.format(len(filter_tuerOeffnung)))

# 2️⃣ Get ElementLocationPoints
locationPoints =[i.Location.Point for i in filter_tuerOeffnung]

for p in locationPoints:
    new_point = XYZ(p.X,p.Y,p.Z)
    print(new_point)

# 4️⃣ Show Results

time_end = time.time()
duration = time_end - time_start
print("The code took {} seconds to run.".format(duration))
2 Likes

Hello @Thennarasu,

This subject has already been addressed by @Jean-Marc in Date of creation of a Revit element but anyway, here’s an application that shows more or less how it can be applied: Implementing the TrackChangesCloud External Event.

The way I tackled it was by saving a “print screen” of data on a sheet in an Excel file as suggested in the References by @jeremytammik:

  • Data (central point and certain parameters) of model elements of interest
  • Save the name of the sheet with the user name at the moment “-” date

After that, I would be comparing two different saves. It’s a lot easier than using hooks or another sort of complex method which at the moment I’m a complete noob :laughing:.

I hope it helps you :slight_smile:

1 Like