Automating Checks in Navisworks with Python + Visualizing in Power BI

https://github.com/i‑savelev/CollisionCheckNavisworks

Installation

I tried to make the scripts as easy to use as possible, but I still have to install some things).

  1. Install Python from the official website: Download Python | Python.org

  2. Install Visual Studio Code or Pycharm for comfortable work with code files. (Optional. Python files can be launched without installing a code editor – by double-clicking on the file, and specify the name of the Excel table using Notepad)

  3. Download the archive from github, unzip it. Place the prepared Excel file in this archive, or edit the attached one

Uploading files

Uploading files

When you first run any script, the openpyxl library will be installed – it is needed to work with Excel tables.

Initial data

The initial data will require a list of models and a collision matrix in xlsx (Excel) format. The model template is available at the link to GitHub.

The Models tab contains a list of models with a grouping category. It is better to give short names of models, without taking into account the code, etc., but enough to find a specific element in Navisworks. It is forbidden to use a hyphen “-” in the names.

The “Matrix” tab inserts a symmetrical matrix with elements grouped by category. The tolerance is recorded at the intersections of the matrix.

The advantage of this method is that it is not necessary to take into account all models in the original matrix.

Sheets with original data

Sheets with original data

This table must be placed in the same folder with Python scripts. Before running each script, the Excel file must be closed.

In the script code, you must specify the name of the Excel file in the book variable.

Excel file name

Excel file name

Script operation

The script's work is divided into two steps.

First step — forming a list of elements by models. After running CollisionCheck_step1.py, a sheet “Models_Elements” will appear in the Excel file with a list of elements for each model. At this step, you can delete lines with unnecessary elements from the list. For example, for sewer models, delete air ducts, trays, etc. After editing the list, the file must be saved and closed.

Editing the list of model elements

Editing the list of model elements

To reduce the amount of manual adjustments at this step, you can specify a more detailed grouping when creating the collision matrix and model list.

Step two — launch CollisionCheck_step2.py and generate a collision matrix and xml files with checks and search sets. At this step, data is taken from the previously created “Models_Elements” sheet.

As a result of executing the script, the sheets “Matrix_Filling” and “Lists_Filling” are created.

An extended collision matrix with checks for each model appears on the “Matrix_Filling” sheet. The intersections of this matrix are filled with check names and tolerances. On this sheet, you can visually check the correctness of the data filling.

The names of the checks are formed according to the following principle:
[Категория 1 vs Категория 2]-[Модель 1 vs Модель 2][Элемент 1 vs элемент 2]
Example: AR vs KR‑AI_1.1 vs ST_1-Floors vs Walls

This name allows you to further use reports to create dashboards in Power BI.

Extended Collision Matrix

Extended Collision Matrix

The “Lists_Filling” sheet shows the same list of checks, only in the form of a simple table. Here you can make sure that the matrix and the list have the same number of checks. The number of checks may differ if the original matrix is ​​not symmetrical.

Checklist

Checklist

Two xml files are created in the project directory: “Search sets.xml” and “Checks.xml”.

Generated xml files

Generated xml files

These files contain search sets and checks that need to be imported into Navisworks.
Here I will dwell in more detail on the structure of xml files.

Structure of the xml file of checks

Structure of the xml file of checks

Structure of the search set xml file

Structure of the search set xml file

Python script takes data from Excel, transforms it and inserts it into XML element templates.

Import to Navisworks

First you need to import search sets, then checks.

Import to Navisworks

Import to Navisworks

After importing the sets, a folder structure with search sets will appear. All sets are sorted into folders with the model name. Each set contains two conditions by default:

  1. The source file contains the name of the model that was specified in the Models sheet of the Excel spreadsheet.

  2. The object category contains the required category of elements that was specified on the “Matrix” tab of the Excel table.

Structure of Search Sets in Navisworks

Structure of Search Sets in Navisworks

Once imported, checks automatically reference existing search sets

Navisworks Checks

Navisworks Checks

In order to bring the check to mind, it is necessary to manually edit some search sets. Unfortunately, it was not possible to fully automate this process, since the search for the necessary elements in the model is not a linear task. But even in this form, this automation can significantly speed up the process of creating checks.

Once again, a brief algorithm of actions.

  1. Preparing an Excel document using a template: filling in the Models and Matrix sheets

  2. Running CollisionCheck_step1.py

  3. Removing unnecessary rows with elements from the Models_Elements sheet

  4. Running CollisionCheck_step2.py

  5. Importing XML files into Navisworks

Loading reports into Power BI

There is a Power BI dashboard template on GitHub: Collision Report.pbix. This report can be placed anywhere.

To load reports into Power BI, you need to capture a report from Navisworks with the following parameters:

Navisworks report parameters

Navisworks report parameters

Save this report in a separate folder and indicate the date in the name separated by a hyphen “-”.
Example: Report-2024.08.02.xml
In the Power BI file, update the path to the folder with the report: Data Transformation → Configure Data Source → Change Source → Select Folder.
When changing the data source, the matrices may not be displayed correctly – you need to switch the dates in the slices so that the information is updated.

In the future, you can upload reports for other dates to the same folder. After adding a new report to the folder, you need to update the data. After that, new dates will automatically appear in the slices in the dashboard.

The dashboard contains three pages:

  1. Report – here you can view the report for the selected date

  1. Report dynamics – here you can see the difference in the number of collisions between the selected dates.

  1. Graph – this displays the number of collisions by date.

Structure of Search Sets in Navisworks

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *