From 5c059cd69defad55232e431548b5aabde97a1fe9 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 8 Sep 2021 08:38:26 +0200 Subject: [PATCH] EgtExecutor 2.3i1 : - aggiunte funzione Exe e Lua Export3MF. --- DllExchange.cpp | 16 ++++++++++++++++ DllExchange.h | 2 ++ EXE_Exchange.cpp | 25 +++++++++++++++++++++++++ EgtExecutor.rc | Bin 16176 -> 16176 bytes LUA_Exchange.cpp | 18 ++++++++++++++++++ 5 files changed, 61 insertions(+) diff --git a/DllExchange.cpp b/DllExchange.cpp index 1926a7c..45e7a90 100644 --- a/DllExchange.cpp +++ b/DllExchange.cpp @@ -50,6 +50,7 @@ static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ; 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_CREATEEXPORTSVG = "CreateExportSvg" ; static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ; @@ -325,6 +326,21 @@ MyCreateExportStl( void) return pFun() ; } +//----------------------------------------------------------------------------- +IExport3MF* +MyCreateExport3MF( void) +{ + // verifico caricamento libreria EgtExchange + if ( s_hEEx == nullptr) + return nullptr ; + // recupero funzione creazione oggetto + typedef IExport3MF* (* PF_CreateExport3MF) ( void) ; + PF_CreateExport3MF pFun = (PF_CreateExport3MF)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3MF) ; + if ( pFun == nullptr) + return nullptr ; + return pFun() ; +} + //----------------------------------------------------------------------------- IExportSvg* MyCreateExportSvg( void) diff --git a/DllExchange.h b/DllExchange.h index 304f3db..382f3ae 100644 --- a/DllExchange.h +++ b/DllExchange.h @@ -27,6 +27,7 @@ class IImportStl ; class IImport3MF ; class IExportDxf ; class IExportStl ; +class IExport3MF ; class IExportSvg ; class IExcExecutor ; @@ -49,5 +50,6 @@ IImportStl* MyCreateImportStl( void) ; IImport3MF* MyCreateImport3MF( void) ; IExportDxf* MyCreateExportDxf( void) ; IExportStl* MyCreateExportStl( void) ; +IExport3MF* MyCreateExport3MF( void) ; IExportSvg* MyCreateExportSvg( void) ; IExcExecutor* MyCreateExcExecutor(void) ; diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index dea9d13..270d7fb 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -30,6 +30,7 @@ #include "/EgtDev/Include/EExImportBtlx.h" #include "/EgtDev/Include/EExExportDxf.h" #include "/EgtDev/Include/EExExportStl.h" +#include "/EgtDev/Include/EExExport3MF.h" #include "/EgtDev/Include/EExExportSvg.h" #include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnFileUtils.h" @@ -501,6 +502,30 @@ ExeExportStl( int nId, const string& sFilePath) return bOk ; } +//----------------------------------------------------------------------------- +bool +ExeExport3MF( int nId, const string& sFilePath) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + bool bOk = true ; + // esporto il file STL + // preparo l'esportatore + PtrOwner pExp3MF( MyCreateExport3MF()) ; + bOk = bOk && ! IsNull( pExp3MF) ; + // eseguo l'esportazione + bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtExport3MF(" + ToString( nId) + ",'" + + StringToLuaString( sFilePath) + "')" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco il risultato + return bOk ; +} + //----------------------------------------------------------------------------- bool ExeExportSvg( int nId, const string& sFilePath, int nFilter) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 17e66f5c8204650bb7629059ab4afda35fe3f6f8..71449851cabcddbeec4171341c0e1e709ba2ead1 100644 GIT binary patch delta 103 zcmdl`x1nysH#SyF1|0^&&A-{4nVBoOp`YVR)EAOJ8~s&?h~?r$(psNd^E~Z61pN delta 103 zcmdl`x1nysH#Sxa1|0^Y&A-{4nVBoOp`YVR)EAOJ8~s&?h~?r$(psNd^E~RUV4~ diff --git a/LUA_Exchange.cpp b/LUA_Exchange.cpp index 03a7b8e..6ba146e 100644 --- a/LUA_Exchange.cpp +++ b/LUA_Exchange.cpp @@ -207,6 +207,23 @@ LuaExportStl( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaExport3MF( 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 = ExeExport3MF( nGroupId, sFilePath) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaExportSvg( lua_State* L) @@ -242,6 +259,7 @@ LuaInstallExchange( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ; return bOk ; }