Bimorphs Nodes Not working

My Bimorphs Link element bounding box node is not working. I am trying to access the geometry of some assemblies in a linked file to then use that geometry to create a bounding box and eventually a 3D view by that bounding box. All I’m getting is that operation failed when I try to plug my linkelement into the linkelement.boundingbox node. Please Help! I am familiar with python and other languages so if going down that rabbit hole is what i need to do then can someone at least give me a little direction.

Thanks,

Here is my graph.

HI @n.dull I’m going to have to get Autodesk to look into this as it seems there may be a bug in the Revit API using C# Element.get_BoundingBox() method.

Assemblies do have valid bounding boxes and I’ve verified this through Revit Lookup so this node should work - the OOTB node should also work, but that fails too. However, using Python which can use an alternative property accessor to obtain the bb (C# doesn’t have this option available) works without issue. The only other issue if going down the Python route is the bb will be in its source document location, not its host location, like what BimorphNodes LinkElement bb node does. If my theory is correct then unfortunately there wont be a fix until Autodesk investigate, confirm and patch it.

EDIT: I’ve done more tests and found the source of the problem. The get_BoundingBox() takes a view as an input. In almost all cases, its unnecessary to provide the view, so like the OOTB node, I simply input null and save myself - and the user - the hassle of providing a view. However, its seems that assemblies need a view input otherwise the bb extraction fails. I’ll get this updated in the next release of BimorphNodes which should be out within the next few weeks.

Revit Lookup:

Python

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

# Import RevitAPI
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

assembly = UnwrapElement(IN[0]) #input a single element, not a list
linkInstance = UnwrapElement(IN[1])  #input a single element, not a list
linkDoc = linkInstance.GetLinkDocument()

view = FilteredElementCollector(linkDoc).OfClass(View3D).WhereElementIsNotElementType().FirstElement()

OUT = assembly.BoundingBox[view] .ToProtoType()
4 Likes

Thomas,

I really appreciate your quick response. As far as a workaround for now could I not just give it a view that includes everything? If so would I just replace the [ActiveView] part of the code you sent with the view I want to use?

Best,

Yeah exactly. All I’m doing is getting the first 3D view in the project - basically what you are asking if I’m not mistaken. It’s not completely robust but should work fine in most cases. The most important thing is to ensure the view you collect is from the link instance document not your active document.

Ok maybe this was a little beyond me. Still having issues. If I am taking too much of your time please feel free to tell me where to shove it whenever you would like.

Greatly appreciated. Now everyone in my office knows about Bi-morphs because of your lighting fast responses. Attached are the script and error message I am getting.

Script still not working.txt (510 Bytes)

Click the plus sign on the node, in IN[0] input an assembly from your link (not a list). In IN[1] input the linkInstance from where your assembly derived.

there is no definition for IN[1] in the script. Do i need to define it? needless to say I’m still having the same error message.

There is because you need it for the LinkElement.OfCategory node…connect your ‘Select Model Element’ node into IN[1].

That is what I am doing. Sorry.

Not sure, its working fine when I test. Is your link loaded? Have you tried using the unmodified code snippet I included above? There is no line 35 in the code snippet so I assume you’ve made changes? If so paste your code or add your graph.

image

Here you go man. I have been painstakingly working on a work around where I export data from the linked file to excel. If I could get this to work like your showing it would literally save me weeks of work.

The issue is…I updated the code snippet shortly after posting it :wink:
You’re using the snippet I initially posted which only works on assemblies in the active doc, not a link doc.
Solution: use my updated code snippet!

Thomas_Mahon,

This is awesome. Works great. Thank you for all the help!

Thomas,

Can I call on you for one more favor. Let’s say I wanted to run this same script over multiple objects and get multiple bounding boxes. I am working in the active document now so no need to do anything with links or link elements. I know this might be remedial but it will help me in the future when I need to process a list of elements through one of my graphs.

Thanks,