EgtExecutor 1.6n3 :

- modifiche per gestione fasi di lavorazione (EXE e LUA).
This commit is contained in:
Dario Sassi
2016-02-11 10:21:25 +00:00
parent 52bdabb7ea
commit 285da9d4e8
4 changed files with 145 additions and 1 deletions
+4 -1
View File
@@ -348,14 +348,17 @@ ExeSaveFile( const string& sFilePath, int nFlag)
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se ero in CAM, esco
int nCurrMachGroup = ExeGetCurrMachGroup() ;
int nCurrPhase = ExeGetCurrPhase() ;
ExeResetCurrMachGroup() ;
// imposto path corrente del file
pGseCtx->m_sFilePath = sFilePath ;
// salvo il file
bool bOk = pGseCtx->m_pGeomDB->Save( GDB_ID_ROOT, sFilePath, nFlag) ;
// eventuale ripristino precedente CAM
if ( nCurrMachGroup != GDB_ID_NULL)
if ( nCurrMachGroup != GDB_ID_NULL) {
ExeSetCurrMachGroup( nCurrMachGroup) ;
ExeSetCurrPhase( nCurrPhase) ;
}
// aggiorno stato file corrente
if ( bOk)
ExeResetModified() ;
+61
View File
@@ -228,6 +228,48 @@ ExeGetCurrMachGroup( void)
return pMachMgr->GetCurrMachGroup() ;
}
//-----------------------------------------------------------------------------
// Phases
//-----------------------------------------------------------------------------
int
ExeAddPhase( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0)
// aggiungo una nuova fase di lavorazione alla macchinata corrente
return pMachMgr->AddPhase() ;
}
//-----------------------------------------------------------------------------
bool
ExeSetCurrPhase( int nPhase)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto la fase di lavorazione corrente nella macchinata corrente
return pMachMgr->SetCurrPhase( nPhase) ;
}
//-----------------------------------------------------------------------------
int
ExeGetCurrPhase( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la fase di lavorazione corrente nella macchinata corrente
return pMachMgr->GetCurrPhase() ;
}
//-----------------------------------------------------------------------------
int
ExeGetPhaseCount( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0)
// recupero il numero totale di fasi di lavorazione della macchinata corrente
return pMachMgr->GetPhaseCount() ;
}
//-----------------------------------------------------------------------------
// Raw Parts & Parts
//-----------------------------------------------------------------------------
@@ -360,6 +402,25 @@ ExeModifyRawPartHeight( int nRawId, double dHeight)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeKeepRawPart( int nRawId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_MACHMGR( pGseCtx, false)
// confermo il grezzo nella fase corrente della macchinata corrente
bool bOk = pGseCtx->m_pMachMgr->KeepRawPart( nRawId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtKeepRawPart(" + ToString( nRawId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveRawPart( int nRawId)
BIN
View File
Binary file not shown.
+80
View File
@@ -222,6 +222,65 @@ LuaGetCurrMachGroup( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
// Phases
//-------------------------------------------------------------------------------
static int
LuaAddPhase( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// aggiungo una nuova fase di lavorazione alla macchinata corrente
int nPhase = ExeAddPhase() ;
// restituisco il risultato
if ( nPhase > 0)
LuaSetParam( L, nPhase) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetCurrPhase( lua_State* L)
{
// 1 parametro : nPhase
int nPhase ;
LuaCheckParam( L, 1, nPhase)
LuaClearStack( L) ;
// imposto la fase di lavorazione corrente nella macchinata corrente
bool bOk = ExeSetCurrPhase( nPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetCurrPhase( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero la fase di lavorazione corrente nella macchinata corrente
int nCount = ExeGetCurrPhase() ;
// restituisco il risultato
LuaSetParam( L, nCount) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetPhaseCount( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero il numero totale di fasi di lavorazione nella macchinata corrente
int nCount = ExeGetPhaseCount() ;
// restituisco il risultato
LuaSetParam( L, nCount) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Raw Parts & Parts
//-------------------------------------------------------------------------------
@@ -358,6 +417,21 @@ LuaModifyRawPartHeight( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaKeepRawPart( lua_State* L)
{
// 1 parametro : nRawId
int nRawId ;
LuaCheckParam( L, 1, nRawId)
LuaClearStack( L) ;
// confermo il grezzo nella fase corrente della macchinata corrente
bool bOk = ExeKeepRawPart( nRawId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveRawPart( lua_State* L)
@@ -1978,6 +2052,11 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrMachGroup", LuaSetCurrMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtResetCurrMachGroup", LuaResetCurrMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrMachGroup", LuaGetCurrMachGroup) ;
// Phases
bOk = bOk && luaMgr.RegisterFunction( "EgtAddPhase", LuaAddPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrPhase", LuaSetCurrPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrPhase", LuaGetCurrPhase) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseCount", LuaGetPhaseCount) ;
// Raw Parts & Parts
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRawPartCount", LuaGetRawPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
@@ -1986,6 +2065,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartHeight", LuaModifyRawPartHeight) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepRawPart", LuaKeepRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveRawPart", LuaRemoveRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateRawPart", LuaRotateRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCornerRawPart", LuaMoveToCornerRawPart) ;