Don't pass around nullptr in case of failed representation mapping

This commit is contained in:
Thomas Krijnen
2024-06-12 14:25:56 +02:00
parent b90c1ee7c9
commit 17a433a97b
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -363,8 +363,13 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
}
IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_representation_and_product(const IfcUtil::IfcBaseEntity* representation, const IfcUtil::IfcBaseEntity* product) {
auto interpreted_representation = mapping_->map(representation);
if (!interpreted_representation) {
interpreted_representation = taxonomy::make<taxonomy::collection>();
interpreted_representation->instance = representation;
}
return create_brep_for_representation_and_product(
mapping_->map(representation),
interpreted_representation,
product,
taxonomy::cast<taxonomy::geom_item>(mapping_->map(product))->matrix
);
+1 -1
View File
@@ -724,7 +724,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
typename Schema::IfcProductRepresentation* prodrep = product->Representation();
typename Schema::IfcRepresentation::list::ptr reps = prodrep->Representations();
typename Schema::IfcRepresentation* ifc_representation = (typename Schema::IfcRepresentation*) representation;
typename Schema::IfcRepresentation* ifc_representation = representation->as<typename Schema::IfcRepresentation>();
if (!ifc_representation) {
// First, try to find a representation based on the settings