diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index ebc76c9350..4f7f08ca9d 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -483,6 +483,15 @@ struct ShapeRTTI : public boost::static_visitor } } + if (!ifc_representation) { + if (reps->size()) { + // Return a random representation + ifc_representation = *reps->begin(); + } else { + throw IfcParse::IfcException("No suitable IfcRepresentation found"); + } + } + // Read precision for found representation's context auto context = ifc_representation->ContextOfItems(); if (context->template as()) { @@ -499,15 +508,6 @@ struct ShapeRTTI : public boost::static_visitor kernel.setValue(IfcGeom::Kernel::GV_PRECISION, p); } - if (!ifc_representation) { - if (reps->size()) { - // Return a random representation - ifc_representation = *reps->begin(); - } else { - throw IfcParse::IfcException("No suitable IfcRepresentation found"); - } - } - IfcGeom::BRepElement* brep = kernel.convert(settings, ifc_representation, product); if (!brep) { throw IfcParse::IfcException("Failed to process shape");