Revit API and Python


#1

Does anyone know the api command for returning an objects Namespace/Class. In my example I want to feed in an element from Revit, such as a piece of furniture and my python return Autodesk.Revit.DB.FamilyInstance. In a different example a wall would return Autodesk.Revit.DB.Wall. I can get the in-built category but seem to be going round in circles trying to access the class, when I’m sure its fairly straightforward.


#2

Not sure if this is what you wanted but Clockwork and Blackbox have nodes that seem to do what I think you wanted. (And yes I have walls to be used as canvas in my current file )

2015-06-02_08h19_23

 


#3

Dynamo and other packages give you the in built categories, but I don’t want it the Revit category, rather its Namespace within the API. In your example with walls I would like to be seeing the full class of Autodesk.Revit.DB.Wall rather than just wall. The reason I need the whole namespace is because these are categorised differently to Revit’s in built categories. As an example a chair created as a family in the furniture category will show as furniture within the in built categories, whereas for this instance I would expect to see Autodesk.Revit.DB.FamilyInstance as the class/namespace. Hope that clears things up slightly.


#4

Maybe this helps:

 

 

Marcel


#5

Mark, you’ll want to use Element.TypeName from Julien Benoit’s excellent package SteamNodes. If you’re dealing with a list of elements, you’ll have to use it with List.Map - otherwise it’ll just tell you the namespace of the list.


#6

Andreas, perfect that’s what I’m after. Always seem to forget about unwrapping elements in python! This leads on to my second question is their a current node that lists out the current revit projects units. So would tell me Length is mm, Area is m­² etc, etc or should I look at this in python also. They need to make searching for useable nodes more intuitive, through peoples libraries.


#7

Mark, since I was not aware of such a node (and because I’ll be needing it for unit conversions when migrating Clockwork to Dynamo 0.8) I went ahead and added that functionality to Clockwork - juts download the latest version (0.75.33):

UnitConversion