Revit API Forum
Welcome to Autodeskโ€™s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 

Books or other sources to learn Python to be used in Revit/dynamo

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
HVAC-Novice
4017 Views, 17 Replies

Books or other sources to learn Python to be used in Revit/dynamo

I'm starting to learn Python (and Dynamo) and encounter the problem of how to learn to use it for my actual needs in Revit. I got a whole bunch of Python books from the library. One problem is the books are either focused on examples to make simple videogames, or are way to advanced (and also not based on examples one would use in Revit). I have to admit, some children-oriented books were easier to understand ๐Ÿ™‚

 

There is a "Dynamo for Revit: Python Scripting"   book, but that is not actually available. Are there actually books or sources that would teach Python on examples one would use for Revit/dynamo? I'm learning best on an example i actually use.

 

I also found there is a Python shell for Revit from github, but none for Revit 2021. Is there something similar? I saw some videos of how one can do some useful things in Revit. 

 

 

Revit version: R2024.2.1
17 REPLIES 17
Message 2 of 18
RPTHOMAS108
in reply to: HVAC-Novice

The best and most up to date sources tend to be online these days. The second source is for RPS as you mentioned but would probably be my starting point for something specific to Revit.

 

IntroductoryBooks - Python Wiki

Introduction ยท Scripting Autodesk Revit with RevitPythonShell (gitbooks.io)

 

People seem really passionate Python don't they. I'm no expert on this so maybe people have good book suggestions but I prefer online for all aspects of learning generally.

Message 3 of 18
Anonymous
in reply to: HVAC-Novice

The โ€œbookโ€ you are referring to is actually a video tutorial by Jeremy Graham on LinkedIn. Probably one of the best ways to get started.

Message 4 of 18

Hey,

 

To start with Python and Dynamo, I think this Autodesk University Class by Gui Talarico is a great resource:

https://www.autodesk.com/autodesk-university/class/Untangling-Python-Crash-Course-Dynamos-Python-Nod...

 

If you have some basis but you donยดt know how to move on, a good way to learn Python applying to Dynamo is to download 3rd party packages ( Archilab, Clockwork, Lunchbox, Rhythm, Bimorph, Spring nodes, etc)  and read the code that the nodes contain.  You will see really good implementations and good practices. You will be able to see how others think about problems and write the solutions.

 

Have a good understanding of Object-oriented programming will help you on this and is a key aspect to understand how to use the Revit API with Python.

 

About the resources, as is mentioned in the previous posts, I would take a look on Linkedin learning and also on  https://thinkparametric.com/ . There are good courses there.

 

Good luck!

 

Github:
https://github.com/franpossetto
Message 5 of 18
jeremy_tammik
in reply to: HVAC-Novice

RevitPythonShell for Revit 2020 works just fine in Revit 2021 as well:

  

https://github.com/architecture-building-systems/revitpythonshell/issues/106

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 6 of 18
HVAC-Novice
in reply to: HVAC-Novice

Thanks all. I'll digest what was offered. 

So far the "Automate the Boring Stuff with Python" book seems to be the best i could find in the library. So I guess I will look more and start to dig deeper when I create some dynamo programs. 

 

I won't be able to install the Python shell in Revit. Since that is free, they don't really provide the security certificates our IT requires to allow installation. My hope is Revit will include it at some point (since Autodesk is already approved by IT). Until then I have to limit myself to the Python in dynamo nodes. 

Revit version: R2024.2.1
Message 7 of 18
joshua.lumley
in reply to: HVAC-Novice

The vast majority API support examples are in c# but Python is sexy.

Message 8 of 18
jeremy_tammik
in reply to: HVAC-Novice

If you have Revit installed, Python is included: it is supported by the built-in Revit macro IDE (integrated development environment).

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 9 of 18
HVAC-Novice
in reply to: jeremy_tammik

You mean the Macromanager? 

I haven't done anything with that yet. So if that does what the Pythonshell does, I use what i already have. 

 

Macromanager.PNG

Revit version: R2024.2.1
Message 10 of 18
jeremy_tammik
in reply to: HVAC-Novice

The macro manager does not quite do the same thing as RPS.

 

RPS provides a REPL, read-evaluate-print loop:

 

https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop

 

That enables you to interactively program something, line by line, and execute each line as you type it. 

 

