C# or Python for development

Not Dynamo related question! When it comes to development what language should one learn
C# or Python

Consider a non coding background.

I understand a lot of people here working on python and C# for enhance their way into Automation. So I am seeking guidance from amazing people here

What should i learn if i want to explore my way

C# or Python

1 Like

There are more than a few topics on this forum that already address this question. Most of them do a good job of comparing pros and cons for both. The decision ultimately comes down to the intended outcome, scale, and effort you want to put in.

If you have specific questions on any of these things feel free to ask, otherwise, do a little reading and just start experimenting. You may find interest in one over the other fairly quickly.

6 Likes

Thanks @Nick_Boyts. I have went through them
And i just wanted to explore what people thinking about it in 2024 as most of them were asked in 2022 or so.

Might be someone has better idea or a roadmap to learn it in 2024 as most of us come from a non coding background

As I understand Python is 1st choice of most of us.

Just curious to ask if you could help as we write a script or nodes in dynamo it gives us facilities to select the elements/data/info and allow us to further use it to next node or code

Does C# in visual studio gives that facilities too

I have seen some videos where I only notice a pop up window with information

There really haven’t been any major changes to either language in terms of benefits to specific development types and learning curves. All that information is still valid and true.

You stated that this request isn’t related to Dynamo but that’s the context everybody on this forum is going to take, or at the very least, a BIM related one. It sounds like you still need to do some research on your end to better understand how each of those languages and their typical development process works at a basic level before you can ask about direct comparisons for specific development.

Sure thing

C# is something that Revit handles natively. Python is not. Yes, we have access to python in a variety of ways, (Dynamo, pyRevit, RevitPythonShell, etc). But at the end of the day, you are primarily using third party tools and workarounds to make python work.

I have used both, but I switched to C# for Rhythm in 2017 to prepare for the file format change (XML to JSON / 1.x to 2.x), and have been glad I did.

Learning C# has enabled me to build Revit plugins, View Extensions and build my Dynamo packages in ways that span a lot of versions. As of right now that is Revit 2020-2025.

Also, using a real IDE is awesome. I cover some of that here:


If you are interested in Python should you learn it? Absolutely!

However, if you are asking what would be worth looking into, that is my 2 cents

2 Likes

All great advice here and I agree with it all. It all depends on what you need to do with Revit ultimately. If it’s just everyday use for a small team then you might find Python is manageable for a while. If you want to scale your tools and eventually develop proper addins at some point C# will become needed.

If you have a noncoding background or are very new to nonvisual code I personally think python is a better introductory language as its syntax is forgiving (if a little too much), but it does not teach some core concepts that are important to C# such as declaring types of data.

A saying I quote a lot in programming is ‘don’t boil the ocean’. Basically, take it one step at a time, plan first and do second. It is impossible to learn everything, so focus on what you need at a given moment in time. Noone knows the entirety of the Revit API (well, maybe thebuildingcoder), we instead learn enough that we can navigate the docs and understand ita concepts/principles at a fundamental level.

I found the harvard CS50 course (free) really helped me get my head around computer science as well as grasp what C and its variants were about, as well as better understand the handholding and limitations of Python and a deeper appreciation/enthusiasm for the broader paradigm of programming. Maybe give that a crack if C# is your endgame at some point. They begin in binary/ascii, then teach you about C (a big focus on memory and pointers which C# does a lot of for you, but still lots of relevant syntax), then Python and finally some web based programming.

I also have a miniseries on Python fudamentals here. It covers what you need for most workflows, with some things I’d add if I had time missing (classes, continue/pass, catching exceptions):

2 Likes

I learned Dynamo first then found it very limiting so learned Python as it plugs into Dynamo very neatly. Python was easy to learn and there are loads and loads of free courses.

However I soon found this a bit limiting as Dynamo is very slow.

