Don't assign material as style when it doesn't have any styles #6314

This commit is contained in:
Thomas Krijnen
2025-04-07 21:25:33 +02:00
parent 0bbe1aad5b
commit b712f30ad3
2 changed files with 12 additions and 5 deletions
+7 -5
View File
@@ -126,11 +126,13 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
}
if (single_material) {
auto s = taxonomy::cast<taxonomy::style>(mapping_->map(single_material));
for (auto it = shapes.begin(); it != shapes.end(); ++it) {
if (!it->hasStyle() && s) {
it->setStyle(s);
material_style_applied = true;
if (auto itm = mapping_->map(single_material)) {
auto s = taxonomy::cast<taxonomy::style>(itm);
for (auto it = shapes.begin(); it != shapes.end(); ++it) {
if (!it->hasStyle() && s) {
it->setStyle(s);
material_style_applied = true;
}
}
}
} else {
+5
View File
@@ -556,6 +556,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial* material) {
}
}
// When material does not have a representation we don't create a style from it
return nullptr;
/*
taxonomy::style::ptr material_style = taxonomy::make<taxonomy::style>();
material_style->instance = material;
if (settings_.get<settings::UseMaterialNames>().get()) {
@@ -566,6 +570,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial* material) {
material_style->name = oss.str();
}
return material_style;
*/
// @todo
// IfcGeom::SurfaceStyle material_style = IfcGeom::SurfaceStyle(material->data().id(), material->Name());