EgtExecutor 2.5l3 :

- aggiunta funzione Exe e Lua IsGhostPart
- aggiunta versione preliminare della funzione ExeDuploCountInRaw
- correzione su alcuni valori di ritorno di funzioni relative a MachMgr nel caso non ci sia il CurrMachMgr.
This commit is contained in:
Dario Sassi
2023-12-14 12:00:30 +01:00
parent d7711c3ec6
commit 318529688d
4 changed files with 81 additions and 6 deletions
+59
View File
@@ -344,6 +344,26 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
bool
ExeIsGhostPart( int nGhostId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico sia il segnaposto di un pezzo (Ghost)
if ( pGeomDB->GetGdbType( nGhostId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nGhostId) == GDB_ID_ROOT &&
ExeIsSystemObj( pGeomDB, nGhostId) &&
pGeomDB->ExistsInfo( nGhostId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nGhostId, GDB_SI_SOURCE, nPartId) ;
int nRawId = pGeomDB->GetParentId( nPartId) ;
if ( ExeIsRawPart( nRawId))
return true ;
}
return false ;
}
//-------------------------------------------------------------------------------
int
ExeGetFirstGhostPart( void)
@@ -735,6 +755,45 @@ ExeDuploCount( int nSouId, int& nCount)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploCountInRaw( int nSouId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico sia un pezzo
if ( ! IsPartForDuplo( pGeomDB, nSouId))
return false ;
// Recupero info del sorgente
INTVECTOR vnRef ;
pGeomDB->GetInfo( nSouId, GDB_SI_DUPLIST, vnRef) ;
// Conto i reali duplo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
// verifico sia un duplo
int nDupId = vnRef[i] ;
if ( ! ExeIsDuplo( nDupId))
continue ;
// verifico sia incluso in un grezzo di un gruppo di lavoro
INTVECTOR vnRef ;
if ( ! pGeomDB->GetInfo( nSouId, GDB_SI_LIST, vnRef))
continue ;
for ( auto& nId : vnRef) {
// verifico esista
if ( ! pGeomDB->ExistsObj( nId)) {
nId = GDB_ID_NULL ;
continue ;
}
// verifico sia in un grezzo
int nParent ;
}
// incremento contatore
++ nCount ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploList( int nSouId, INTVECTOR& vnRef)
+6 -6
View File
@@ -311,8 +311,8 @@ int
ExeGetMachGroupId( const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'indice della macchinata
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero l'identificativo della macchinata
return pMachMgr->GetMachGroupId( sName) ;
}
@@ -373,16 +373,16 @@ ExeAddPhase( void)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0)
// aggiungo una nuova fase di lavorazione alla macchinata corrente
int nId = pMachMgr->AddPhase() ;
int nInd = pMachMgr->AddPhase() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddPhase()"
" -- Id=" + ToString( nId) ;
" -- Ind=" + ToString( nInd) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
return nInd ;
}
//-----------------------------------------------------------------------------
@@ -471,7 +471,7 @@ bool
ExeIsRawPart( int nRawId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
VERIFY_MACHMGR( pMachMgr, false)
// verifico se è un grezzo della macchinata corrente
return pMachMgr->IsRawPart( nRawId) ;
}
BIN
View File
Binary file not shown.
+16
View File
@@ -277,6 +277,21 @@ LuaGetPrevLayer( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaIsGhostPart( lua_State* L)
{
// 1 parametro : nGhostId
int nGhostId ;
LuaCheckParam( L, 1, nGhostId)
LuaClearStack( L) ;
// verifico sia un segnaposto di pezzo messo in grezzo
bool bOk = ExeIsGhostPart( nGhostId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetFirstGhostPart( lua_State* L)
@@ -605,6 +620,7 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsGhostPart", LuaIsGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;