EgtMachKernel 2.2d4 :

- aggiunta gestione TcPos (posizioni di cambio utensile) da configurazione macchina
- aggiunte funzioni GetToolsInCurrSetupPos, GetTcPosId e GetAllTcPosNames.
This commit is contained in:
Dario Sassi
2020-04-27 07:27:23 +00:00
parent c841813162
commit f31aacdc14
15 changed files with 380 additions and 26 deletions
+48 -15
View File
@@ -39,6 +39,22 @@ Machine::GetAllHeadsNames( STRVECTOR& vNames) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAllTcPosNames( STRVECTOR& vNames) const
{
// reset lista nomi
vNames.clear() ;
// ricerca delle posizioni di cambio utensile
for ( const auto& snGro : m_mapGroups) {
if ( IsTcPosGroup( snGro.second))
vNames.push_back( snGro.first) ;
}
// ordino alfabeticamente
sort( vNames.begin(), vNames.end()) ;
return true ;
}
//----------------------------------------------------------------------------
int
Machine::GetHeadExitCount( const string& sHead) const
@@ -89,21 +105,38 @@ Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il gruppo della testa
// recupero il gruppo dell' oggetto
int nHdGrp = GetGroup( sHead) ;
if ( ! IsHeadGroup( nHdGrp))
// se testa
if ( IsHeadGroup( nHdGrp)) {
// cerco il gruppo dell'uscita in quello della testa
string sExit = MCH_EXIT + ToString( nExit) ;
int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
Exit* pExit = GetExit( nExGrp) ;
if ( pExit == nullptr)
return false ;
// inserisco l'utensile nell'uscita
if ( ! LoadTool( pExit, sTool))
return false ;
// abilito la testa
return EnableHeadInSet( sHead) ;
}
// se posizione cambio utensile
else if ( IsTcPosGroup( nHdGrp)) {
// cerco il gruppo dell'uscita in quello della posizione cambio utensile
string sExit = MCH_EXIT + ToString( nExit) ;
int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
Exit* pExit = GetExit( nExGrp) ;
if ( pExit == nullptr)
return false ;
// inserisco l'utensile nell'uscita
if ( ! LoadTool( pExit, sTool))
return false ;
// abilito la posizione cambio utensile
return m_pGeomDB->SetStatus( nHdGrp, GDB_ST_ON) ;
}
// altrimenti errore
return false ;
// cerco il gruppo dell'uscita in quello della testa
string sExit = MCH_EXIT + ToString( nExit) ;
int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
Exit* pExit = GetExit( nExGrp) ;
if ( pExit == nullptr)
return false ;
// inserisco l'utensile nell'uscita
if ( ! LoadTool( pExit, sTool))
return false ;
// abilito la testa
return EnableHeadInSet( sHead) ;
}
//----------------------------------------------------------------------------
@@ -192,9 +225,9 @@ Machine::UnloadTool( const string& sHead, int nExit)
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il gruppo della testa
// recupero il gruppo della testa o della posizione nel cambio utensili
int nHdGrp = GetGroup( sHead) ;
if ( ! IsHeadGroup( nHdGrp))
if ( ! IsHeadGroup( nHdGrp) && ! IsTcPosGroup( nHdGrp))
return false ;
// cerco il gruppo dell'uscita in quello della testa
string sExit = MCH_EXIT + ToString( nExit) ;