From af8533a0bffb06239aa0c5d9f9a1f6a2f4a8d17d Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Mon, 30 May 2011 14:52:39 +0000 Subject: [PATCH] # IFC: add workaround to read malformed files that contain IFCSIUNIT elements with the first field not set, which is not allowed by the IFC2X3 specification. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1013 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/IFCReaderGen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/IFCReaderGen.cpp b/code/IFCReaderGen.cpp index 5c0e5fafb..2d5245e56 100644 --- a/code/IFCReaderGen.cpp +++ b/code/IFCReaderGen.cpp @@ -1748,7 +1748,11 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcNamedUnit"); } do { // convert the 'Dimensions' argument const DataType* arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Dimensions, *arg, db ); break; } + if (dynamic_cast(&*arg)) { + // (hack) allow this - I found some Ifc files which violate the spec here + break; + } + try { GenericConvert( in->Dimensions, *arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcNamedUnit to be a `IfcDimensionalExponents`")); } } while(0); do { // convert the 'UnitType' argument