mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Don't pass around nullptr in case of failed representation mapping
This commit is contained in:
@@ -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) {
|
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(
|
return create_brep_for_representation_and_product(
|
||||||
mapping_->map(representation),
|
interpreted_representation,
|
||||||
product,
|
product,
|
||||||
taxonomy::cast<taxonomy::geom_item>(mapping_->map(product))->matrix
|
taxonomy::cast<taxonomy::geom_item>(mapping_->map(product))->matrix
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -724,7 +724,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
|
|
||||||
typename Schema::IfcProductRepresentation* prodrep = product->Representation();
|
typename Schema::IfcProductRepresentation* prodrep = product->Representation();
|
||||||
typename Schema::IfcRepresentation::list::ptr reps = prodrep->Representations();
|
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) {
|
if (!ifc_representation) {
|
||||||
// First, try to find a representation based on the settings
|
// First, try to find a representation based on the settings
|
||||||
|
|||||||
Reference in New Issue
Block a user