EgtExecutor :

- modifiche per impostazione dati interprete lua a Exchange
- aggiunta funzione Exe/Lua CreateSurfTmEmpty.
This commit is contained in:
Dario Sassi
2025-01-23 12:08:06 +01:00
parent 6c410ecd95
commit 67fa0dd6f0
5 changed files with 60 additions and 1 deletions
+16
View File
@@ -42,6 +42,7 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
static const char* EEX_SETEEXKEY = "SetEExKey" ;
static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ;
static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ;
static const char* EEX_SETBTLLUADATA = "SetBtlLuaData" ;
static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ;
static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ;
static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ;
@@ -184,6 +185,21 @@ MySetBtlAuxDir( const string& sBtlAuxDir)
return pFun( sBtlAuxDir) ;
}
//-----------------------------------------------------------------------------
bool
MySetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool (* PF_SetBtlLuaData) ( const string& sLuaLibsDir, const string& sLuaLastRequire) ;
PF_SetBtlLuaData pFun = (PF_SetBtlLuaData)GetProcAddress( s_hEEx, EEX_SETBTLLUADATA) ;
if ( pFun == nullptr)
return false ;
return pFun( sLuaLibsDir, sLuaLastRequire) ;
}
//-----------------------------------------------------------------------------
IBeamMgr*
MyCreateBeamMgr( void)
+1
View File
@@ -42,6 +42,7 @@ void MySetEExKey( const std::string& sKey) ;
void MySetEExNetHwKey( bool bNetHwKey) ;
const char* MyGetEExVersion( void) ;
bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ;
bool MySetBtlLuaData( const std::string& sLuaLibsDir, const std::string& sLuaLastRequire) ;
IBeamMgr* MyCreateBeamMgr( void) ;
IImportBtl* MyCreateImportBtl( void) ;
IImportBtlx* MyCreateImportBtlx( void) ;
+2 -1
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "LUA_Base.h"
#include "AuxTools.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
@@ -126,7 +127,7 @@ ExeGetFileType( const string& sFilePath)
bool
ExeSetBtlAuxDir( const string& sBtlAuxDir)
{
return MySetBtlAuxDir( sBtlAuxDir) ;
return MySetBtlAuxDir( sBtlAuxDir) && MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
}
//-----------------------------------------------------------------------------
+22
View File
@@ -348,6 +348,28 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmEmpty( int nParentId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// creo la superficie vuota
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshEmpty()) ;
// inserisco la superficie nel DB
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmEmpty(" + IdToString( nParentId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& vtN, const BBox3d& b3Box, int nRefType)
+19
View File
@@ -171,6 +171,24 @@ LuaCreateSurfFrFatCurve( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmEmpty( lua_State* L)
{
// 1 parametro : ParentId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
LuaClearStack( L) ;
// creo STM vuoto
int nId = ExeCreateSurfTmEmpty( nParentId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmPlaneInBBox( lua_State* L)
@@ -1290,6 +1308,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrDisk", LuaCreateSurfFrDisk) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrFatCurve", LuaCreateSurfFrFatCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFlatRegion", LuaCreateSurfFlatRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmEmpty", LuaCreateSurfTmEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPlaneInBBox", LuaCreateSurfTmPlaneInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConvexHullInBBox", LuaCreateSurfTmConvexHullInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBBox", LuaCreateSurfTmBBox) ;