SVG reliance on UseElemHierarchy for storey decomposition

This commit is contained in:
Thomas Krijnen
2024-12-01 11:20:37 +01:00
parent df060d7f60
commit 3a687fecda
2 changed files with 16 additions and 9 deletions
+14 -9
View File
@@ -815,6 +815,15 @@ int main(int argc, char** argv) {
}
}
if (geometry_settings.get<ifcopenshell::geometry::settings::UseElementHierarchy>().get() && output_extension != DAE && output_extension != USD && output_extension != USDA && output_extension != USDC) {
cerr_ << "[Error] --use-element-hierarchy can be used only with .dae or .usd output.\n";
/// @todo Lots of duplicate error-and-exit code.
write_log(!quiet);
print_usage();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename));
return EXIT_FAILURE;
}
if (vmap[ifcopenshell::geometry::settings::WeldVertices::name].defaulted()) {
geometry_settings.get<ifcopenshell::geometry::settings::WeldVertices>().value = false;
}
@@ -831,6 +840,11 @@ int main(int argc, char** argv) {
geometry_settings.get<ifcopenshell::geometry::settings::TriangulationType>().value = ifcopenshell::geometry::settings::TriangulationMethod::POLYHEDRON_WITH_HOLES;
}
if (output_extension == SVG) {
// SVG serialiazation depends on element hierarchy now to look up the parent
geometry_settings.get<ifcopenshell::geometry::settings::UseElementHierarchy>().value = true;
}
boost::shared_ptr<GeometrySerializer> serializer; /**< @todo use std::unique_ptr when possible */
if (output_extension == OBJ) {
// Do not use temp file for MTL as it's such a small file.
@@ -875,15 +889,6 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
if (geometry_settings.get<ifcopenshell::geometry::settings::UseElementHierarchy>().get() && output_extension != DAE && output_extension != USD && output_extension != USDA && output_extension != USDC) {
cerr_ << "[Error] --use-element-hierarchy can be used only with .dae or .usd output.\n";
/// @todo Lots of duplicate error-and-exit code.
write_log(!quiet);
print_usage();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename));
return EXIT_FAILURE;
}
const bool is_tesselated = serializer->isTesselated(); // isTesselated() doesn't change at run-time
if (!is_tesselated) {
if (geometry_settings.get<ifcopenshell::geometry::settings::WeldVertices>().get()) {