import cadquery as Cq def binary_intersection(a: Cq.Assembly) -> Cq.Shape: objs = [s.toCompound() for _, s in a.traverse() if isinstance(s, Cq.Assembly)] obj1, obj2 = objs[:2] return obj1.intersect(obj2)