EgtExecutor :

- Aggiunto ExportThreeJs
This commit is contained in:
riccardo.elitropi
2022-08-22 17:55:00 +02:00
parent 130f40d2bc
commit 22fe5001d5
4 changed files with 66 additions and 0 deletions
+16
View File
@@ -52,6 +52,7 @@ 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_CREATEEEXEXECUTOR = "CreateExcExecutor" ;
@@ -359,6 +360,21 @@ 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)
+2
View File
@@ -28,6 +28,7 @@ class IImport3MF ;
class IExportDxf ;
class IExportStl ;
class IExport3MF ;
class IExportThreeJS ;
class IExportSvg ;
class IExcExecutor ;
@@ -52,5 +53,6 @@ IImport3MF* MyCreateImport3MF( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
IExcExecutor* MyCreateExcExecutor(void) ;
+28
View File
@@ -23,6 +23,7 @@
#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"
@@ -38,6 +39,7 @@
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EGrScene.h"
using namespace std ;
@@ -554,3 +556,29 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExportThreeJS( int nId, const string& sFilePath, const string& sFilePathM)
{
IEGrScene* pScene = GetCurrScene();
VERIFY_SCENE(pScene, false) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file per ThreeJS
// preparo l'esportatore
PtrOwner<IExportThreeJS> pExpThreeJS( MyCreateExportThreeJS()) ;
bOk = bOk && ! IsNull( pExpThreeJS) ;
// eseguo l'esportazione
bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, sFilePath, sFilePathM, pScene) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExportThreeJS(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
+20
View File
@@ -224,6 +224,25 @@ LuaExport3MF( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExportThreeJS( lua_State* L)
{
// 2 parametri, GroupId e path del file da esportare
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
string sFilePathM;
LuaCheckParam(L, 3, sFilePathM)
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportThreeJS( nGroupId, sFilePath, sFilePathM) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExportSvg( lua_State* L)
@@ -260,6 +279,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) ;
return bOk ;
}