What Programming Language ?

What Programming Language ?

jrrdm
Explorer Explorer
11,955 Views
8 Replies
Message 1 of 9

What Programming Language ?

jrrdm
Explorer
Explorer

Hi

 

I just finished a Python Workshop. I haven been seeing options like Dynamo, PyRevit and Revit Python Shell. In order to create my own Routines and eventually my own Add ins? What Programming Language would be the Best? What does the Macro function in Revit? Can I create also Automatic Tasks with any Programming Language there ? 

I will really appreciate an Answer since I want to define my Path

 

Thanks in Advance

Accepted solutions (3)
11,956 Views
8 Replies
Replies (8)
Message 2 of 9

jeremytammik
Autodesk
Autodesk
Accepted solution
Message 3 of 9

stever66
Advisor
Advisor
Accepted solution

I'd suggest C#.  Its what all the cool kids are using😊

 

If you look at the Revit API documentation, they include examples in both C# and Visual Basic.  Sorry, no examples for Python users.

 

If you look at the questions on this site, I think most people use C#, and some type of Python would be second most popular.  So in terms of getting examples and questions answered (very important for a Revit API programmer) C# seems to be the clear winner.

 

The Visual Studio IDE or Sharp Develop( the Macro IDE) will do any of the above in addition to something called F which I've never heard of anyone using.   Either IDE will even convert your code or any examples from one language to another, although I'm not sure if that will work 100% of the time.

 

And some people use either the Revit Python Shell, or PyRevit addins to write python addins.   I'm not sure why these are necessary since more recent versions of Visual Studio and Sharp Develop both include python.   Maybe it has something to do with the different flavors of python (Iron Python for example)?

 

I started with Python but I always had trouble with the line returns not compiling correctly.  Maybe its the way I would copy and past examples from the internet, but I always wound up deleting and retyping the same code just to get it to compile.

 

Some say C# is more difficult to understand, but to me, the main difference is that you just have to declare the variable types.  

 

Message 4 of 9

jrrdm
Explorer
Explorer

thank you Very Much for the Answer !

0 Likes
Message 5 of 9

jrrdm
Explorer
Explorer

Hahahha the Cool Kids sounds Cool. Thank You for the Answer ! I guess you guys won a new C# student 👨🏽‍🎓 😊

Message 6 of 9

stever66
Advisor
Advisor
Accepted solution

This free pdf book is one possible place to start:

https://www.robmiles.com/c-yellow-book/

 

it starts off a little slow for the first 10 pages or so, but then it covers a lot of stuff in 200 pages.  In fact, it covers so much so fast, I can see why some people think c# is so hard.   It’s probably best to read this along with a more basic book, and if you are not a professional programmer, don’t worry if you don’t understand everything the first time through this book.  (I’m not and I don’t).

I’ve never even finished it yet, but I’ve still gotten a lot from it.

 

 

Message 7 of 9

jeremytammik
Autodesk
Autodesk

Thank you for the great hint! I like that book and promoted it to the blog as well:

 

https://thebuildingcoder.typepad.com/blog/2020/01/c-book-chinese-revit-api-tutorial-and-insight.html...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 8 of 9

jeroen.van.halderen
Advocate
Advocate

Hi there,

 

I'm fairly new to programming with the Revit API, could someone please explain what the difference is between the different Revit API languages (C#, C++ and VB.NET). @jeremytammik maybe?

From what I understand C++ is a lot faster than the other languages but I read somewhere else that all code for Revit plugins is translated into an intermediate language to communicate with Revit, so the speed issue shouldn't really matter?

 

Any clarification would be greatly appreciated!

Thank you!

 

Kind regards,

 

Jeroen van Halderen

Message 9 of 9

jeremy_tammik
Alumni
Alumni

There is no Revit API programming language.

 

There is only a programming environment, which is .NET.

 

.NET supports many programming languages, and they are all more or less equivalent.

 

C++ might be faster for pure heavy-duty number crunching, but the interaction with the Revit API will be virtually identical and equally performant in all of these languages.

  

https://thebuildingcoder.typepad.com/blog/2015/10/rtc-classes-and-getting-started-with-revit-macros....

 

https://thebuildingcoder.typepad.com/blog/2016/07/self-organising-architecture-and-voxel-based-energ...

  

  • C# vs Python?
    • The APIs are equivalent, all code is compiled to Intermediate Language (IL) that can be decompiled again using Reflector and the .NET Reflection library, e.g. for reverse engineering.

  

https://thebuildingcoder.typepad.com/blog/2018/06/extensible-storage-and-renaming-a-family-in-a-proj...

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open