From ae2600afb9f8a522b06332b858b735235a1d053c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 29 Apr 2024 20:51:17 +0200 Subject: [PATCH] Set style name --- src/ifcgeom/mapping/mapping.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 5bfc33177f..bee1973ccc 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -426,6 +426,14 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial* material) { } taxonomy::style::ptr material_style = taxonomy::make(); + material_style->instance = material; + if (settings_.get().get()) { + material_style->name = material->Name(); + } else { + std::ostringstream oss; + oss << material->declaration().name() << "-" << material->data().id(); + material_style->name = oss.str(); + } return material_style; // @todo @@ -448,8 +456,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem* inst) { taxonomy::style::ptr surface_style = taxonomy::make(); surface_style->instance = style; - if (style->Name()) { + if (settings_.get().get() && style->Name()) { surface_style->name = *style->Name(); + } else { + std::ostringstream oss; + oss << shading->declaration().name() << "-" << shading->data().id(); + surface_style->name = oss.str(); } double rgb[3];