EgtExecutor 2.1g4 :

- aggiunte funzioni lua EgtSetVal e EgtGetVal (imposto e leggo su stringa Key=Val)
- aggiunta funzione lua EgtSimulate (simulazione in cieco per verifica collisioni e corse)
- aggiunte funzioni ExeSetEnableUI e ExeGetEnableUI per disabilitare e riabilitare aggiornamenti interfaccia utente.
This commit is contained in:
Dario Sassi
2019-07-22 07:45:37 +00:00
parent fa333e3e57
commit 407cfaa87d
7 changed files with 264 additions and 24 deletions
+68 -1
View File
@@ -2676,7 +2676,7 @@ ExeSimExit( void)
}
//-----------------------------------------------------------------------------
// Generazione e Stima T&L
// Generazione, Stima T&L e Simulazione
//-----------------------------------------------------------------------------
bool
ExeGenerate( const string& sCncFile, const string& sInfo)
@@ -2732,6 +2732,73 @@ ExeEstimate( const string& sEstFile, const string& sInfo)
return pMachMgr->Estimate( sMyEstFile, sInfo) ;
}
//-----------------------------------------------------------------------------
bool
ExeSimulate( int& nErr, std::string& sError)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// inizializzo lo stato
bool bContinue = true ;
nErr = SHE_NONE ;
sError = "" ;
// disabilito UI
ExeSetEnableUI( false) ;
// avvio simulazione
if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) {
// inutile continuare con simulazione se avvio non riuscito
bContinue = false ;
// assegno il codice di errore
nErr = SHE_INIT ;
// assegno stringa di errore
sError = "Starting simulation failed" ;
ExeOutLog( sError, 1) ;
}
pMachMgr->SimSetStep( 50) ;
// ciclo di simulazione
while ( bContinue) {
int nStat ;
bContinue = pMachMgr->SimMove( nStat) ;
// gestione errori
if ( nStat == MCH_SIM_OUTSTROKE) {
// assegno il codice di errore
nErr = SHE_OUTSTROKE ;
// recupero stringa di errore
sError = pMachMgr->GetOutstrokeInfo( ExeUiUnitsAreMM()) ;
ExeOutLog( sError, 1) ;
}
else if ( nStat == MCH_SIM_DIR_ERR) {
// assegno il codice di errore
nErr = SHE_DIR_ERR ;
// assegno stringa di errore
sError = "Tool direction unreachable" ;
ExeOutLog( sError, 1) ;
}
else if ( nStat == MCH_SIM_COLLISION) {
// assegno il codice di errore
nErr = SHE_COLLISION ;
// recupero stringa di errore
if ( pMachMgr->GetLastErrorId() != 0)
sError = pMachMgr->GetLastErrorString() ;
else
sError = "Found collision head-part" ;
ExeOutLog( sError, 1) ;
}
else if ( nStat == MCH_SIM_ERR) {
// assegno il codice di errore
nErr = SHE_GENERAL ;
// assegno stringa di errore
sError = "General failure (contact supplier)" ;
ExeOutLog( sError, 1) ;
}
}
// terminazione simulazione
pMachMgr->SimExit() ;
// riabilito UI
ExeSetEnableUI( true) ;
return ( nErr == 0) ;
}
//-----------------------------------------------------------------------------
// Machine Calc
//-----------------------------------------------------------------------------