EgtMachKernel 2.2k4 :

- aggiunta gestione stringa di errore o avvertimento da PostApply delle lavorazioni e da SpecialApply delle disposizioni.
This commit is contained in:
Dario Sassi
2020-11-16 12:10:07 +00:00
parent aed3ebe4d1
commit e2164dfc57
15 changed files with 102 additions and 42 deletions
+6 -2
View File
@@ -621,8 +621,12 @@ Chiseling::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2912, sErr) ;
else
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
return false ;
}
+17 -11
View File
@@ -1315,15 +1315,16 @@ Disposition::SpecialApply( bool bRecalc)
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_TABNAME = ".TABNAME" ; // IN (string) nome della tavola macchina
static const string EVAR_DISPID = ".DISPID" ; // IN (int) identificativo della disposizione
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
static const string EVAR_TABNAME = ".TABNAME" ; // IN (string) nome della tavola macchina
static const string EVAR_DISPID = ".DISPID" ; // IN (int) identificativo della disposizione
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore o warning ( opzionale)
static const string EVAR_HEAD = ".HEAD" ; // OUT (string) nome della testa
static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita
static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita
static const string EVAR_TCPOS = ".TCPOS" ; // OUT (string) nome della posizione nel TC
static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
// eseguo l'azione
bool bOk = true ;
@@ -1344,20 +1345,25 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SHIFTS, m_nShifts) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SBH, m_bSomeByHand) ;
// recupero valori parametri opzionali
if ( bOk)
pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos) ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos) ;
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori ed esco
if ( ! bOk || nErr > 0) {
m_nShifts = - 1 ;
string sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 2006, sOut) ;
return false ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = " Warning in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_SPECIAL_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( 2053, sOut) ;
}
+6 -2
View File
@@ -640,8 +640,12 @@ Drilling::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2113, "Error in Drilling : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2113, sErr) ;
else
m_pMchMgr->SetLastError( 2113, "Error in Drilling : post apply not calculable") ;
return false ;
}
BIN
View File
Binary file not shown.
+6 -2
View File
@@ -665,8 +665,12 @@ GenMachining::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2808, sErr) ;
else
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
return false ;
}
+18 -8
View File
@@ -305,7 +305,7 @@ Machining::ToolPreview( int nEntId, int nFlag) const
//----------------------------------------------------------------------------
bool
Machining::PostApply( void)
Machining::PostApply( string& sErr)
{
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
@@ -313,9 +313,10 @@ Machining::PostApply( void)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
// eseguo l'azione
@@ -331,14 +332,23 @@ Machining::PostApply( void)
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// recupero valori parametri opzionali
// ...
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
if ( ! bOk || nErr > 0) {
bOk = false ;
string sOut = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
sErr = sMsg ;
if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
+1 -1
View File
@@ -53,7 +53,7 @@ class Machining : public Operation
protected :
Machining( void) ;
bool PostApply( void) ;
bool PostApply( std::string& sErr) ;
} ;
//----------------------------------------------------------------------------
+6 -2
View File
@@ -835,8 +835,12 @@ Milling::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2321, sErr) ;
else
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -641,8 +641,12 @@ Mortising::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2511, sErr) ;
else
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -720,8 +720,12 @@ Pocketing::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2427, "Error in Pocketing : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2427, sErr) ;
else
m_pMchMgr->SetLastError( 2427, "Error in Pocketing : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -633,8 +633,12 @@ SawFinishing::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2715, sErr) ;
else
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -597,8 +597,12 @@ SawRoughing::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2615, "Error in SawRoughing : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2615, sErr) ;
else
m_pMchMgr->SetLastError( 2615, "Error in SawRoughing : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -771,8 +771,12 @@ Sawing::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2219, sErr) ;
else
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -626,8 +626,12 @@ SurfFinishing::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 3120, "Error in SurfFinishing : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 3120, sErr) ;
else
m_pMchMgr->SetLastError( 3120, "Error in SurfFinishing : post apply not calculable") ;
return false ;
}
+6 -2
View File
@@ -757,8 +757,12 @@ WaterJetting::Update( bool bPostApply)
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 3218, "Error in WaterJetting : post apply not calculable") ;
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 3218, sErr) ;
else
m_pMchMgr->SetLastError( 3218, "Error in WaterJetting : post apply not calculable") ;
return false ;
}