diff --git a/code/DXFLoader.cpp b/code/DXFLoader.cpp index 9a13caa33..c8aee18dd 100644 --- a/code/DXFLoader.cpp +++ b/code/DXFLoader.cpp @@ -119,9 +119,18 @@ DXFImporter::~DXFImporter() // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool DXFImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const -{ - return SimpleExtensionCheck(pFile,"dxf"); +bool DXFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const { + const std::string& extension = GetExtension( pFile ); + if ( extension == "dxf" ) { + return true; + } + + if ( extension.empty() || checkSig ) { + static const char *pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" }; + return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 4 ); + } + + return false; } // ------------------------------------------------------------------------------------------------ diff --git a/doc/dox.h b/doc/dox.h index 067592438..bc47e5584 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -173,7 +173,6 @@ cmake CMakeLists.txt A project-file of your default make-system ( like gnu-make on linux or Visual-Studio on Windows ) will be generated. Run the build and you are done. You can find the libs at assimp/lib and the dll's / so's at bin. - @section assimp_dll Windows DLL Build The Assimp-package can be built as DLL. You just need to run the default cmake run. diff --git a/test/models/DXF/lineTest b/test/models/DXF/lineTest new file mode 100644 index 000000000..2e16f69fd --- /dev/null +++ b/test/models/DXF/lineTest @@ -0,0 +1,190 @@ +999 +VISION3D DXF +0 +SECTION +2 +HEADER +9 +$ACADVER +1 +AC1006 +9 +$INSBASE +10 +0.0 +20 +0.0 +30 +0.0 +9 +$EXTMIN +10 +0.0 +20 +0.0 +9 +$EXTMAX +10 +1000.0 +20 +1000.0 +9 +$LINMIN +10 +0.0 +20 +0.0 +9 +$LINMAX +10 +1000.0 +20 +1000.0 +0 +ENDSEC +0 +SECTION +2 +TABLES +0 +TABLE +2 +LTYPE +70 +1 +0 +LTYPE +2 +CONTINUOUS +70 +64 +3 +Solid line +72 +65 +73 +0 +40 +0.000000 +0 +ENDTAB +0 +TABLE +2 +LAYER +70 +6 +0 +LAYER +2 +1 +70 +64 +62 +7 +6 +CONTINUOUS +0 +ENDTAB +0 +TABLE +2 +STYLE +70 +0 +0 +ENDTAB +0 +ENDSEC +0 +SECTION +2 +BLOCKS +0 +ENDSEC +0 +SECTION +2 +ENTITIES +0 +3DFACE +8 +1 +62 +1 +10 +-0.5 +20 +-0.5 +30 +-0.5 +11 +-0.5 +21 +0.5 +31 +-0.5 +12 +0.5 +22 +0.5 +32 +-0.5 +13 +0.5 +23 +-0.5 +33 +-0.5 +0 +3DFACE +8 +1 +62 +1 +10 +-0.5 +20 +-0.5 +30 +-0.5 +11 +0.5 +21 +-0.5 +31 +-0.5 +12 +0 +22 +-0.5 +32 +0.5 +13 +0 +23 +-0.5 +33 +0.5 +0 +LINE +8 +1 +62 +1 +10 +0 +20 +-0.5 +30 +0.5 +11 +0 +21 +0.5 +31 +-0.5 +0 +ENDSEC +0 +EOF diff --git a/test/unit/utDXFImporterExporter.cpp b/test/unit/utDXFImporterExporter.cpp index 1cb23cccf..ee6f34ecd 100644 --- a/test/unit/utDXFImporterExporter.cpp +++ b/test/unit/utDXFImporterExporter.cpp @@ -62,3 +62,10 @@ public: TEST_F( utDXFImporterExporter, importDXFFromFileTest ) { EXPECT_TRUE( importerTest() ); } + +TEST_F( utDXFImporterExporter, importerWithoutExtensionTest ) { + Assimp::Importer importer; + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/DXF/lineTest", aiProcess_ValidateDataStructure ); + EXPECT_NE( nullptr, scene ); +} +