Point at grid intersection

Hi Pyrevit Human beings,


How often in the later stages of a project do you realize that someone moves by mistake slightly on or many grid? I might argue that I should pin it … well not even this prevents the user from moving it.


I’m considering saving the intersection locations (as points) of those grids to a CSV file. This way, I can compare them to identify any changes and pinpoint at least two grids that have been relocated.


there is any representation of a point in Pyrevit like in Dynamo? if yes would you please point me on that?
if not how would you face this challenge :slight_smile:

TY for your time :slight_smile:

I passed your question on to chat GPT. Here’s it’s suggestion:

To address this challenge using Python and the Revit API, you can follow these general steps:

  1. Accessing Grids:

    • Use the Revit API to access the grid elements in your project.
  2. Extracting Grid Information:

    • Retrieve the necessary information from each grid, such as its location (intersection points).
  3. Storing Data:

    • Save the grid information (intersection points) into a data structure, like a list or dictionary.
  4. Comparing Changes:

    • During subsequent runs, compare the current grid information with the previously stored data to identify any changes.
  5. Detecting Relocations:

    • Pinning grids might not prevent movement, but you can use the API to detect changes in grid locations. If the stored points differ from the current ones, you’ve detected a relocation.
  6. Logging Changes:

    • Log or output the identified changes, specifying which grids have been relocated.

Here’s a basic example using RevitPythonShell:

import csv
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory

# Step 1: Accessing Grids
grid_category = BuiltInCategory.OST_Grids
grid_collector = FilteredElementCollector(doc).OfCategory(grid_category)

# Step 2: Extracting Grid Information
grid_data = []
for grid in grid_collector:
    # Retrieve grid information, including its location
    grid_info = {
        "Name": grid.Name,
        "Location": grid.Curve.GetEndPoint(0).ToString()  # Example, adjust based on your needs

# Step 3: Storing Data
# Save grid_data to a CSV file
csv_path = r'C:\Path\to\your\grid_data.csv'
with open(csv_path, 'w', newline='') as csvfile:
    fieldnames = ["Name", "Location"]
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
    for grid_info in grid_data:

# Now, on subsequent runs, you can read the CSV file, compare and detect changes.

Remember to adapt the code based on your specific needs and project structure. This is a starting point, and you may need to enhance it depending on the complexity of your project and requirements.

i prefer version control for this because it’s accessible by anyone and can be pointed to when coordinating with other teams.

if you use ACC, you could set up a view with elements you want to monitor and will see the changes when comparing versions.

this applies to other solutions as well, e.g. comparing versions of IFC files in a IFC viewer or using other platforms with version control systems like Dalux or Revizto.

nice :slight_smile: one it is actually getting the “GetEndPoint” so the a can retrieve for each element instead of narrowing down things via a selection of intersection points.

I will have a look later on :slight_smile: