EgtMachKernel 1.6n4 :

- migliorie a gestione fasi
- migliorie a gestione spezzatura grezzi.
This commit is contained in:
Dario Sassi
2016-02-15 07:45:43 +00:00
parent a8c34397be
commit bbb25a4fec
10 changed files with 409 additions and 83 deletions
+46 -6
View File
@@ -31,7 +31,7 @@ MachMgr::AddPhase( void)
string sTable ;
int nDispId = GetFirstOperation() ;
while ( nDispId != GDB_ID_NULL) {
const Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
const Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
if ( pDisp != nullptr)
pDisp->GetTable( sTable) ;
nDispId = GetNextOperation( nDispId) ;
@@ -47,7 +47,7 @@ MachMgr::AddPhase( void)
return 0 ;
// assegno la tavola della disposizione precedente
if ( ! sTable.empty()) {
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
pDisp->SetTable( sTable) ;
}
@@ -120,7 +120,7 @@ MachMgr::PrepareCurrPhase( int nPhase, bool bDoDisp)
Disposition* pDisp = nullptr ;
nDispId = GetFirstOperation() ;
while ( nDispId != GDB_ID_NULL) {
pDisp = GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
if ( pDisp != nullptr && pDisp->GetPhase() == nPhase)
break ;
else
@@ -161,11 +161,51 @@ MachMgr::GetCurrPhase( void) const
bool
MachMgr::RemoveLastPhase( void)
{
if ( m_pGeomDB == nullptr)
return false ;
// non è possibile rimuovere la prima e unica fase
if ( m_nPhasesCount <= 1)
return false ;
// imposto le relative lavorazioni come disattivate e senza fase
// elimino i grezzi appartenenti a questa sola fase e la relativa disposizione
// cancello le eventuali lavorazioni della fase
int nOperId = GetLastOperation() ;
while ( nOperId != GDB_ID_NULL) {
if ( GetOperationType( nOperId) != OPER_DISP && GetOperationPhase( nOperId) == m_nPhasesCount) {
if ( m_nCurrMachiningId == nOperId)
m_nCurrMachiningId = GDB_ID_NULL ;
m_pGeomDB->Erase( nOperId) ;
}
else
break ;
nOperId = GetLastOperation() ;
}
// aggiorno i grezzi ed elimino quelli appartenenti a questa sola fase
int nRawId = GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) {
// prossimo grezzo
int nNextRawId = GetNextRawPart( nRawId) ;
// recupero le fasi in cui è presente il grezzo
INTVECTOR vPhase ;
if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
// se appartiene alla fase
auto iIter = find( vPhase.begin(), vPhase.end(), m_nPhasesCount) ;
if ( iIter != vPhase.end()) {
// se appartiene solo a questa fase, lo elimino
if ( vPhase.size() == 1)
RemoveRawPart( nRawId) ;
// altrimenti aggiorno l'elenco delle fasi di appartenenza
else {
vPhase.erase( iIter) ;
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, vPhase) ;
}
}
// passo al prossimo
nRawId = nNextRawId ;
}
// elimino la disposizione di fase
int nDispId = GetLastOperation() ;
if ( GetOperationType( nDispId) == OPER_DISP && GetOperationPhase( nDispId) == m_nPhasesCount)
m_pGeomDB->Erase( nDispId) ;
// se era corrente, rendo corrente la precedente
if ( m_nCurrPhase == m_nPhasesCount)
SetCurrPhase( m_nCurrPhase - 1) ;
@@ -188,7 +228,7 @@ MachMgr::CalcPhaseCount( void) const
int nPhases = 0 ;
int nDispId = GetFirstOperation() ;
while ( nDispId != GDB_ID_NULL) {
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nDispId)) ;
if ( pDisp != nullptr)
nPhases = max( nPhases, pDisp->GetPhase()) ;
nDispId = GetNextOperation( nDispId) ;