EgtMachKernel :

- corretta KeepFixture (c'era errore se usata per nuova fase dopo aver fatto una simulazione).
This commit is contained in:
Dario Sassi
2019-05-20 06:49:32 +00:00
parent c2956b2733
commit 63070c5b51
4 changed files with 83 additions and 41 deletions
+56 -36
View File
@@ -434,7 +434,7 @@ Disposition::Apply( bool bVerifyTab)
for ( auto& FixData : m_vFixData) {
// se sottopezzo da caricare
if ( FixData.nId == GDB_ID_NULL) {
int nId = AddFixture( FixData.sName, FixData.ptPos, FixData.dAng, FixData.dMov, false) ;
int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ;
if ( nId == GDB_ID_NULL) {
string sOut = "Error adding fixture " + FixData.sName ;
m_pMchMgr->SetLastError( 2001, sOut.c_str()) ;
@@ -517,7 +517,7 @@ Disposition::IsInTable( const BBox3d& b3B)
//----------------------------------------------------------------------------
int
Disposition::AddFixture( const string& sName, const Point3d& ptPos, double dAngDeg,
Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg,
double dMov, bool bAddToList)
{
// verifico MachMgr e GeomDB
@@ -529,42 +529,62 @@ Disposition::AddFixture( const string& sName, const Point3d& ptPos, double dAngD
// verifico che la posizione sia nell'area della tavola
if ( ! IsInTable( m_ptRef1 + ptPos))
return GDB_ID_NULL ;
// Nome tutto maiuscolo
string sMyName = sName ;
ToUpper( sMyName) ;
// Se recuperabile dal gruppo dei bloccaggi
int nFixtId = m_pMchMgr->GetUnusedFixture( sMyName, m_nPhase) ;
if ( nFixtId != GDB_ID_NULL) {
// aggiungo la fase al bloccaggio
INTVECTOR vPhase ;
m_pMchMgr->GetFixturePhases( nFixtId, vPhase) ;
vPhase.push_back( m_nPhase) ;
m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, vPhase) ;
// aggiorno visualizzazione
m_pGeomDB->SetStatus( nFixtId, GDB_ST_ON) ;
// Ricerca
int nFixtId = GDB_ID_NULL ;
// Se già identificata
if ( nId != GDB_ID_NULL) {
if ( m_pMchMgr->IsUnusedFixture( nId, m_nPhase)) {
nFixtId = nId ;
// aggiungo la fase al bloccaggio
INTVECTOR vPhase ;
m_pMchMgr->GetFixturePhases( nFixtId, vPhase) ;
vPhase.push_back( m_nPhase) ;
m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, vPhase) ;
// aggiorno visualizzazione
m_pGeomDB->SetStatus( nFixtId, GDB_ST_ON) ;
}
else
return GDB_ID_NULL ;
}
// altrimenti lo carico da file
// altrimenti
else {
// recupero il gruppo delle fixtures nella macchinata corrente
int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ;
if ( nFixtGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esistenza file sottopezzo
string sFixtFile = m_pMchMgr->GetCurrFixtDir() + "\\" + sName + ".Nge" ;
if ( ! ExistsFile( sFixtFile))
return GDB_ID_NULL ;
// inserisco il sottopezzo nel gruppo
if ( ! m_pGeomDB->Load( sFixtFile, nFixtGrpId))
return GDB_ID_NULL ;
nFixtId = m_pGeomDB->GetLastGroupInGroup( nFixtGrpId) ;
if ( nFixtId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nFixtId, sMyName) ;
// imposto il livello a temporaneo
m_pGeomDB->SetLevel( nFixtId, GDB_LV_TEMP) ;
// aggiungo la fase al bloccaggio
m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, m_nPhase) ;
// Nome tutto maiuscolo
string sMyName = sName ;
ToUpper( sMyName) ;
// Se recuperabile dal gruppo dei bloccaggi
nFixtId = m_pMchMgr->GetUnusedFixture( sMyName, m_nPhase) ;
if ( nFixtId != GDB_ID_NULL) {
// aggiungo la fase al bloccaggio
INTVECTOR vPhase ;
m_pMchMgr->GetFixturePhases( nFixtId, vPhase) ;
vPhase.push_back( m_nPhase) ;
m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, vPhase) ;
// aggiorno visualizzazione
m_pGeomDB->SetStatus( nFixtId, GDB_ST_ON) ;
}
// altrimenti lo carico da file
else {
// recupero il gruppo delle fixtures nella macchinata corrente
int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ;
if ( nFixtGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esistenza file sottopezzo
string sFixtFile = m_pMchMgr->GetCurrFixtDir() + "\\" + sName + ".Nge" ;
if ( ! ExistsFile( sFixtFile))
return GDB_ID_NULL ;
// inserisco il sottopezzo nel gruppo
if ( ! m_pGeomDB->Load( sFixtFile, nFixtGrpId))
return GDB_ID_NULL ;
nFixtId = m_pGeomDB->GetLastGroupInGroup( nFixtGrpId) ;
if ( nFixtId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nFixtId, sMyName) ;
// imposto il livello a temporaneo
m_pGeomDB->SetLevel( nFixtId, GDB_LV_TEMP) ;
// aggiungo la fase al bloccaggio
m_pGeomDB->SetInfo( nFixtId, MACH_FXT_PHASE, m_nPhase) ;
}
}
// resetto il riferimento del gruppo
Frame3d* pfrFixt = m_pGeomDB->GetGroupFrame( nFixtId) ;