diff --git a/nix/build-all.py b/nix/build-all.py index 1061994f75..dda92aff9e 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -63,7 +63,7 @@ PROJECT_NAME="IfcOpenShell" OCE_VERSION="0.18" # OCCT_VERSION="7.1.0" # OCCT_HASH="89aebde" -PYTHON_VERSIONS=["2.7.12", "3.2.6", "3.3.6", "3.4.6", "3.5.3", "3.6.2"] +PYTHON_VERSIONS=["2.7.16", "3.2.6", "3.3.6", "3.4.6", "3.5.3", "3.6.2"] # OCCT_VERSION="7.2.0" # OCCT_HASH="88af392" OCCT_VERSION="7.3.0" diff --git a/src/ifcgeom_schema_agnostic/IfcGeomFilter.h b/src/ifcgeom_schema_agnostic/IfcGeomFilter.h index c29a6c8f3d..8d4a1192e3 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomFilter.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomFilter.h @@ -40,14 +40,17 @@ namespace IfcGeom { /// http://www.boost.org/doc/libs/1_62_0/doc/html/function/tutorial.html typedef boost::function filter_t; - struct filter { - filter() : include(false), traverse(false) {} - filter(bool incl, bool trav) : include(incl), traverse(trav) {} + struct filter + { + filter() : include(false), traverse(false), traverse_openings(false) {} + filter(bool incl, bool trav, bool trav_openings = false) : include(incl), traverse(trav), traverse_openings(trav_openings) {} /// Should the product be included (true) or excluded (false). bool include; /// If traversal requested, traverse to the parents to see if they satisfy the criteria. E.g. we might be looking for /// children of a storey named "Level 20", or children of entities that have no representation, e.g. IfcCurtainWall. bool traverse; + /// Include opening relationships as part of traversal. + bool traverse_openings; /// Optional description for the filtering criteria of this filter. std::string description; @@ -59,9 +62,10 @@ namespace IfcGeom { return is_match == include; } - static bool traverse_match(IfcUtil::IfcBaseEntity* prod, const filter_t& pred) { - IfcUtil::IfcBaseEntity* parent, *current = prod; - while ((parent = IfcGeom::Kernel::get_decomposing_entity(current)) != nullptr) { + bool traverse_match(IfcUtil::IfcBaseEntity* prod, const filter_t& pred) const + { + IfcUtil::IfcBaseEntity* parent, *current = prod; + while ((parent = IfcGeom::Kernel::get_decomposing_entity(current, traverse_openings)) != nullptr) { if (pred(parent)) { return true; } diff --git a/src/ifcgeom_schema_agnostic/Kernel.cpp b/src/ifcgeom_schema_agnostic/Kernel.cpp index e6def6a42a..28eb00a207 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.cpp +++ b/src/ifcgeom_schema_agnostic/Kernel.cpp @@ -73,11 +73,11 @@ IfcGeom::Kernel* IfcGeom::impl::KernelFactoryImplementation::construct(const std #define CREATE_GET_DECOMPOSING_ENTITY(IfcSchema) \ \ -IfcSchema::IfcObjectDefinition* get_decomposing_entity_impl(IfcSchema::IfcProduct* product) { \ +IfcSchema::IfcObjectDefinition* get_decomposing_entity_impl(IfcSchema::IfcProduct* product, bool include_openings) {\ IfcSchema::IfcObjectDefinition* parent = 0; \ \ /* In case of an opening element, parent to the RelatingBuildingElement */ \ - if (product->declaration().is(IfcSchema::IfcOpeningElement::Class())) { \ + if (include_openings && product->declaration().is(IfcSchema::IfcOpeningElement::Class())) { \ IfcSchema::IfcOpeningElement* opening = (IfcSchema::IfcOpeningElement*)product; \ IfcSchema::IfcRelVoidsElement::list::ptr voids = opening->VoidsElements(); \ if (voids->size()) { \ @@ -88,7 +88,7 @@ IfcSchema::IfcObjectDefinition* get_decomposing_entity_impl(IfcSchema::IfcProduc IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)product; \ IfcSchema::IfcRelFillsElement::list::ptr fills = element->FillsVoids(); \ /* In case of a RelatedBuildingElement parent to the opening element */ \ - if (fills->size()) { \ + if (fills->size() && include_openings) { \ for (IfcSchema::IfcRelFillsElement::list::it it = fills->begin(); it != fills->end(); ++it) { \ IfcSchema::IfcRelFillsElement* fill = *it; \ IfcSchema::IfcObjectDefinition* ifc_objectdef = fill->RelatingOpeningElement(); \ @@ -140,11 +140,11 @@ namespace { CREATE_GET_DECOMPOSING_ENTITY(Ifc4); } -IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBaseEntity* inst) { +IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBaseEntity* inst, bool include_openings) { if (inst->as()) { - return get_decomposing_entity_impl(inst->as()); + return get_decomposing_entity_impl(inst->as(), include_openings); } else if (inst->as()) { - return get_decomposing_entity_impl(inst->as()); + return get_decomposing_entity_impl(inst->as(), include_openings); } else { throw IfcParse::IfcException("Unexpected entity " + inst->declaration().name()); } diff --git a/src/ifcgeom_schema_agnostic/Kernel.h b/src/ifcgeom_schema_agnostic/Kernel.h index c924f8af6a..f41020889e 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.h +++ b/src/ifcgeom_schema_agnostic/Kernel.h @@ -83,7 +83,7 @@ namespace IfcGeom { static int surface_genus(const TopoDS_Shape&); static bool is_manifold(const TopoDS_Shape& a); - static IfcUtil::IfcBaseEntity* get_decomposing_entity(IfcUtil::IfcBaseEntity*); + static IfcUtil::IfcBaseEntity* get_decomposing_entity(IfcUtil::IfcBaseEntity*, bool include_openings=true); static std::map get_layers(IfcUtil::IfcBaseEntity*); };