EgtMachKernel 1.8k1 :

- in simulazione passato parametro EMT.SBH a OnDispositionStarting e OnDispositionStart.
This commit is contained in:
Dario Sassi
2017-11-09 12:16:28 +00:00
parent 3bafdaa19c
commit 74a5047b6b
3 changed files with 22 additions and 11 deletions
+20 -9
View File
@@ -547,15 +547,20 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
pDisp->GetTable( sTable) ;
Point3d ptOri1 ;
pDisp->GetTableRef1( ptOri1) ;
// recupero la fase della disposizione
int nPhase = pDisp->GetPhase() ;
// recupero se con movimenti autonomi
bool bEmpty = pDisp->IsEmpty() ;
// recupero flag disposizione con movimenti manuali
bool bSomeByHand = pDisp->GetSomeByHand() ;
// se con movimenti autonomi
if ( ! pDisp->IsEmpty()) {
if ( ! bEmpty) {
// richiamo gestione evento appena prima di inizio disposizione
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, false)) {
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
// cambio fase
int nPhase = pDisp->GetPhase() ;
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
// aggiorno utensile e assi conseguenti
if ( ! UpdateTool( bFirst)) {
@@ -564,25 +569,27 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
}
++ m_nOpInd ;
// richiamo gestione evento inizio disposizione
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, false)) {
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
// se ci sono movimenti manuali, aggiorno visualizzazione e breve pausa (200 ms)
if ( bSomeByHand)
Sleep( 200) ;
break ;
}
// altrimenti disposizione passiva
else {
// richiamo gestione evento appena prima di inizio disposizione
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, true)) {
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
// cambio fase
int nPhase = pDisp->GetPhase() ;
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
++ m_nOpInd ;
// richiamo gestione evento inizio e fine disposizione
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, true) ||
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand) ||
! OnDispositionEnd()) {
nStatus = MCH_SIM_ERR ;
return false ;
@@ -890,7 +897,7 @@ Simulator::ManageMove( int& nStatus)
//----------------------------------------------------------------------------
bool
Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const string& sTable, const Point3d& ptOri1, bool bEmpty)
const string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand)
{
// assegno identificativo e indice disposizione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ;
@@ -902,6 +909,8 @@ Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABORI1, ptOri1) ;
// assegno flag disposizione passiva
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ;
// assegno flag disposizione con operazioni manuali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SBH, bSomeByHand) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_DISPOSITION_STARTING))
return true ;
@@ -915,7 +924,7 @@ Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
//----------------------------------------------------------------------------
bool
Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const string& sTable, const Point3d& ptOri1, bool bEmpty)
const string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand)
{
// assegno identificativo e indice disposizione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ;
@@ -927,6 +936,8 @@ Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABORI1, ptOri1) ;
// assegno flag disposizione passiva
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ;
// assegno flag disposizione con operazioni manuali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SBH, bSomeByHand) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_DISPOSITION_START))
return true ;