EgtMachKernel 1.6e1 :

- aggiunta prima versione di caricamento delle macchine.
This commit is contained in:
Dario Sassi
2015-05-04 07:33:53 +00:00
parent 5943d66dad
commit ec420de8ef
10 changed files with 183 additions and 35 deletions
+19 -17
View File
@@ -93,8 +93,9 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
if ( sName.empty() || GetMachGroupId( sName) != GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esistenza della macchina
// !!!! TO DO !!!!
// verifica ed eventuale caricamento della macchina
if ( ! LoadMachine( sMachineName))
return GDB_ID_NULL ;
// inserisco il gruppo in coda
int nNewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nMachBaseId, GLOB_FRM) ;
if ( nNewId == GDB_ID_NULL)
@@ -103,9 +104,6 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
m_pGeomDB->SetName( nNewId, sName) ;
// assegno la macchina
m_pGeomDB->SetInfo( nNewId, MACH_MACHINE_KEY, sMachineName) ;
// creo il sottogruppo per la macchina
int nGeoMachId = m_pGeomDB->AddGroup( GDB_ID_NULL, nNewId, GLOB_FRM) ;
m_pGeomDB->SetName( nGeoMachId, MACH_GEOM_GROUP) ;
// creo il sottogruppo per l'attrezzaggio
int nSetupId = m_pGeomDB->AddGroup( GDB_ID_NULL, nNewId, GLOB_FRM) ;
m_pGeomDB->SetName( nSetupId, MACH_SETUP_GROUP) ;
@@ -161,11 +159,12 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
// verifica collegamento a DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// verifica della macchina
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
// scansiono i sottogruppi
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bMGeo = false ;
bool bSetup = false ;
bool bRaw = false ;
bool bOper = false ;
@@ -173,12 +172,7 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
while ( bIter) {
string sName ;
if ( pIter->GetName( sName)) {
if ( sName == MACH_GEOM_GROUP) {
if ( ! bMGeo)
mgData.MGeoGroupId = pIter->GetId() ;
bMGeo = true ;
}
else if ( sName == MACH_SETUP_GROUP) {
if ( sName == MACH_SETUP_GROUP) {
if ( ! bSetup)
mgData.SetupGroupId = pIter->GetId() ;
bSetup = true ;
@@ -197,7 +191,7 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
// passo al successivo
bIter = pIter->GoToNextGroup() ;
}
return ( bMGeo && bSetup && bRaw && bOper) ;
return ( bMName && bSetup && bRaw && bOper) ;
}
//----------------------------------------------------------------------------
@@ -255,22 +249,28 @@ MachMgr::SetCurrMachGroup( int nId)
m_nCurrMGrpId = GDB_ID_NULL ;
return false ;
}
// verifica ed eventuale caricamento della macchina
if ( ! LoadMachine( mgData.MGeoName))
return GDB_ID_NULL ;
// se esiste gruppo corrente, lo disabilito
if ( m_nCurrMGrpId != GDB_ID_NULL) {
// riporto i pezzi nei grezzi precedenti nella loro posizione standard
SwapParts( false) ;
// nascondo precedente gruppo corrente
// nascondo precedente gruppo corrente e la relativa macchina
m_pGeomDB->SetStatus( m_nCurrMGrpId, GDB_ST_OFF) ;
m_pGeomDB->SetStatus( m_nCurrMGeoId, GDB_ST_OFF) ;
}
// imposto i dati del nuovo gruppo corrente
m_nCurrMGrpId = nId ;
m_cCurrMGrp = mgData ;
m_nCurrMGeoId = GetMachineId( m_cCurrMGrp.MGeoName) ;
// porto i pezzi dalla loro posizione standard nei grezzi nuovi
SwapParts( true) ;
// nascondo pezzi rimasti sotto la radice
ShowRootParts( false) ;
// rendo visibile il nuovo gruppo corrente
// rendo visibile il nuovo gruppo corrente e la relativa macchina
m_pGeomDB->SetStatus( m_nCurrMGrpId, GDB_ST_ON) ;
m_pGeomDB->SetStatus( m_nCurrMGeoId, GDB_ST_ON) ;
return true ;
}
@@ -288,10 +288,12 @@ MachMgr::ResetCurrMachGroup( void)
SwapParts( false) ;
// visualizzo pezzi rimasti sotto la radice
ShowRootParts( true) ;
// nascondo gruppo corrente
// nascondo gruppo corrente e la relativa macchina
m_pGeomDB->SetStatus( m_nCurrMGrpId, GDB_ST_OFF) ;
// dichiaro nessun gruppo corrente
m_pGeomDB->SetStatus( m_nCurrMGeoId, GDB_ST_OFF) ;
// dichiaro nessun gruppo corrente e la relativa macchina
m_nCurrMGrpId = GDB_ID_NULL ;
m_nCurrMGeoId = GDB_ID_NULL ;
return true ;
}