From 922dc27c56fcd6ab75a6fbd5f0c2c5012e05f81a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 16 Sep 2019 15:26:14 +0000 Subject: [PATCH] EgtExecutor 2.1i2 : - aggiunta funzione Exe e Lua ExportSvg - aggiunto riconoscimento file SVG. --- DllExchange.cpp | 21 +++++++++++++++++++-- DllExchange.h | 8 +++++--- EXE_Exchange.cpp | 27 +++++++++++++++++++++++++++ EgtExecutor.rc | Bin 16176 -> 16176 bytes LUA_Exchange.cpp | 22 ++++++++++++++++++++-- 5 files changed, 71 insertions(+), 7 deletions(-) diff --git a/DllExchange.cpp b/DllExchange.cpp index e3eccd1..2a9f171 100644 --- a/DllExchange.cpp +++ b/DllExchange.cpp @@ -1,13 +1,14 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2018 +// EgalTech 2015-2019 //---------------------------------------------------------------------------- -// File : DllExchange.cpp Data : 03.07.18 Versione : 1.9g1 +// File : DllExchange.cpp Data : 15.09.19 Versione : 2.1h2 // Contenuto : Funzioni di gestione della libreria opzionale EgtExchange. // // // // Modifiche : 27.03.15 DS Creazione modulo. // 03.07.18 DS Aggiunto ImportPnt. +// 15.09.19 DS Aggiunto ExportSvg. // //---------------------------------------------------------------------------- @@ -44,6 +45,7 @@ static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ; static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ; static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ; static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ; +static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ; static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ; @@ -258,6 +260,21 @@ MyCreateExportStl( void) return pFun() ; } +//----------------------------------------------------------------------------- +IExportSvg* +MyCreateExportSvg( void) +{ + // verifico caricamento libreria EgtExchange + if ( s_hEEx == nullptr) + return nullptr ; + // recupero funzione creazione oggetto + typedef IExportSvg* (* PF_CreateExportSvg) ( void) ; + PF_CreateExportSvg pFun = (PF_CreateExportSvg)GetProcAddress( s_hEEx, EEX_CREATEEXPORTSVG) ; + if ( pFun == nullptr) + return nullptr ; + return pFun() ; +} + //----------------------------------------------------------------------------- IExcExecutor* MyCreateExcExecutor( void) diff --git a/DllExchange.h b/DllExchange.h index 9083a18..c6d3a02 100644 --- a/DllExchange.h +++ b/DllExchange.h @@ -1,8 +1,8 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2018 +// EgalTech 2015-2019 //---------------------------------------------------------------------------- -// File : DllGraphics.h Data : 03.07.18 Versione : 1.9g1 -// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtGraphics. +// File : DllGraphics.h Data : 15.09.19 Versione : 2.1i2 +// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange. // // // @@ -24,6 +24,7 @@ class IImportPnt ; class IImportStl ; class IExportDxf ; class IExportStl ; +class IExportSvg ; class IExcExecutor ; //---------------------------------------------------------------------------- @@ -41,4 +42,5 @@ IImportPnt* MyCreateImportPnt( void) ; IImportStl* MyCreateImportStl( void) ; IExportDxf* MyCreateExportDxf( void) ; IExportStl* MyCreateExportStl( void) ; +IExportSvg* MyCreateExportSvg( void) ; IExcExecutor* MyCreateExcExecutor(void) ; diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index b429c94..333fc2d 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -25,6 +25,7 @@ #include "/EgtDev/Include/EExImportCsf.h" #include "/EgtDev/Include/EExImportBtl.h" #include "/EgtDev/Include/EExExportStl.h" +#include "/EgtDev/Include/EExExportSvg.h" #include "/EgtDev/Include/EExExportDxf.h" #include "/EgtDev/Include/EExImportPnt.h" #include "/EgtDev/Include/EGnStringUtils.h" @@ -67,6 +68,8 @@ ExeGetFileType( const string& sFilePath) return FT_IMG ; else if ( sFileExt == "PNT" || sFileExt == "XYZ") return FT_PNT ; + else if ( sFileExt == "SVG") + return FT_SVG ; else if ( sFileExt == "TSC") return FT_TSC ; else if ( sFileExt == "LUA") @@ -302,3 +305,27 @@ ExeExportStl( int nId, const string& sFilePath) // restituisco il risultato return bOk ; } + +//----------------------------------------------------------------------------- +bool +ExeExportSvg( int nId, const string& sFilePath) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + bool bOk = true ; + // esporto il file SVG + // preparo l'esportatore + PtrOwner pExpSvg( MyCreateExportSvg()) ; + bOk = bOk && ! IsNull( pExpSvg) ; + // eseguo l'esportazione + bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtExportSvg(" + ToString( nId) + ",'" + + StringToLuaString( sFilePath) + "')" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco il risultato + return bOk ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 1fa636b5d1959b0eb840c92bfe193cab2e59d9c8..091743bd33728fc1dad629462770117db3cb2bed 100644 GIT binary patch delta 79 zcmdl`x1nysFE&P_&A-`PnSqoe*K!sx?>N)s4T4pSMw1=6k~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0C_7LTL1t6 delta 79 zcmdl`x1nysFE&QQ&A-`PnSqoe*K!sx?>N)s4T4pShLat+k~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0C(RTQvd(} diff --git a/LUA_Exchange.cpp b/LUA_Exchange.cpp index d410aac..50fb549 100644 --- a/LUA_Exchange.cpp +++ b/LUA_Exchange.cpp @@ -131,7 +131,7 @@ LuaExportDxf( lua_State* L) string sFilePath ; LuaCheckParam( L, 2, sFilePath) LuaClearStack( L) ; - // apro il file + // creo il file bool bOk = ExeExportDxf( nGroupId, sFilePath) ; // restituisco il risultato LuaSetParam( L, bOk) ; @@ -148,13 +148,30 @@ LuaExportStl( lua_State* L) string sFilePath ; LuaCheckParam( L, 2, sFilePath) LuaClearStack( L) ; - // apro il file + // creo il file bool bOk = ExeExportStl( nGroupId, sFilePath) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaExportSvg( lua_State* L) +{ + // 2 parametri, GroupId e path del file da esportare + int nGroupId ; + LuaCheckParam( L, 1, nGroupId) + string sFilePath ; + LuaCheckParam( L, 2, sFilePath) + LuaClearStack( L) ; + // creo il file + bool bOk = ExeExportSvg( nGroupId, sFilePath) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- bool LuaInstallExchange( LuaMgr& luaMgr) @@ -168,5 +185,6 @@ LuaInstallExchange( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ; return bOk ; }