mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
Tree API extensions in wrapper
This commit is contained in:
@@ -149,9 +149,14 @@ class tree(ifcopenshell_wrapper.tree):
|
|||||||
args = [self, unwrap(value)]
|
args = [self, unwrap(value)]
|
||||||
if isinstance(value, entity_instance):
|
if isinstance(value, entity_instance):
|
||||||
args.append(kwargs.get("completely_within", False))
|
args.append(kwargs.get("completely_within", False))
|
||||||
|
if "extend" in kwargs:
|
||||||
|
args.append(kwargs["extend"])
|
||||||
elif has_occ:
|
elif has_occ:
|
||||||
if isinstance(value, TopoDS.TopoDS_Shape):
|
if isinstance(value, TopoDS.TopoDS_Shape):
|
||||||
args[1] = utils.serialize_shape(value)
|
args[1] = utils.serialize_shape(value)
|
||||||
|
args.append(kwargs.get("completely_within", False))
|
||||||
|
if "extend" in kwargs:
|
||||||
|
args.append(kwargs["extend"])
|
||||||
return [entity_instance(e) for e in ifcopenshell_wrapper.tree.select(*args)]
|
return [entity_instance(e) for e in ifcopenshell_wrapper.tree.select(*args)]
|
||||||
|
|
||||||
def select_box(self, value, **kwargs):
|
def select_box(self, value, **kwargs):
|
||||||
|
|||||||
@@ -77,11 +77,11 @@
|
|||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select(IfcUtil::IfcBaseClass* e, bool completely_within = false) const {
|
IfcEntityList::ptr select(IfcUtil::IfcBaseClass* e, bool completely_within = false, double extend = 0.0) const {
|
||||||
if (!e->declaration().is("IfcProduct")) {
|
if (!e->declaration().is("IfcProduct")) {
|
||||||
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
||||||
}
|
}
|
||||||
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select((IfcUtil::IfcBaseEntity*)e, completely_within);
|
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select((IfcUtil::IfcBaseEntity*)e, completely_within, extend);
|
||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,13 +90,13 @@
|
|||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select(const std::string& shape_serialization) const {
|
IfcEntityList::ptr select(const std::string& shape_serialization, bool completely_within = false, double extend = -1.e-5) const {
|
||||||
std::stringstream stream(shape_serialization);
|
std::stringstream stream(shape_serialization);
|
||||||
BRepTools_ShapeSet shapes;
|
BRepTools_ShapeSet shapes;
|
||||||
shapes.Read(stream);
|
shapes.Read(stream);
|
||||||
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
|
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
|
||||||
|
|
||||||
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select(shp);
|
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select(shp, completely_within, extend);
|
||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user