Check if column has floor intersection at the base, top or mid column and if True - return objects

Hey all, I want to write a script that will recognize the floor/beam elements that connect to a column at whichever area (top/bottom/mid section) and if True so return the object (location?) in order to use geometry in further use.
Can anyone point in the direction to build this or help with the matter?

This is a really good question. Have you searched the forums for anything yet? Have you tried building a script? How far have you gone yourself?

Please see this FAQ for more: How to get help on the Dynamo forums

I tried searching the forum but nothing relevant was found (at least by my search terms).
I started searching online and in the revit api and the closest thing I found was the
“GetColumnAttachment” method but or that it didn’t work for me so or that I didn’t understand it properly or that it doesn’t work (probably the first option :sweat_smile:) but in any case I don’t know if that is what I am really looking for so hoped maybe there is someone familiar with this request and already knows how to address it.

Hi @zvith , the first thing that popped to my mind is the use of the BoundingBoxIntersectsFilter.
This filter allows you to collect only the elements whose BoundingBox is intersecting with a given Outline.

Here is an example of how to use this class, in combination with another filter to select only the categories you are interested in.

def get_outline(e):
	bb = e.get_BoundingBox(None)
	return	Outline(bb.Min, bb.Max)
	
elem = UnwrapElement(IN[0])
categories = UnwrapElement(IN[1])

filter = ElementMulticategoryFilter(List[ElementId]([c.Id for c in categories]))

if elem.get_BoundingBox(None):
	filter2 = BoundingBoxIntersectsFilter(get_outline(elem))
	elems = FilteredElementCollector(doc).WherePasses(filter).WherePasses(filter2).WhereElementIsNotElementType()
	elems = [e for e in elems if e.Category and e.Category.CategoryType == CategoryType.Model]


OUT = elems

2 Likes

Thanks alot Giuseppe! I haven’t tried it yet but it seems legit :slight_smile:
Thanks also for you response on my other topic. These are methods that I wouldn’t have managed to find on my own and this really helps further discovering the Revit api uses.

1 Like

Can you explain what exactly it is that your conditioning in this statement? I don’t really understand the intentions of both conditions…

sure @zvith ,
the first e.Category is checking if the element is associable to a category (there are indeed some elements with this property returning a None), the second e.Category.CategoryType is looking at the CategoryType so to exclude all the elements not referring to Model categories (eg. Analytical or Annotation).
ApiDocs.co · Revit · CategoryType Enumeration

If you are in the process of learning python in dynamo, I’m running this blog where, depending on the community demands, I also post some python tips. Maybe you find it useful.
Macro4BIM

Thanks Giuseppe, I will surely have a look at your blog!