Python Editor Configurations

In the video tutorials, I use the Atom editor to write code . You can download it from the official website link.

Go to File -> Settings -> Packages. Here we can download any package we need. In the search bar type the following names:

1. Script - It is main package that allows to work with the code.

2. autocomplete-python - autocompletes the code you type, you can speed up the work several times. It has standart python … read more

How to use Revit IUpdater

An interface named IUpdater is another DMU(Dynamic Model Update) methode. It is more flexible then Event Hadler, because we are more free is difining an event triger. The good thing is that we can trigger IUpdater when we make any element modification either by creating a new element or by modifying an existing geometry. Download a sample code from my GitHub page.

Read the previous article about Event Handlers where i explained how the __selfinit__  and togglestate functions work. The plan is to create an instance of the IUpdater class, register the updater, and set its triger.

First we need all neccessary imports. here they are:

# -*- coding: UTF-8 -*-
import os
from pyrevit import framework
from pyrevit import script
from pyrevit.framework import AppDomain
import Autodesk
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB import *
import System
from System import Guid

This is a standart body of the IUpdater class… read more

Revit Event Handler

It's time for advanced stuffs. Revit has many events that we can catch, such as closing / opening a document, activating a view, and so on. We can find a list of events on revitapidocks:

UIApplication: Link
ControlledApplication: Link

So we can tell revit to do something, when the event raises, the script should run in the background. Let's … read more

Dynamo Python to PyRevit

As I said before, the first thing I did was translate the Dynamo scripts into pyrevit. So here are main differences:

Here is a standart head of DYNAMO python

# -*- coding: UTF-8 -*-
import clr     
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#open a transaction
#Do stuff

First we import main database to use commands w… read more

PyRevit + Dynamo Scripts

When i installed the pyrevit, the first thing i did was translate Dynamo Scripts to PyRevit Python. But if you don't have time or just don't want to, pyrevit gives you the ability to run dynamo scripts. As for example i will take Test Scrypt from pyrevitDevTools. Here what we have:


The bundle.yaml file is not necessary in our case. To run a dynamo scrip… read more

1 2 > >>