Calling dynamo nodes from python node

Hi,
To use loop logic I would like to use dynamo node inside python script (e.c. Element.BoundingBox). I tryed to import it, but faced with following error.

Can somebody clarify what is the rule of using dynamo nodes inside python script and how I can handle with current situation?

#elements input as list retrived from  
#All Elements In Active View node

elements = IN[0]
bb = [Revit.Elements.Element.BoundingBox(e) for e in elements]
OUT = bb

This is likely a backwards way to get at what you are after…

  • Why not use the node itself if you’re just gonna reproduce the result in a far less effective way?
  • Why not unwrap the elements and keep with the Revit bounding boxes?

In any case: e.BoundingBox should get things done.

2 Likes

@jacob.small, thank you.
It is just a part of whole task, actully I am going to hande retrived information from this part later.

It works! The problem is I still don’t understand logic of calling this method :slight_smile:
Instead call of this method is available according dynamo hierarchy, but it doesn’t work.
image

Properties are called from the object itself.

If you check your Dynamo library (outside of Python - in the Synamo UI) I believe you’ll find that Element.BoundingBox is adjacent to the blue question mark section of the Element shelf in the Revit bookcase of the library (might be missing. A step or two there).

Methods (the red lightening bolts) and constructors (the green plus sign) are both called by the means you showed above.

There are some exceptions to this rule, but the general frequency should hold true. You may want to confirm you have a Dynamo bounding box and not a Revit bounding box as depending on your imports the results could look the same.