The macro environment enables you to create and execute macros. That means that you have to complete an entire macro and compile it before it can be executed.

 

In any case, the simplest way forward for you would be to use what you have and work through a Revit macro tutorial first of all.

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 11 of 18
HVAC-Novice
in reply to: jeremy_tammik

Thanks for the advice. I'll look into that. 

 

I have a (growing) list of features or solutions I need in Revit and will try to work on solutions. Some will require some general Revit trickery, some dynamo, some macros etc. that way i will learn to sue the tools inc. Python. 

Revit version: R2024.2.1
Message 12 of 18

try Kevin Himmelreich book https://www.amazon.com/M%C3%A1s-all%C3%A1-Dynamo-Manual-Spanish/dp/B08P1FCBZY

even though it is in spanish, you can understand most of the things written.

bunch of examples and pretty much everything about the revit api is covered in python

Message 13 of 18

Thank. No , I don't speak (or read) Spanish. The amazon preview only showed 3 pages that didn't actually show any content. So I couldn't judge if the book would be useful without words.

 

It shows the cover, one that i assume says "this page is intended to be blank" and a page that tells the ISBN number of the book. Whoever decided on which page to shows really wants us to buy the book to learn the secret ๐Ÿ™‚

Revit version: R2024.2.1
Message 14 of 18

It is a very good book.
here are 3 pictures I took at random (no blank pages though ๐Ÿ™‚ )
https://photos.app.goo.gl/XspSn3sKM7ah8iL88
Message 15 of 18

Thanks for posting. I fear I would miss a lot by not being able to read the text. 

 

My hope is they translate that at some point. With the lack of books, it must be a good seller.

 

I bought the Dynamo cheat sheet book  and while that isn't the best book for learning (besides the fact half the book is for Grasshopper, and programming examples are in C#), it helped me to get started with Dynamo. 

Revit version: R2024.2.1
Message 16 of 18
jeremy_tammik
in reply to: HVAC-Novice

You should also check out Jacob's Dynamo Learning Resources:

 

https://thebuildingcoder.typepad.com/blog/2021/02/addin-file-learning-python-and-ifcjs.html#3.1

 

Just added to the blog...

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 17 of 18
gulshannegi94
in reply to: HVAC-Novice

Best ones are

  1. Learn Python the Hard Way by Zed Shaw a very popular author and a must-have book for any python student. In Learn Python the Hard Way, you'll learn Python by working through 52 brilliantly crafted exercises
  2. Python For Data Analysis The book is a complete guide on processing, cleaning, influencing and gathering of data in Python. It is made for the area of data intensive applications and provides an excellent introduction on data analysis issues. It is the best source for understanding the various tools.
  3. Python, In A Nutshell, It acts as an easy guide on Python programming language. It is a perfect source when it comes to areas like the official library and language references. This book is to be read by those who already have their fundamentals on Python strong. It deals with many advanced and complicated areas regarding the subject.
  4. Violent Python: A Cookbook For Hackers, Forensic Analysts, Penetration Testers Written by TJ Oโ€™Connor, this book is an introductory level book on Python programming language that provides a clear-cut understanding. This book will teach you to forge your own weapons using the Python programming language instead of relying on another attackerโ€™s tools. It is the best book to read when it comes to security concepts and deals with forensics, tool integration for complicated protocols like SMB. It also demonstrates how to write Python scripts to automate large-scale network attacks, extract metadata, and investigate forensic artifacts. The book is apt to be used by those programmers who already have a good understanding of the Python language.
  5. Python Machine Learning Unlock deeper insights into Machine Leaning with this vital guide to cutting-edge predictive analytics about This Book- Leverage Python's most powerful open-source libraries for deep learning, data wrangling, and data visualization- Learn effective strategies and best practices to improve and optimize machine learning systems and algorithms- Ask - and answer - tough questions of your data with robust statistical models, built for a range of datasets who This Book Is ForIf you want to find out how to use Python to start answering critical questions of your data, pick up Python Machine Learning - whether you want to get started from scratch or want to extend your data science knowledge, this is an essential and unmissable resource

You can check this post for more best Python Books(Found this list on the Internet)

Message 18 of 18
HVAC-Novice
in reply to: gulshannegi94

Thanks for the advice! I found two books by Shaw Zed in my local library and ordered them. 

Revit version: R2024.2.1

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community