Intersecting Elements, how?

Hello,

i want to make a list of intersecting elements, f.e. only slab aginst slab, how?


I want use a intersectionFilter… but i stuck with this warning…

can i just use Elements instead of geometry ?

2023-12-13_15h07_46

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

elm = UnwrapElement(IN[0])

solids = IN[1]
#foreach (RevitLinkedInstance ins in this._linkedInstaces)


elmCol = FilteredElementCollector(doc, doc.ActiveView.Id)

for solid in solids:
	filter = ElementIntersectsSolidFilter(solid)
	resultsList = elmCol.WherePasses(filter).ToElementIds().ToList()



OUT =  filter, resultsList

https://thebuildingcoder.typepad.com/blog/2018/12/using-an-intersection-filter-for-linked-elements.html
KR

Andreas

Hi this is not conflict with (Solid Dynamo and Solid Revit) (analogy of geometry with points)

cordially
christian.stan

1 Like

This API call is built to use a Revit Solid not a Dynamo Solid. Best bet is to take the element and extract the geometry from that, filter out non-solid geometry, union the solids, and test that; all in Python.

3 Likes

I may say stupid things (to limit the processing volume)
a 1st filter with intersection of bounding box on the elements
a 2nd filter to filter “false positives” by exploiting their geometry

Sincerely
christian.stan

1 Like

BimorphNodes

2 Likes

@Andrej ,

i know :wink: but i want to become a Python Master…

KR

Andreas

1 Like

A python is a snake.

2 Likes

@Andrej

:wink:

1 Like

Hi @Draxl_Andreas

you need to work with solids from Revit API here is a simple example

import clr
import sys
import System
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

import itertools 

def get_Solid_from_Elem(elem):
    opt = Options()
    geoSet = elem.get_Geometry(opt)
    for geo in geoSet:
        if isinstance(geo, GeometryInstance):
            for gi in geo.GetInstanceGeometry():
                if isinstance(gi, Solid) and gi.Volume > 0.01:
                    return gi
        elif isinstance(geo, Solid) and geo.Volume > 0.01:
            return geo
        else:
            pass
            
out = []

fec_floor = FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_Floors).WhereElementIsNotElementType()

for elemA, elemB in itertools.combinations_with_replacement(fec_floor, 2):
    if elemA.Id != elemB.Id:
        solidA = get_Solid_from_Elem(elemA)
        if solidA is not None:
            filterInterSect = ElementIntersectsSolidFilter(solidA)
            are_Intersect = filterInterSect.PassesFilter(elemB)
            out.append([are_Intersect, elemA, elemB])
    
OUT = out
2 Likes

@c.poupin ,

we will use it for tendering. To delever cleaned models before Ifc Export.

i want to make my models smooth little by little…

KR

Andreas

1 Like

@c.poupin

…it works, is there even the possibility to set a tolerance? f.e. overlap 1cm or 1m³ of geometry?

because right now the tolerance is for the element.geometry

KR

Andreas

Hi,

I’m currently away from my pc, but one solution is to use solid operations to calculate the volume of the intersection

2 Likes

hi, you should not forget that you are in cubic feet :wink:

Sincerely
christian.stan

@christian.stan ,

you mean internal units! , thats right.

hi, if we proceed by analogy (returning lengths in feet from python)
cordially
christian.stan