#3889 Apply handling of openings on IfcFeatureElementSubtraction generically

This commit is contained in:
Thomas Krijnen
2023-10-16 11:02:30 +02:00
parent 68f5df73b9
commit fb9cf75412
+5 -6
View File
@@ -249,8 +249,9 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
for (IfcSchema::IfcRelVoidsElement::list::it it = openings->begin(); it != openings->end(); ++it) { for (IfcSchema::IfcRelVoidsElement::list::it it = openings->begin(); it != openings->end(); ++it) {
IfcSchema::IfcRelVoidsElement* v = *it; IfcSchema::IfcRelVoidsElement* v = *it;
IfcSchema::IfcFeatureElementSubtraction* fes = v->RelatedOpeningElement(); IfcSchema::IfcFeatureElementSubtraction* fes = v->RelatedOpeningElement();
if (fes->declaration().is(IfcSchema::IfcOpeningElement::Class())) { if (!fes->Representation()) {
if (!fes->Representation()) continue; continue;
}
/* /*
// Not yet implemented and tested, process opening placement up to parent wall // Not yet implemented and tested, process opening placement up to parent wall
@@ -307,8 +308,6 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
TopoDS_Shape opening_shape = util::apply_transformation(opening_shape_unlocated, gtrsf); TopoDS_Shape opening_shape = util::apply_transformation(opening_shape_unlocated, gtrsf);
opening_vector.push_back(std::make_pair(util::min_edge_length(opening_shape), opening_shape)); opening_vector.push_back(std::make_pair(util::min_edge_length(opening_shape), opening_shape));
} }
}
} }
std::sort(opening_vector.begin(), opening_vector.end(), opening_sorter()); std::sort(opening_vector.begin(), opening_vector.end(), opening_sorter());
@@ -515,7 +514,7 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
IfcSchema::IfcRelVoidsElement::list::ptr IfcGeom::Kernel::find_openings(IfcSchema::IfcProduct* product) { IfcSchema::IfcRelVoidsElement::list::ptr IfcGeom::Kernel::find_openings(IfcSchema::IfcProduct* product) {
std::vector<IfcSchema::IfcRelVoidsElement*> rs; std::vector<IfcSchema::IfcRelVoidsElement*> rs;
if ( product->declaration().is(IfcSchema::IfcElement::Class()) && !product->declaration().is(IfcSchema::IfcOpeningElement::Class()) ) { if ( product->declaration().is(IfcSchema::IfcElement::Class()) && !product->declaration().is(IfcSchema::IfcFeatureElementSubtraction::Class()) ) {
IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)product; IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)product;
auto rels = element->HasOpenings(); auto rels = element->HasOpenings();
rs.insert(rs.end(), rels->begin(), rels->end()); rs.insert(rs.end(), rels->begin(), rels->end());
@@ -527,7 +526,7 @@ IfcSchema::IfcRelVoidsElement::list::ptr IfcGeom::Kernel::find_openings(IfcSchem
auto decomposes = obdef->Decomposes(); auto decomposes = obdef->Decomposes();
if (decomposes->size() != 1) break; if (decomposes->size() != 1) break;
IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->RelatingObject(); IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->RelatingObject();
if ( rel_obdef->declaration().is(IfcSchema::IfcElement::Class()) && !rel_obdef->declaration().is(IfcSchema::IfcOpeningElement::Class()) ) { if ( rel_obdef->declaration().is(IfcSchema::IfcElement::Class()) && !rel_obdef->declaration().is(IfcSchema::IfcFeatureElementSubtraction::Class()) ) {
IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)rel_obdef; IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)rel_obdef;
auto rels = element->HasOpenings(); auto rels = element->HasOpenings();
rs.insert(rs.end(), rels->begin(), rels->end()); rs.insert(rs.end(), rels->begin(), rels->end());