EgtExecutor :
- aggiunta gestione ImportPly di EgtExchange - aggiunta funzione Exe/Lua ImportPly.
This commit is contained in:
@@ -52,6 +52,7 @@ static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
|
||||
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
|
||||
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
|
||||
static const char* EEX_CREATEIMPORTOFF = "CreateImportOff" ;
|
||||
static const char* EEX_CREATEIMPORTPLY = "CreateImportPly" ;
|
||||
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
|
||||
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
|
||||
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
|
||||
@@ -335,6 +336,21 @@ MyCreateImportOff( void)
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportPly*
|
||||
MyCreateImportPly( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IImportPly* (* PF_CreateImportPly) ( void) ;
|
||||
PF_CreateImportPly pFun = (PF_CreateImportPly)GetProcAddress( s_hEEx, EEX_CREATEIMPORTPLY) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImport3MF*
|
||||
MyCreateImport3MF( void)
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2024
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllExchange.h Data : 28.11.24 Versione : 2.6k3
|
||||
// File : DllExchange.h Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
|
||||
//
|
||||
//
|
||||
@@ -25,6 +25,7 @@ class IImportDxf ;
|
||||
class IImportPnt ;
|
||||
class IImportStl ;
|
||||
class IImportOff ;
|
||||
class IImportPly ;
|
||||
class IImport3MF ;
|
||||
class IExportDxf ;
|
||||
class IExportStl ;
|
||||
@@ -52,6 +53,7 @@ IImportDxf* MyCreateImportDxf( void) ;
|
||||
IImportPnt* MyCreateImportPnt( void) ;
|
||||
IImportStl* MyCreateImportStl( void) ;
|
||||
IImportOff* MyCreateImportOff( void) ;
|
||||
IImportPly* MyCreateImportPly( void) ;
|
||||
IImport3MF* MyCreateImport3MF( void) ;
|
||||
IExportDxf* MyCreateExportDxf( void) ;
|
||||
IExportStl* MyCreateExportStl( void) ;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "/EgtDev/Include/EExImportBtl.h"
|
||||
#include "/EgtDev/Include/EExImportBtlx.h"
|
||||
#include "/EgtDev/Include/EExImportOff.h"
|
||||
#include "/EgtDev/Include/EExImportPly.h"
|
||||
#include "/EgtDev/Include/EExExportDxf.h"
|
||||
#include "/EgtDev/Include/EExExportStl.h"
|
||||
#include "/EgtDev/Include/EExExport3MF.h"
|
||||
@@ -81,6 +82,8 @@ ExeGetFileType( const string& sFilePath)
|
||||
return FT_OBJ ;
|
||||
else if ( sFileExt == "OFF")
|
||||
return FT_OFF ;
|
||||
else if ( sFileExt == "PLY")
|
||||
return FT_PLY ;
|
||||
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
|
||||
return FT_CNC ;
|
||||
else if ( sFileExt == "HED" || sFileExt == "ENT" || sFileExt == "ENS")
|
||||
@@ -405,6 +408,42 @@ ExeImportOff( const string& sFilePath, double dScaleFactor)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImportPly( const string& sFilePath, double dScaleFactor)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file PLY
|
||||
// aggiungo un gruppo pezzo e un gruppo layer
|
||||
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImportPly> pImpPly( MyCreateImportPly()) ;
|
||||
bOk = bOk && ! IsNull( pImpPly) ;
|
||||
// eseguo l'importazione
|
||||
bOk = bOk && pImpPly->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
|
||||
// aggiorno stato file corrente
|
||||
if ( pGseCtx->m_sFilePath.empty())
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtImportPly('" + StringToLuaString( sFilePath) + "'," +
|
||||
ToString( dScaleFactor) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// scrivo il log
|
||||
if ( ! IsNull( pImpPly)) {
|
||||
string sLog = "Import File " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sLog.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImport3MF( const string& sFilePath, int nFlag)
|
||||
|
||||
@@ -171,6 +171,23 @@ LuaImportOff( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImportPly( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
double dScaleFactor = 1.0 ;
|
||||
LuaGetParam( L, 2, dScaleFactor) ;
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportPly( sFilePath, dScaleFactor) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImport3MF( lua_State* L)
|
||||
@@ -352,6 +369,7 @@ LuaInstallExchange( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportOff", LuaImportOff) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPly", LuaImportPly) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3dm", LuaImport3dm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
|
||||
|
||||
Reference in New Issue
Block a user