EgtInterface 1.6c10 :

- gestione macchinate (gruppi di lavorazione).
This commit is contained in:
Dario Sassi
2015-03-31 13:16:36 +00:00
parent 4bb71f5578
commit a8d57a13fa
5 changed files with 259 additions and 3 deletions
+27 -2
View File
@@ -285,6 +285,8 @@ __stdcall EgtNewFile( void)
// aggiorno stato file corrente
pGseCtx->m_sFilePath.clear() ;
pGseCtx->m_bModified = false ;
// aggiornamento gestore lavorazioni
EgtUpdateMachMgr() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtNewFile()"
@@ -313,10 +315,12 @@ EgtOpenFile( const string& sFilePath)
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// carico il file
bOk = bOk && GetCurrGeomDB()->Load( sFilePath) ;
bOk = bOk && pGseCtx->m_pGeomDB->Load( sFilePath) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
pGseCtx->m_bModified = false ;
// aggiornamento gestore lavorazioni
EgtUpdateMachMgr() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
@@ -342,8 +346,29 @@ EgtInsertFile( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
// creo gruppo temporaneo di parcheggio
int nGrp = pGeomDB->InsertGroup( GDB_ID_NULL, GDB_ID_ROOT, GDB_FIRST_SON, GLOB_FRM) ;
bool bOk = ( nGrp != GDB_ID_NULL) ;
bOk = bOk && pGeomDB->SetLevel( nGrp, GDB_LV_TEMP) ;
// carico il file
bool bOk = pGseCtx->m_pGeomDB->Load( sFilePath) ;
bOk = bOk && pGeomDB->Load( sFilePath, nGrp) ;
// sposto i pezzi sotto la radice
int nId = pGeomDB->GetFirstGroupInGroup( nGrp) ;
while ( bOk && nId != GDB_ID_NULL) {
// prossimo gruppo
int nNextId = pGeomDB->GetNextGroup( nId) ;
// se il gruppo corrente è un pezzo, lo sposto
int nLevel ;
if ( ! pGeomDB->GetLevel( nId, nLevel) || nLevel == GDB_LV_USER)
bOk = pGeomDB->Relocate( nId, GDB_ID_ROOT, GDB_LAST_SON) ;
// passo al prossimo
nId = nNextId ;
}
// sistemo le lavorazioni
bOk = bOk && EgtInsertMachMgr( nGrp) ;
// cancello il gruppo temporaneo
pGeomDB->Erase( nGrp) ;
// aggiorno stato file corrente
pGseCtx->m_bModified = true ;
// se richiesto, salvo il comando Lua equivalente