EgtMachKernel :

- in simulazione dopo una collisione si evidenziano i gruppi che l'hanno prodotta, al riavvio del movimento si torna alla visualizzazione standard.
This commit is contained in:
Dario Sassi
2024-07-22 16:13:39 +02:00
parent b1232ac9d3
commit db580f95d2
2 changed files with 41 additions and 0 deletions
+38
View File
@@ -276,6 +276,9 @@ Simulator::Move( int& nStatus)
m_pPerfCnt->Start() ;
}
// reset visualizzazione collisioni
ResetCollisionMark() ;
// Se arrivato alla fine dell'interpolazione
if ( m_dCoeff > COEFF_LIM) {
// recupero una nuova entità
@@ -453,6 +456,8 @@ Simulator::GoHome( void)
// controllo validità stato
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr || m_pMachine == nullptr)
return false ;
// reset visualizzazione collisioni
ResetCollisionMark() ;
// reset stato macchina
OnResetMachine() ;
// porto la macchina in home
@@ -1509,6 +1514,34 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::SetCollisionMark( int nCdInd, int nObjInd)
{
if ( m_pGeomDB == nullptr)
return false ;
m_nCollMarkId.clear() ;
int nCdGeoId = m_pGeomDB->GetParentId( m_pGeomDB->GetParentId( m_CdId[nCdInd])) ;
int nCoGeoId = m_pGeomDB->GetParentId( m_pGeomDB->GetParentId( m_CollObj[nObjInd].nFrameId)) ;
m_nCollMarkId.push_back( nCdGeoId) ;
m_nCollMarkId.push_back( nCoGeoId) ;
for ( auto nId : m_nCollMarkId)
m_pGeomDB->SetMark( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::ResetCollisionMark( void)
{
if ( m_pGeomDB == nullptr)
return false ;
for ( auto nId : m_nCollMarkId)
m_pGeomDB->ResetMark( nId) ;
m_nCollMarkId.clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::OnInit( void)
@@ -2069,6 +2102,10 @@ Simulator::OnCollision( int nCdInd, int nObjInd, int& nErr)
nErr = ERR_COLLISION ;
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
}
// evidenzio le geometrie in collisione
if ( nErr == ERR_COLLISION)
SetCollisionMark( nCdInd, nObjInd) ;
return ( nErr == 0) ;
}
@@ -2336,6 +2373,7 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
if ( ExeGetEnableUI()) {
// Box di messaggio : Collisione! AVVERTIMENTO
ExeMessageBox( ExeGetMsg( 5319), ExeGetMsg( 5315), MB_OK | MB_ICONWARNING) ;
ExeDraw() ;
// Gestione Pausa
m_nUiStatus = MCH_UISIM_PAUSE ;
while ( m_nUiStatus == MCH_UISIM_PAUSE) {