EgtMachKernel :
- aggiunta gestione attivazione e stato di visualizzazione di una operazione.
This commit is contained in:
+2
-2
@@ -164,7 +164,7 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
|
||||
|
||||
// ciclo su tutte le operazioni della macchinata
|
||||
int nInd = 0 ;
|
||||
int nOpId = m_pMchMgr->GetFirstOperation() ;
|
||||
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
while ( bOk && nOpId != GDB_ID_NULL) {
|
||||
// incremento l'indice della operazione
|
||||
++ nInd ;
|
||||
@@ -191,7 +191,7 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
|
||||
break ;
|
||||
}
|
||||
// passo alla operazione successiva
|
||||
nOpId = m_pMchMgr->GetNextOperation( nOpId) ;
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
}
|
||||
|
||||
// evento fine programma
|
||||
|
||||
@@ -149,11 +149,19 @@ class MachMgr : public IMachMgr
|
||||
virtual int GetNextOperation( int nId) const ;
|
||||
virtual int GetLastOperation( void) const ;
|
||||
virtual int GetPrevOperation( int nId) const ;
|
||||
virtual int GetFirstActiveOperation( void) const ;
|
||||
virtual int GetNextActiveOperation( int nId) const ;
|
||||
virtual int GetLastActiveOperation( void) const ;
|
||||
virtual int GetPrevActiveOperation( int nId) const ;
|
||||
virtual int GetOperationType( int nId) const ;
|
||||
virtual std::string GetOperationName( int nId) const ;
|
||||
virtual int GetOperationId( const std::string& sName) const ;
|
||||
virtual bool RemoveOperation( int nId) ;
|
||||
virtual bool RemoveAllOperations( bool bExceptFirstDisp) ;
|
||||
virtual bool SetOperationMode( int nId, bool bActive) ;
|
||||
virtual bool SetAllOperationsMode( bool bExceptFirstDisp, bool bActive) ;
|
||||
virtual bool SetOperationStatus( int nId, bool bShow) ;
|
||||
virtual bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) ;
|
||||
// Operations : dispositions
|
||||
virtual int AddDisposition( const std::string& sName) ;
|
||||
// Operations : machinings
|
||||
|
||||
+106
-5
@@ -95,10 +95,58 @@ MachMgr::GetPrevOperation( int nId) const
|
||||
if ( m_pGeomDB->GetParentId( nId) != nOperGrpId)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il precedente sottogruppo
|
||||
int nNextId = m_pGeomDB->GetPrevGroup( nId) ;
|
||||
int nPrevId = m_pGeomDB->GetPrevGroup( nId) ;
|
||||
return nPrevId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetFirstActiveOperation( void) const
|
||||
{
|
||||
int nId = GetFirstOperation() ;
|
||||
int nMode ;
|
||||
while ( nId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
nId = GetNextOperation( nId) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetNextActiveOperation( int nId) const
|
||||
{
|
||||
int nNextId = GetNextOperation( nId) ;
|
||||
int nMode ;
|
||||
while ( nNextId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
nNextId = GetNextOperation( nNextId) ;
|
||||
return nNextId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetLastActiveOperation( void) const
|
||||
{
|
||||
int nId = GetLastOperation() ;
|
||||
int nMode ;
|
||||
while ( nId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
nId = GetPrevOperation( nId) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetPrevActiveOperation( int nId) const
|
||||
{
|
||||
int nPrevId = GetPrevOperation( nId) ;
|
||||
int nMode ;
|
||||
while ( nPrevId != GDB_ID_NULL &&
|
||||
m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN)
|
||||
nPrevId = GetPrevOperation( nPrevId) ;
|
||||
return nPrevId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetOperationType( int nId) const
|
||||
@@ -217,12 +265,65 @@ MachMgr::RemoveAllOperations( bool bExceptFirstDisp)
|
||||
// indice terminazione ciclo
|
||||
int nStopId = ( bExceptFirstDisp ? GetFirstOperation() : GDB_ID_NULL) ;
|
||||
// rimuovo tutte le operazioni a partire dalla fine
|
||||
int nOperId = GetLastOperation() ;
|
||||
while ( nOperId != nStopId) {
|
||||
RemoveOperation( nOperId) ;
|
||||
nOperId = GetLastOperation() ;
|
||||
int nId = GetLastOperation() ;
|
||||
while ( nId != GDB_ID_NULL && nId != nStopId) {
|
||||
RemoveOperation( nId) ;
|
||||
nId = GetLastOperation() ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetOperationMode( int nId, bool bActive)
|
||||
{
|
||||
// verifico sia una Operazione
|
||||
if ( GetOperationType( nId) == OPER_NULL)
|
||||
return false ;
|
||||
// eseguo attivazione/disattivazione
|
||||
m_pGeomDB->SetMode( nId, ( bActive ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetAllOperationsMode( bool bExceptFirstDisp, bool bActive)
|
||||
{
|
||||
// modifico lo stato di tutte le operazioni
|
||||
int nId = ( bExceptFirstDisp ? GetNextOperation( GetFirstOperation()) : GetFirstOperation()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo attivazione/disattivazione
|
||||
m_pGeomDB->SetMode( nId, ( bActive ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
|
||||
// passo alla successiva
|
||||
nId = GetNextOperation( nId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetOperationStatus( int nId, bool bShow)
|
||||
{
|
||||
// verifico sia una Operazione
|
||||
if ( GetOperationType( nId) == OPER_NULL)
|
||||
return false ;
|
||||
// eseguo cambio di stato di visualizzazione
|
||||
m_pGeomDB->SetStatus( nId, ( bShow ? GDB_ST_ON : GDB_ST_OFF)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetAllOperationsStatus( bool bExceptFirstDisp, bool bShow)
|
||||
{
|
||||
// modifico lo stato di tutte le operazioni
|
||||
int nId = ( bExceptFirstDisp ? GetNextOperation( GetFirstOperation()) : GetFirstOperation()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// eseguo cambio di stato di visualizzazione
|
||||
m_pGeomDB->SetStatus( nId, ( bShow ? GDB_ST_ON : GDB_ST_OFF)) ;
|
||||
// passo alla successiva
|
||||
nId = GetNextOperation( nId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -654,7 +654,7 @@ Machining::AdjustStartMovements(void)
|
||||
return false ;
|
||||
|
||||
// recupero la lavorazione precedente
|
||||
int nPrevOpId = m_pMchMgr->GetPrevOperation( m_nOwnerId) ;
|
||||
int nPrevOpId = m_pMchMgr->GetPrevActiveOperation( m_nOwnerId) ;
|
||||
Machining* pPrevMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nPrevOpId)) ;
|
||||
// recupero l'utensile precedente e i dati della sua testa
|
||||
string sPrevTool ;
|
||||
|
||||
@@ -330,6 +330,7 @@ Sawing::Preview( bool bRecalc)
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nAuxId, MCH_AUX) ;
|
||||
m_pGeomDB->SetStatus( nAuxId, GDB_ST_OFF) ;
|
||||
bChain = true ;
|
||||
}
|
||||
// altrimenti, se chiesto ricalcolo, lo svuoto
|
||||
@@ -387,6 +388,7 @@ Sawing::Apply( bool bRecalc)
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nAuxId, MCH_AUX) ;
|
||||
m_pGeomDB->SetStatus( nAuxId, GDB_ST_OFF) ;
|
||||
bChain = true ;
|
||||
}
|
||||
// altrimenti, se chiesto ricalcolo, lo svuoto
|
||||
|
||||
+4
-4
@@ -65,13 +65,13 @@ Simulator::Start( void)
|
||||
if ( nMachGrp == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifico la disposizione iniziale della macchinata
|
||||
int nOpId = m_pMchMgr->GetFirstOperation() ;
|
||||
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
if ( m_pMchMgr->GetOperationType( nOpId) != OPER_DISP)
|
||||
return false ;
|
||||
// cerco la prima lavorazione
|
||||
nOpId = m_pMchMgr->GetNextOperation( nOpId) ;
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
while ( nOpId != GDB_ID_NULL && ! IsValidMachiningType( m_pMchMgr->GetOperationType( nOpId)))
|
||||
nOpId = m_pMchMgr->GetNextOperation( nOpId) ;
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
if ( nOpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_nOpId = nOpId ;
|
||||
@@ -118,7 +118,7 @@ Simulator::Move( int& nStatus)
|
||||
}
|
||||
// Se arrivato alla fine di una lavorazione, recupero la successiva
|
||||
while ( m_nCLPathId == GDB_ID_NULL) {
|
||||
m_nOpId = m_pMchMgr->GetNextOperation( m_nOpId) ;
|
||||
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
|
||||
// se non ce ne sono altre, sono alla fine
|
||||
if ( m_nOpId == GDB_ID_NULL) {
|
||||
nStatus = MCH_SIM_END ;
|
||||
|
||||
Reference in New Issue
Block a user