diff --git a/src/ifcgeom/IfcGeomTree.h b/src/ifcgeom/IfcGeomTree.h index 6ea93bd9cf..ee61888bae 100644 --- a/src/ifcgeom/IfcGeomTree.h +++ b/src/ifcgeom/IfcGeomTree.h @@ -224,6 +224,12 @@ namespace IfcGeom { return ts_filtered; } + std::vector select(const IfcGeom::BRepElement* elem, bool completely_within = false, double extend = -1.e-5) const { + auto compound = elem->geometry().as_compound(); + compound.Move(elem->transformation().data()); + return select(compound, completely_within, extend); + } + std::vector select(const gp_Pnt& p, double extend=0.0) const { distances_.clear(); diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index da58f8dc00..2993908c16 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -146,7 +146,7 @@ class tree(ifcopenshell_wrapper.tree): return value args = [self, unwrap(value)] - if isinstance(value, entity_instance): + if isinstance(value, (entity_instance, ifcopenshell_wrapper.BRepElement)): args.append(kwargs.get("completely_within", False)) if "extend" in kwargs: args.append(kwargs["extend"]) diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 01d2ae6cad..1a43ea7b78 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -127,6 +127,11 @@ return IfcGeom_tree_vector_to_list(ps); } + aggregate_of_instance::ptr select(const IfcGeom::BRepElement* elem, bool completely_within = false, double extend = -1.e-5) const { + std::vector ps = $self->select(elem, completely_within, extend); + return IfcGeom_tree_vector_to_list(ps); + } + } // A visitor