EgtExecutor 2.1i2 :

- aggiunta funzione Exe e Lua ExportSvg
- aggiunto riconoscimento file SVG.
This commit is contained in:
Dario Sassi
2019-09-16 15:26:14 +00:00
parent 011ab93d78
commit 922dc27c56
5 changed files with 71 additions and 7 deletions
+19 -2
View File
@@ -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)
+5 -3
View File
@@ -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) ;
+27
View File
@@ -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<IExportSvg> 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 ;
}
BIN
View File
Binary file not shown.
+20 -2
View File
@@ -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 ;
}