Create Revit addin with python

Create Revit addin with python

Anonymous
Not applicable
13,012 Views
3 Replies
Message 1 of 4

Create Revit addin with python

Anonymous
Not applicable

Can I create a Revit addin with Python instead of C#. If the answer is yes then is there any references online or in Autodesk to create a sample addin project with Python, like for example using Visual Studio with python support to create the addin.

0 Likes
Accepted solutions (1)
13,013 Views
3 Replies
Replies (3)
Message 2 of 4

recepagah12
Advocate
Advocate
Accepted solution

You can do almost everything with python what you can in C#. But not like in visual studio, there is Revit add-in

pyRevit. It converts your python code to C# and creates a Revit Add-in. And it is easier than C# for beginners.

It has good documentation, good samples, and tutorials. You can start quickly develop cool tools for Revit. This tool does and creates many things for you. 

 

Here are the starting resources and samples:

pyRevit Blog

pyRevit Github Page

pyRevit Youtube Tutorials

pyRevit Mep Tab

 

Have Fun.

If this is helpful, please Accept as Solution

 

 

Message 3 of 4

stever66
Advisor
Advisor

Newer versions of Visual Studio (including 2015 and 2017) both include Python.   Also, newer versions of the Revit Sharp Macro Editor also include Python (including Revit 2017 and newer.  I didn't check 2016.)

 

These are as simple as selecting Python instead of C# when starting an add-in, and work just like a regular C# add-in.  In fact, once the project is built, I don't believe there is any difference between code wrote in C# and code wrote in Python.   So unless someone is using an older version of Revit, I don't see any need for pyRevit.  And developing a Python add-in should be just as straight forward as doing a C# add-in.

 

In fact, there is even a tool in the Macro Editor (and probably also in VS) that converts C#  code to Revit and vice versa.  Very helpful since most examples are in C#.

 

Message 4 of 4

recepagah12
Advocate
Advocate

I know Visual Studio and Revit sharp developer supports python (Actually, Iron Python, because of Revit use Net Environment) but these are not native and not user-friendly. pyRevit is really easy and user-friendly. Creating beginner or medium level samples much easier than C#. As an example for creating a tab, panel button; You just change the extension of the file and pyRevit environment can understand and convert to native C#. I assumed who ask the question is a beginner and can easily adapt. 

 

Also, this C# to python converters are not helpful for big projects, a program like a Revit needs healthy and efficient code. Because Revit includes enormous amount of data and processes this with wrong code is not good. 

 

Of course, both ways is good pyRevit or Visual Studio but start to end, pyRevit is better.

 

Have fun.