Prechádzať zdrojové kódy

# 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
aramis_acg 14 rokov pred
rodič
commit
af8533a0bf
1 zmenil súbory, kde vykonal 5 pridanie a 1 odobranie
  1. 5 1
      code/IFCReaderGen.cpp

+ 5 - 1
code/IFCReaderGen.cpp

@@ -1748,7 +1748,11 @@ template <> size_t GenericFill<IfcNamedUnit>(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<const ISDERIVED*>(&*arg)) { in->ObjectHelper<Assimp::IFC::IfcNamedUnit,2>::aux_is_derived[0]=true; break; }
-        try { GenericConvert( in->Dimensions, *arg, db ); break; } 
+        if (dynamic_cast<const UNSET*>(&*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