--unify-shapes setting

This commit is contained in:
Thomas Krijnen
2024-10-07 20:47:01 +02:00
parent 461e3d478a
commit 250fad696e
5 changed files with 39 additions and 204 deletions
+21 -13
View File
@@ -208,29 +208,37 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
Logger::Message(Logger::LOG_ERROR, "Error processing openings for:", product);
}
if (caught_error && opened_shapes.size() < shapes.size()) {
opened_shapes = shapes;
}
if (settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().get()) {
for (auto it = opened_shapes.begin(); it != opened_shapes.end(); ++it) {
it->prepend(place);
if (!(caught_error && opened_shapes.size() < shapes.size())) {
if (settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().get()) {
for (auto it = opened_shapes.begin(); it != opened_shapes.end(); ++it) {
it->prepend(place);
}
place = ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>();
representation_id_builder << "-world-coords";
}
place = ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>();
representation_id_builder << "-world-coords";
shapes = opened_shapes;
}
shape = new IfcGeom::Representation::BRep(settings_, product_type, representation_id_builder.str(), opened_shapes);
} else if (settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().get()) {
for (auto it = shapes.begin(); it != shapes.end(); ++it) {
it->prepend(place);
}
place = ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>();
representation_id_builder << "-world-coords";
shape = new IfcGeom::Representation::BRep(settings_, product_type, representation_id_builder.str(), shapes);
} else {
shape = new IfcGeom::Representation::BRep(settings_, product_type, representation_id_builder.str(), shapes);
}
if (settings_.get<ifcopenshell::geometry::settings::UnifyShapes>().get()) {
IfcGeom::ConversionResults unified_shapes;
try {
if (kernel_->unify_shapes(shapes, unified_shapes)) {
std::swap(shapes, unified_shapes);
}
} catch (std::exception& e) {
Logger::Error(e);
}
}
shape = new IfcGeom::Representation::BRep(settings_, product_type, representation_id_builder.str(), shapes);
std::string context_string = "";
// IfcShapeRepresentation.