So I’m trying to learn C# but I’m finding it super boring. Learning Python first has been helpful but also a hindrance.
For example, I had no idea what a double or a string was a few years ago and no clue about loops, but due to learning Python I know the lingo (same in C# pretty much) and the basic concepts (how various logic works). The problem is C# is really verbose and, unlike Python, is very compartmentalised (which is a good thing but confusing).

Python you can start at the beginning and write code…
C# you can’t quite do this. You have to think differently.

C# is much, much, much faster though AND having a little button on your ribbon in Revit is much nicer than having to open a different programme…

If I could go back 5 years would I do it this way?
Honestly I don’t know.

I should mention I’m making add-ins not zero touch nodes with C#.

I kinda like Dynamo and Python for custom nodes as they’re easy to tweak using Dynamo.

#ReallyNotHelpful :rofl:

3 Likes

C# and C are teaching me that a decent chunk of programming is necessarily boring/fiddly @Alien , so I can relate to that statement. To some degree I felt the same about dynamo and Python at first too though (e.g. when the realities of list management and levels hit me in the face), so its probably relative. Python certainly does take out a lot of this, albeit with training wheels and a slower bike.

1 Like

Getting into coding will be easier with some context.

So if you want to learn the basics of coding: nodes in Dynamo, then design script, then Python, finally C#. My reasoning is that you’ll get a bit more foundational knowledge in each step which helps to get into the next step, and you can have useful tools at each stop along the way as you learn.

3 Likes

Demostifying the abstraction, if you will. When i began learning Revit API there was a lot of aha moments when I learnt how nodes were working under the hood.

3 Likes

Helps to take a ‘basic languages’ class before the starting on functional tool. So before you try and automate Revit with nodes do the Dynamo primer. Before you start diving deep into design script check out the learning resources for design script. Before starting on Python do a free basic Python course (~4 hours should do it) on your phone or online. Before getting into C# do a free basic C# class on your phone or online.

Look before you leap and learn as you go. :slight_smile:

thanks all for your valuable inputs @john_pierson @GavinCrump @jacob.small @Alien

that is what i was expecting form a active forum a health discussion and a guided insight/ roadmap.

@GavinCrump I am following you from last 6 month and actively watching/practing Python 101 and its implimentation in you dynamo day to day videos, they are quite impressive i would say.

I believe to start with dynamo developement with Python or Revit api C# we only need basic of coding such as data type, variable initialization, comparision, loop, defination and some basic stuff. which i have learned through a lot of resource both in Python and C# as of now.

what i am missing is a logic to implement what i have learned which is something will come with practice and expourser. What I have notice so far is when i try to write something in VS (visiual studio IDE)for C# it gives us a lot of suggestion/information what we should do or go with and REVITAPI referece is also quite handy in VS.

on the other hand if i write something in python in dynamo python scripting it will not suggest/inform what we need to do or who it is suppose to work.

is there any such thing for python also which help or guide a beginner like me who dont have much logic and approach to do a certain task.

just to get a better guided path from you guys (who already went through this path), what ever i have achived/made in dyanmo using inbuilt nodes/custom node, Same I want to achieve using Python or C# (this way i believe i will not what i am tring to achieve and what is the way/path is to achieve the output) which will help me to build a logic as i did to build the script in dynamo.

I hope i am able to articulate correctly what I am trying and hopefully a lot of beginner like me out here.

Thanks everyone for giving your insight, much appreciated :slight_smile:

1 Like

The best resources for me were inside custom packages of other developer (I pretend lie that some of my own custom nodes in Crumple draw quite heavily on other ideas in some cases).

I’d suggest looking into Clockwork, Genius Loci, Crumple and Springnnodes for Python and @john_pierson OS’s his own package’s nodes over on github (some Python, mostly zero touch) if you’re looking for good C# references. For general C#/apps I recommend torsion tools by @SeanP. pyRevit also has open scripts for all its tools, just hold alt and click on one to be taken to it. Some of pyRevit is abstracted though (uses its own code/libraries), so wont all be applicable in Dynamo, although most of the code can be chased back through pyRevit’s libraries also. Dynamo Python primer is nice too.

Part of making this jump is recognizing you are no longer a ‘beginner’, just on a step in your development. Whist there is support out there and places like this it can be beneficial to get in the habit of being uncomfortable and confused at times and use it to egg on the motivation to solve issues, at least in my experience.

There is also a lot of hidden gems hiding at the back of the RevitAPIdocs in code that not many people know about:

@c.poupin is a total Python wizard and has heaps of great code examples on their github here also. I have learnt and been helped a lot by them here and via this resource, particularly in regards to developing a coding ‘style’, which I encourage doing early (lest you endlessly have to refactor your early coding attempts like me… if you have no preference try out google’s guide…):

Hopefully that helps. More resources than you can shake yer boots at!

4 Likes

than you so much @GavinCrump , you are indeed helping us in all the platform.
you are such a motivation, really thanks

I will go through all these resource slowly and steadly :slight_smile: :heart:

1 Like

So as I woke up this morning I thought about this (very, very sad I know)…
And I decided that the route I took was one I’d take again.
Why? Cos learning Python gives you instant access to more powerful Dynamo… which is instant access to so much in Revit.

If I’d just jumped straight into C# it’d have taken far longer to do the stuff I could do in a few weeks with Python in Dynamo I think.

4 Likes

Thanks for the tag @GavinCrump, the best AEC resource I found were as follows.

The Building Coder by Jeremy Tammik:
https://thebuildingcoder.typepad.com/

And the Revit API forums:

I took started in Dynamo, then to Python, and eventually to C# where I e been primarily now for about 5 years. Granted I had some C# and VB .net in my past here or there.

Also I’d be remiss if I didn’t share what finally got me over the hump by @Thomas_Mahon:

3 Likes

That was the first thing I tried a few years ago but I gave up when I couldn’t get it to work… I think C# is pretty demoralising to start with. Python is far easier to get into.

i would strongly advocate for diving into C#. Dynamo/DesignScript’s weird pseudo-functional and associative paradigms make it a very poor language to invest a lot of time into (this was probably the biggest mistake i made. i liked that i could do things -now-, but there are a lot of syntactic things that cause so many problems that are better addressed in other languages that i sort of wish i had made myself switch sooner.)

a lot of it comes down to tooling and debugging capability. even python in dynamo is rough because of how poor the intellisense is compared to a conventional IDE. as you work on more complex things in Dynamo/DesignScript, you feel the pains more, especially not being able to debug through functions or shudder custom nodes.

don’t sleep on the macro editor. I know i wish i had used it sooner, but for some reason i brushed it off as ‘not the right thing’. It’s not as good of a C# development environment as Visual Studio, but you can still get in and do things pretty quickly.

i think a challenge that comes up in discussions about Dynamo is that it wasn’t designed as a multi-purpose scripting language, but the community definitely tried to make it into one (i know i did). DS does excel in the original context of rapidly generating geometry, and I think the protogeometry library is really nice to use.

1 Like

As a people, who has worked for many years and used everything, I advise you to invest plenty of time into understanding exactly what you need, depending on your specific requirements and desired outcomes. Then, choose a language you feel comfortable with and start with it. That’s all there is to it.

3 Likes