EgtMachKernel 1.8d3 :
- al salvataggio DB utensili si scaricano tutti gli utensili dalle teste della macchina (se necessari verranno ricaricati con le eventuali nuove geometrie).
This commit is contained in:
Binary file not shown.
@@ -351,6 +351,7 @@ class MachMgr : public IMachMgr
|
||||
SetupMgr& GetCurrSetupMgr( void) const
|
||||
{ return const_cast<SetupMgr&>( m_stuMgr) ; }
|
||||
// Machines
|
||||
bool IsCurrMachineLoaded( void) const ;
|
||||
Machine* GetCurrMachine( void) const ;
|
||||
ToolsMgr* GetCurrToolsMgr( void) const ;
|
||||
MachiningsMgr* GetCurrMachiningsMgr( void) const ;
|
||||
|
||||
@@ -263,6 +263,12 @@ MachMgr::TdbSave( void) const
|
||||
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
|
||||
if ( pTsMgr == nullptr)
|
||||
return nullptr ;
|
||||
// se macchina caricata, ne scarico tutti gli utensili
|
||||
if ( IsCurrMachineLoaded()) {
|
||||
Machine* pMach = GetCurrMachine() ;
|
||||
if ( pMach != nullptr)
|
||||
pMach->UnloadAllTools() ;
|
||||
}
|
||||
// salvo il db utensili
|
||||
return pTsMgr->Save() ;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,17 @@ MachMgr::GetCurrMachineDir( string& sMachineDir) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsCurrMachineLoaded( void) const
|
||||
{
|
||||
// verifico validità indice macchina corrente
|
||||
if ( m_nCurrMch < 0 || m_nCurrMch >= int( m_vMachines.size()))
|
||||
return false ;
|
||||
// verifico esistenza gestore macchina
|
||||
return ( m_vMachines[m_nCurrMch].pMachine != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Machine*
|
||||
MachMgr::GetCurrMachine( void) const
|
||||
|
||||
@@ -57,8 +57,10 @@ class Machine
|
||||
int GetHeadExitCount( const std::string& sHead) const ;
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
||||
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ;
|
||||
bool UnloadTool( const string& sHead, int nExit) ;
|
||||
bool LoadTools( const string& sHead) ;
|
||||
bool UnloadTool( const std::string& sHead, int nExit) ;
|
||||
bool LoadTools( const std::string& sHead) ;
|
||||
bool UnloadTools( const std::string& sHead) ;
|
||||
bool UnloadAllTools( void) ;
|
||||
bool ResetHeadSet( const std::string& sHead) ;
|
||||
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
|
||||
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
|
||||
|
||||
+52
-21
@@ -173,10 +173,10 @@ Machine::LoadTools( const string& sHead)
|
||||
if ( ! m_pMchMgr->GetCurrSetupMgr().Exists())
|
||||
return true ;
|
||||
// recupero la testa
|
||||
Head* pHead = GetHead( GetGroup( sHead)) ;
|
||||
int nHdGrp = GetGroup( sHead) ;
|
||||
Head* pHead = GetHead( nHdGrp) ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
int nHdGrp = pHead->GetOwner() ;
|
||||
// ciclo su tutte le uscite
|
||||
for ( int nExit = 1 ; nExit <= pHead->GetExitCount() ; ++ nExit) {
|
||||
// recupero l'uscita
|
||||
@@ -201,6 +201,51 @@ Machine::LoadTools( const string& sHead)
|
||||
return EnableHeadInSet( sHead) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::UnloadTools( const string& sHead)
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero la testa
|
||||
int nHdGrp = GetGroup( sHead) ;
|
||||
Head* pHead = GetHead( nHdGrp) ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
// ciclo su tutte le uscite
|
||||
for ( int nExit = 1 ; nExit <= pHead->GetExitCount() ; ++ nExit) {
|
||||
// recupero l'uscita
|
||||
string sExit = MCH_EXIT + ToString( nExit) ;
|
||||
int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
|
||||
Exit* pExit = GetExit( nExGrp) ;
|
||||
if ( pExit == nullptr)
|
||||
continue ;
|
||||
// pulisco il gruppo dell'uscita
|
||||
m_pGeomDB->EmptyGroup( nExGrp) ;
|
||||
pExit->SetTool( "") ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::UnloadAllTools( void)
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// ciclo su tutte le teste
|
||||
bool bOk = true ;
|
||||
for each ( const auto& snGro in m_mapGroups) {
|
||||
if ( IsHeadGroup( snGro.second)) {
|
||||
if ( ! UnloadTools( snGro.first))
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::ResetHeadSet( const string& sHead)
|
||||
@@ -213,26 +258,12 @@ Machine::ResetHeadSet( const string& sHead)
|
||||
if ( vsHSet.empty())
|
||||
return false ;
|
||||
// ciclo su tutte le teste dell'insieme per svuotarle
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vsHSet.size() ; ++ i) {
|
||||
// recupero il gruppo della testa
|
||||
int nHdGrp = GetGroup( vsHSet[i]) ;
|
||||
if ( ! IsHeadGroup( nHdGrp))
|
||||
return false ;
|
||||
// ciclo sulle sue uscite
|
||||
for ( int j = 1 ; true ; ++ j) {
|
||||
// recupero il gruppo dell'uscita
|
||||
string sExit = MCH_EXIT + ToString( j) ;
|
||||
int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
|
||||
// recupero l'oggetto uscita
|
||||
Exit* pExit = GetExit( nExGrp) ;
|
||||
if ( pExit == nullptr)
|
||||
break ;
|
||||
// pulisco il gruppo dell'uscita
|
||||
m_pGeomDB->EmptyGroup( nExGrp) ;
|
||||
pExit->SetTool( "") ;
|
||||
}
|
||||
if ( ! UnloadTools( vsHSet[i]))
|
||||
bOk = false ;
|
||||
// visualizzo solo la prima testa
|
||||
m_pGeomDB->SetMode( nHdGrp, ( i == 0 ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
|
||||
m_pGeomDB->SetMode( GetGroup( sHead), ( i == 0 ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
|
||||
}
|
||||
return true ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user