diff --git a/DllExchange.cpp b/DllExchange.cpp index 3473f30..c9964a2 100644 --- a/DllExchange.cpp +++ b/DllExchange.cpp @@ -40,7 +40,6 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ; static const char* EEX_SETEEXKEY = "SetEExKey" ; static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ; static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ; -static const char* EEX_SETTHREEJSAUXDIR = "SetThreeJSAuxDir" ; static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ; static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ; static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ; @@ -53,8 +52,9 @@ static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ; static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ; static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ; static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ; -static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ; static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ; +static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ; +static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ; static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ; @@ -181,22 +181,6 @@ MySetBtlAuxDir( const string& sBtlAuxDir) return pFun( sBtlAuxDir) ; } -//----------------------------------------------------------------------------- -bool -MySetThreeJSAuxDir( const string& sThreeJSAuxDir ) -{ - // verifico caricamento libreria EgtExchange - if ( s_hEEx == nullptr) - return false ; - // recupero funzione creazione oggetto - typedef bool ( *PF_SetThreeJSAuxDir)( const string& sThreeJSAuxDir) ; - PF_SetThreeJSAuxDir pFun = ( PF_SetThreeJSAuxDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSAUXDIR) ; - if ( pFun == nullptr) - return false ; - return pFun( sThreeJSAuxDir) ; -} - - //----------------------------------------------------------------------------- IBeamMgr* MyCreateBeamMgr( void) @@ -377,21 +361,6 @@ MyCreateExport3MF( void) return pFun() ; } -//----------------------------------------------------------------------------- -IExportThreeJS* -MyCreateExportThreeJS( void) -{ - // verifico caricamento libreria EgtExchange - if ( s_hEEx == nullptr) - return nullptr ; - // recupero funzione creazione oggetto - typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ; - PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ; - if ( pFun == nullptr) - return nullptr ; - return pFun() ; -} - //----------------------------------------------------------------------------- IExportSvg* MyCreateExportSvg( void) @@ -407,6 +376,36 @@ MyCreateExportSvg( void) return pFun() ; } +//----------------------------------------------------------------------------- +bool +MySetThreeJSLibDir( const string& sThreeJSLibDir) +{ + // verifico caricamento libreria EgtExchange + if ( s_hEEx == nullptr) + return false ; + // recupero funzione creazione oggetto + typedef bool ( *PF_SetThreeJSLibDir)( const string& sThreeJSLibDir) ; + PF_SetThreeJSLibDir pFun = ( PF_SetThreeJSLibDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSLIBDIR) ; + if ( pFun == nullptr) + return false ; + return pFun( sThreeJSLibDir) ; +} + +//----------------------------------------------------------------------------- +IExportThreeJS* +MyCreateExportThreeJS( void) +{ + // verifico caricamento libreria EgtExchange + if ( s_hEEx == nullptr) + return nullptr ; + // recupero funzione creazione oggetto + typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ; + PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ; + if ( pFun == nullptr) + return nullptr ; + return pFun() ; +} + //----------------------------------------------------------------------------- IExcExecutor* MyCreateExcExecutor( void) diff --git a/DllExchange.h b/DllExchange.h index b5231dd..2c60b89 100644 --- a/DllExchange.h +++ b/DllExchange.h @@ -41,7 +41,6 @@ void MySetEExKey( const std::string& sKey) ; void MySetEExNetHwKey( bool bNetHwKey) ; const char* MyGetEExVersion( void) ; bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ; -bool MySetThreeJSAuxDir( const std::string& sThreeJSAuxDir) ; IBeamMgr* MyCreateBeamMgr( void) ; IImportBtl* MyCreateImportBtl( void) ; IImportBtlx* MyCreateImportBtlx( void) ; @@ -54,6 +53,7 @@ IImport3MF* MyCreateImport3MF( void) ; IExportDxf* MyCreateExportDxf( void) ; IExportStl* MyCreateExportStl( void) ; IExport3MF* MyCreateExport3MF( void) ; +bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ; IExportThreeJS* MyCreateExportThreeJS( void) ; IExportSvg* MyCreateExportSvg( void) ; IExcExecutor* MyCreateExcExecutor(void) ; diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index 342f270..fd8fde1 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -23,7 +23,6 @@ #include "/EgtDev/Include/EExImportDxf.h" #include "/EgtDev/Include/EExImportStl.h" #include "/EgtDev/Include/EExImport3MF.h" -#include "/EgtDev/Include/EExExportThreeJS.h" #include "/EgtDev/Include/EExImportCnc.h" #include "/EgtDev/Include/EExImportCsf.h" #include "/EgtDev/Include/EExImportPnt.h" @@ -33,6 +32,7 @@ #include "/EgtDev/Include/EExExportStl.h" #include "/EgtDev/Include/EExExport3MF.h" #include "/EgtDev/Include/EExExportSvg.h" +#include "/EgtDev/Include/EExExportThreeJS.h" #include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EgtStringConverter.h" @@ -100,6 +100,8 @@ ExeGetFileType( const string& sFilePath) return FT_VRML ; else if ( sFileExt == "C3D") return FT_C3D ; + else if ( sFileExt == "HTML") + return FT_HTML ; else if ( sFileExt == "TSC") return FT_TSC ; else if ( sFileExt == "LUA") @@ -119,14 +121,6 @@ ExeSetBtlAuxDir( const string& sBtlAuxDir) return MySetBtlAuxDir( sBtlAuxDir) ; } -//----------------------------------------------------------------------------- -bool -ExeSetThreeJSAuxDir( const string & sThreeJSAuxDir ) -{ - return MySetThreeJSAuxDir( sThreeJSAuxDir) ; -} - - //----------------------------------------------------------------------------- bool ExeImportBtl( const string& sFilePath, int nFlag) @@ -567,6 +561,13 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter) return bOk ; } +//----------------------------------------------------------------------------- +bool +ExeSetThreeJSLibDir( const string& sThreeJSLibDir) +{ + return MySetThreeJSLibDir( sThreeJSLibDir) ; +} + //----------------------------------------------------------------------------- bool ExeExportThreeJS( int nId, const string& sFilePath, int nFilter) @@ -583,12 +584,13 @@ ExeExportThreeJS( int nId, const string& sFilePath, int nFilter) // eseguo l'esportazione bOk = bOk && pExpThreeJS->SetOptions( nFilter) ; - bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, sFilePath, pScene, ExeUiUnitsAreMM()) ; + bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, pScene, ExeUiUnitsAreMM(), sFilePath) ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtExportThreeJS(" + ToString( nId) + ",'" + - StringToLuaString( sFilePath) + "')" + - " -- Ok=" + ToString( bOk) ; + StringToLuaString( sFilePath) + "'," + + ToString( nFilter) + ")" + + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 938443c..125e1ac 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_Exchange.cpp b/LUA_Exchange.cpp index 6099081..fc45e4f 100644 --- a/LUA_Exchange.cpp +++ b/LUA_Exchange.cpp @@ -190,7 +190,7 @@ LuaAdvancedImport( lua_State* L) static int LuaExportDxf( lua_State* L) { - // 2 o 3 parametri, GroupId e path del file da esportare [, Flag] + // 2 o 3 parametri : GroupId e path del file da esportare [, Flag] int nGroupId ; LuaCheckParam( L, 1, nGroupId) string sFilePath ; @@ -209,7 +209,7 @@ LuaExportDxf( lua_State* L) static int LuaExportStl( lua_State* L) { - // 2 parametri, GroupId e path del file da esportare + // 2 parametri : GroupId e path del file da esportare int nGroupId ; LuaCheckParam( L, 1, nGroupId) string sFilePath ; @@ -226,7 +226,7 @@ LuaExportStl( lua_State* L) static int LuaExport3MF( lua_State* L) { - // 2 parametri, GroupId e path del file da esportare + // 2 parametri : GroupId e path del file da esportare int nGroupId ; LuaCheckParam( L, 1, nGroupId) string sFilePath ; @@ -239,30 +239,11 @@ LuaExport3MF( lua_State* L) return 1 ; } -//------------------------------------------------------------------------------- -static int -LuaExportThreeJS( lua_State* L) -{ - // 2 o 3 parametri, GroupId e path del file da esportare [, Filter] - int nGroupId ; - LuaCheckParam( L, 1, nGroupId) - string sFilePath ; - LuaCheckParam( L, 2, sFilePath) - int nFilter = EEXFLT_DEFAULT; - LuaGetParam( L, 3, nFilter); - LuaClearStack( L) ; - // creo il file - bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ; - // restituisco il risultato - LuaSetParam( L, bOk) ; - return 1 ; -} - //------------------------------------------------------------------------------- static int LuaExportSvg( lua_State* L) { - // 2 o 3 parametri, GroupId, Path del file da esportare [, Filter] + // 2 o 3 parametri : GroupId, Path del file da esportare [, Filter] int nGroupId ; LuaCheckParam( L, 1, nGroupId) string sFilePath ; @@ -277,6 +258,25 @@ LuaExportSvg( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaExportThreeJS( lua_State* L) +{ + // 2 o 3 parametri : GroupId, Path del file da esportare [, Filter] + int nGroupId ; + LuaCheckParam( L, 1, nGroupId) + string sFilePath ; + LuaCheckParam( L, 2, sFilePath) + int nFilter = EEXFLT_DEFAULT ; + LuaGetParam( L, 3, nFilter) ; + LuaClearStack( L) ; + // creo il file + bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- bool LuaInstallExchange( LuaMgr& luaMgr) @@ -295,7 +295,7 @@ LuaInstallExchange( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ; return bOk ; }