RevitPythonShell vs python scripting in Dynamo

Hello guys

Is there any blog or reference where there’s a really good written explanation of what libraries, packages, modules etc. to import in python before you wanna do anything in Revit? Like how everything’s connected/dependent/independent on/off each other etc.?

At the moment it all seems scattered around here and there and difficult to connect/comprehend. Any blog dedicated just for python in context of Revit and dynamo?

Can someone give out explanations on the following question and topics for a moderate python beginner like me who’s limited to using for and if statements at max?

  1. What exactly are transactions?
  2. what’s wrapping or unwrapping?
  3. python modules like beautifulsoup, itertools, etc. and when to use them?
  4. Is there any standard template of module/library imports in python that I can use no matter what task you’re going to attempt? Like what I mean is, I don’t wanna miss out on bare minimum imports in python for any majority of work I do.


Funny you should ask. I’m slowly cobbling together something like this at the minute and will be addressing pretty much all the above as well as covering a bit of the Revit API and Python in Dynamo but focused on the Dynamo Python Node.

I’ve also noticed that there really isn’t much out there so thought it would be useful for anyone that wants to learn.

I have probably a couple of weeks maybe before it’s ready to share.




that’s really wonderful. I have made evernote stacks of anything and everything from blogs of Konrad Sobon, Darren Thomas, Nathan Miller, GitHub repository etc etc. Although there’s a wealth of knowledge out there but not necessarily easy to grasp, understand and connect. Eagerly awaiting your post/work :slight_smile:


Yeah, they have some amazing posts, and I read those blogs frequently, but you are right that they can be a little tricky to follow if you are not confident with the Revit API or Python.

The tutorials I’m doing cover the basics of how to set up the Python node, what, how and when to import, Transactions, unwrapping etc and using the API to get what you want with things like collectors and Element properties.

It won’t be a python course though but I’ll have links to Python learning resources. :slight_smile:


Hi Daniel. Any news about these tutorials. They would invaluable! :slight_smile:

Edit: I think I found your YouTube channel. Excellent work man. Keep the awesome tutorials coming

Hi Mekawy,

If you like it, maybe you can share that YouTube link with us.
A lot of us (including me) would like to learn some Python basics (in combination with Dynamo).

Kind regards,

1 Like

Hi Mark,
I am not so sure it is Daniel’s, I just assumed so because of the similar name :slight_smile:
Anyways, here is the channel I meant; Danny Bentley


Hi Mekawy,

Thanks, a lot.
I’m going to check it out (time is my only anemy :wink:).

Mark have some Python coding samples thanks to Gui Talarico, those coding run perfectly @ Interactive Python Shell (IronPython Console under Revit), but how to use these coding in Dynamo Python nodes (both Python Script node and Python Script from String node)? i copied “MoveRoomTagToRoomCenter” coding sample below:

import clr
from Autodesk.Revit.DB import Transaction
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory
from Autodesk.Revit.DB.Architecture import Room
uidoc = revit.ActiveUIDocument
doc = revit.ActiveUIDocument.Document
room_tags = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_RoomTags).WhereElementIsNotElementType().ToElements()
transaction = Transaction(doc, ‘Move Room Tags on Room Points’)
for room_tag in room_tags:
room_tag_pt = room_tag.Location.Point
room = room_tag.Room
room_pt = room.Location.Point
translation = room_pt - room_tag_pt

anyone can “translate” into Dynamo Python Script (from String) node? besides, just wonder why there’s difference? is it because Python has different versions?

the reason i use this old post is that the title exactly match my question: difference between RevitPythonShell coding and Dynamo Python Script coding, well, both are Python language and both are on Revit platform.

i did Revit API in C# a lot and Dynamo quite a few, just recently get my feet wet in Python, well, just want to know the INTEROPERABILITY between these Python usage in Revit.

Hi @Ning_Zhou - they are both ironPython. I am not sure what version of ironPython the revitPythonShell uses, but Dynamo currently ships 2.7.3 - quite old at this point, but likely very compatible with revitPythonShell.

The difference between most scripts you will see is that dynamo ones may include references to some helper libraries that dynamo uses like RevitServices and ProtoGeometry (dynamo geometry library).

thanks Michael_Kirschner2 for clarification! well, do hope that Dynamo Python Script node will be fully compatible w/ RevitPythonShell or whatever Revit API’s Python is evolving, have great weekend!