EgtExecutor :
- aggiunte funzioni exe e lua CopyEx e CopyGlobEx.
This commit is contained in:
@@ -44,3 +44,6 @@ bool ExeInsertDuplo( int nInsGrp) ;
|
||||
//----------------------------------------------------------------------------
|
||||
bool ExeCreateMutex( const std::string& sMutexName) ;
|
||||
bool ExeReleaseMutex( void) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool ExeSetModified( int nCtx) ;
|
||||
|
||||
+75
-40
@@ -18,6 +18,7 @@
|
||||
#include "GeoTools.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkMultiGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUiUnits.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
@@ -300,16 +301,39 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
string sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCopyEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
// recupero i due GeomDB
|
||||
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
|
||||
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
|
||||
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
|
||||
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
|
||||
// risolvo l'Id di riferimento per destinazione
|
||||
nRefId = AdjustId( nRefId, nDestCtx) ;
|
||||
// eseguo la copia
|
||||
int nNewId = Copy( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
||||
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCopyEx(" + ToString( nSouCtx) + "," +
|
||||
ToString( nSouId) + "," +
|
||||
ToString( nDestCtx) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
@@ -330,16 +354,39 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
string sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
// recupero i due GeomDB
|
||||
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
|
||||
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
|
||||
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
|
||||
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
|
||||
// risolvo l'Id di riferimento per destinazione
|
||||
nRefId = AdjustId( nRefId, nDestCtx) ;
|
||||
// eseguo la copia
|
||||
int nNewId = CopyGlob( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
|
||||
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCopyGlobEx(" + ToString( nSouCtx) + "," +
|
||||
ToString( nSouId) + "," +
|
||||
ToString( nDestCtx) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
@@ -358,16 +405,10 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
string sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
@@ -386,16 +427,10 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
string sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
IdToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
|
||||
+13
-1
@@ -226,6 +226,18 @@ ExeSetModified( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetModified( int nCtx)
|
||||
{
|
||||
GseContext* pGseCtx = GetGseContext( nCtx) ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
// se consentito, imposto il flag
|
||||
if ( pGseCtx->m_bEnableModified)
|
||||
pGseCtx->m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeResetModified( void)
|
||||
@@ -387,7 +399,7 @@ ExeInsertFile( const string& sFilePath)
|
||||
class CamStatus
|
||||
{
|
||||
public :
|
||||
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) {
|
||||
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0), m_nCurrMachining( GDB_ID_NULL) {
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
if ( pMachMgr == nullptr)
|
||||
return ;
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
AdjustId( int nId)
|
||||
AdjustId( int nId, int nCtx)
|
||||
{
|
||||
GseContext* pCtx = GetCurrGseContext() ;
|
||||
GseContext* pCtx = ( nCtx == 0 ? GetCurrGseContext() : GetGseContext( nCtx));
|
||||
VERIFY_CTX( pCtx, GDB_ID_NULL)
|
||||
if ( nId == GDB_ID_CURRPART)
|
||||
return pCtx->m_nCurrPart ;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Sistemo Id per pezzo o layer correnti
|
||||
int AdjustId( int nId) ;
|
||||
int AdjustId( int nId, int nCtx = 0) ;
|
||||
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
|
||||
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ;
|
||||
// Vettore espresso nel riferimento RefType partendo da vettore nel riferimento locale
|
||||
|
||||
@@ -489,6 +489,32 @@ LuaCopy( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopyEx( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
|
||||
int nSouCtx ;
|
||||
LuaCheckParam( L, 1, nSouCtx)
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 2, nSouId)
|
||||
int nDestCtx ;
|
||||
LuaCheckParam( L, 3, nDestCtx)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 4, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 5, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la copia
|
||||
int nNewId = ExeCopyEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopyGlob( lua_State* L)
|
||||
@@ -511,6 +537,32 @@ LuaCopyGlob( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopyGlobEx( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
|
||||
int nSouCtx ;
|
||||
LuaCheckParam( L, 1, nSouCtx)
|
||||
int nSouId ;
|
||||
LuaCheckParam( L, 2, nSouId)
|
||||
int nDestCtx ;
|
||||
LuaCheckParam( L, 3, nDestCtx)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 4, nRefId)
|
||||
int nSonBeforeAfter = GDB_LAST_SON ;
|
||||
LuaGetParam( L, 5, nSonBeforeAfter) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la copia
|
||||
int nNewId = ExeCopyGlobEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRelocate( lua_State* L)
|
||||
@@ -663,7 +715,9 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
|
||||
|
||||
Reference in New Issue
Block a user