Understand how to snoop the Revit API and merge with Python, how?


Hello Dynos,

I do some Progress in Coding, actually it is funny. I just want to get Parameters from a wall (f.e. BuildInParameters, Walltype,…)

def Element(x):
   a = UnwrapElement(x)
   return a

OUT = Element(IN[0]).GetType().ToString()

I try also use dir() Can i use dir() to find which Actions and Queries i can do? like:

Element = UnwrapElement(IN[0])

OUT = dir(Element.GetParameters.GetType().ToString.Targets.Contains)

What is dir() doing can i navigate with outdoting to my f.e. “WallType” or is it just listing Actions and queries? How i get finaly the information?

Have i to snoop out Revit.Elements f.e.?

I just what to get a deeper understanding

OUT = dir(Revit.Elements.Category.ByName.ToString)

I got no erros, but i am not shure if i navigate well. Does anybody have some examples?

KR

Andreas

You can use dir to show methods/properties on an object and is quite useful, but for the revit api, you can just go have a look at the Revit API docs…

https://www.revitapidocs.com/

Here you will find comprehensive documentation and some example (in C#, but they are relatively easy to translate to python). For example, here is the API documentation for the Element Class…

https://www.revitapidocs.com/2020/671c33f6-169b-17ca-583b-42f9df50ace5.htm

And here is the wall class…

https://www.revitapidocs.com/2020/b5891733-c602-12df-beab-da414b58d608.htm

Hope this helps. I would spend some time exploring the API docs, specifically for FamilyInstance, Element, View, Wall, Floor and FilteredElementCollector classes as these are most common.

1 Like