EgtExecutor :

- migliorato backup e restore stato CAM al salvataggio
- aggiunta gestione modifica parametri lavorazioni per impostazione progetto modificato.
This commit is contained in:
Dario Sassi
2016-11-09 14:06:41 +00:00
parent 20e88e8211
commit e9cf46d220
2 changed files with 62 additions and 15 deletions
+46 -7
View File
@@ -358,25 +358,64 @@ ExeInsertFile( const string& sFilePath)
return bOk ;
}
//-----------------------------------------------------------------------------
class CamStatus
{
public :
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) {
IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr)
return ;
m_nCurrMachGroup = pMachMgr->GetCurrMachGroup() ;
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
m_nCurrPhase = pMachMgr->GetCurrPhase() ;
if ( m_nCurrPhase == 0)
return ;
int nId = pMachMgr->GetPhaseDisposition( m_nCurrPhase) ;
while ( nId != GDB_ID_NULL && pMachMgr->GetOperationPhase( nId) == m_nCurrPhase) {
bool bShow = false ;
pMachMgr->GetOperationStatus( nId, bShow) ;
m_vIdStat.push_back( ( bShow ? nId : - nId)) ;
nId = pMachMgr->GetNextOperation( nId) ;
}
}
void Restore( void) {
IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr)
return ;
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
pMachMgr->SetCurrMachGroup( m_nCurrMachGroup) ;
if ( m_nCurrPhase == 0)
return ;
pMachMgr->SetCurrPhase( m_nCurrPhase, true) ;
for ( auto nId : m_vIdStat) {
pMachMgr->SetOperationStatus( abs( nId), ( nId > 0)) ;
}
}
private :
int m_nCurrMachGroup ;
int m_nCurrPhase ;
INTVECTOR m_vIdStat ;
} ;
//-----------------------------------------------------------------------------
bool
ExeSaveFile( const string& sFilePath, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se ero in CAM, esco
int nCurrMachGroup = ExeGetCurrMachGroup() ;
int nCurrPhase = ExeGetCurrPhase() ;
// se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ;
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) {
ExeSetCurrMachGroup( nCurrMachGroup) ;
ExeSetCurrPhase( nCurrPhase, true) ;
}
CurrCamStatus.Restore() ;
// aggiorno stato file corrente
if ( bOk)
ExeResetModified() ;
+16 -8
View File
@@ -1858,8 +1858,10 @@ ExeSetMachiningParam( int nType, bool bVal)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto un parametro alla lavorazione corrente
bool bOk = pMachMgr->SetMachiningParam( nType, bVal) ;
ExeSetModified() ;
bool bChanged ;
bool bOk = pMachMgr->SetMachiningParam( nType, bVal, &bChanged) ;
if ( bChanged)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," +
@@ -1877,8 +1879,10 @@ ExeSetMachiningParam( int nType, int nVal)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto un parametro alla lavorazione corrente
bool bOk = pMachMgr->SetMachiningParam( nType, nVal) ;
ExeSetModified() ;
bool bChanged ;
bool bOk = pMachMgr->SetMachiningParam( nType, nVal, &bChanged) ;
if ( bChanged)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," +
@@ -1896,8 +1900,10 @@ ExeSetMachiningParam( int nType, double dVal)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto un parametro alla lavorazione corrente
bool bOk = pMachMgr->SetMachiningParam( nType, dVal) ;
ExeSetModified() ;
bool bChanged ;
bool bOk = pMachMgr->SetMachiningParam( nType, dVal, &bChanged) ;
if ( bChanged)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," +
@@ -1915,8 +1921,10 @@ ExeSetMachiningParam( int nType, const string& sVal)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto un parametro alla lavorazione corrente
bool bOk = pMachMgr->SetMachiningParam( nType, sVal) ;
ExeSetModified() ;
bool bChanged ;
bool bOk = pMachMgr->SetMachiningParam( nType, sVal, &bChanged) ;
if ( bChanged)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," +