EgtExecutor :

- aggiunta dell'Export 3dm.
This commit is contained in:
Daniele Bariletti
2023-10-23 14:32:57 +02:00
parent c0d456b6fb
commit f69116ea09
4 changed files with 65 additions and 0 deletions
+17
View File
@@ -10,6 +10,7 @@
// 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx.
// 23.10.23 DB Aggiunto Export3dm.
//
//----------------------------------------------------------------------------
@@ -52,6 +53,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_CREATEEXPORT3DM = "CreateExport3dm" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
@@ -361,6 +363,21 @@ MyCreateExport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
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 IExport3dm ;
class IExportThreeJS ;
class IExportSvg ;
class IExcExecutor ;
@@ -53,6 +54,7 @@ IImport3MF* MyCreateImport3MF( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
IExport3dm* MyCreateExport3dm( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
+26
View File
@@ -31,6 +31,7 @@
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -538,6 +539,31 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file 3dm
// preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExport3dm(" + 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)
+20
View File
@@ -245,6 +245,25 @@ LuaExport3MF( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExport3dm( 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 = ExeExport3dm( nGroupId, sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExportSvg( lua_State* L)
@@ -301,6 +320,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( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ;