Revit Nodes in Python

Hi Guys!

I want to know how I can put a Revit node inside a script in python. I had read a lot but don’t found any solution. I just want GetParameterValueByName.(I know about the node inside the dynamo, but I want to create a different function and I need to get the parameter inside the script).

Example:

Thanks!! =)

If you’re going Pythyon to build other functions, you’re likely best of calling the Revit API directly not calling the Dynamo node to call the Revit API.

Of course you’ll need to convert that code to Python calls and ensure you’re loading the right API libraries of course. There is an example in the ‘code’ section of the site here: Revit API Docs - Code Samples

1 Like

@jacob.small
Thanks for the help man! =D
but I don’t understand very well, sorry.
I tried something like that (EX1), but not work…=(
I will try more thinks and I will give feedback here.

EX1:

For what it is worth, the reason your python script wasn’t working is because Python handles lists differently than Dynamo’s nodes. In node form, it will automatically iterate on every item in the list but in Python, everything has to be very explicit.

This means that in Python, your input ELEMENTS is a list, not the actual element. You have to use a for loop to go through each element in the list and then run the .GetParameterValueByName function on the element.

It might be best to try googling some basic python/scripting tutorials to get a handle on things like for loops if you plan on using python.

2 Likes