EgtMachKernel :
- corretta KeepFixture (c'era errore se usata per nuova fase dopo aver fatto una simulazione).
This commit is contained in:
+56
-36
@@ -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) ;
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ class Disposition : public Operation
|
||||
bool GetTableRef1( Point3d& ptRef1) const ;
|
||||
bool GetTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) const ;
|
||||
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngDeg = 0,
|
||||
int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0,
|
||||
double dMov = 0, bool bAddToList = true) ;
|
||||
int GetFirstFixture( void) ;
|
||||
int GetNextFixture( int nId) ;
|
||||
|
||||
@@ -370,7 +370,8 @@ class MachMgr : public IMachMgr
|
||||
// Tables and Fixtures
|
||||
bool VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed = true) const ;
|
||||
bool GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const ;
|
||||
int GetUnusedFixture( const std::string& sName, int nPhase) ;
|
||||
int GetUnusedFixture( const std::string& sName, int nPhase) const ;
|
||||
bool IsUnusedFixture( int nId, int nPhase) const ;
|
||||
// Setup
|
||||
SetupMgr& GetCurrSetupMgr( void) const
|
||||
{ return const_cast<SetupMgr&>( m_stuMgr) ; }
|
||||
|
||||
+24
-3
@@ -124,7 +124,7 @@ MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDe
|
||||
if ( pDisp == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// eseguo l'operazione
|
||||
return pDisp->AddFixture( sName, ptPos, dAngRotDeg, dMov) ;
|
||||
return pDisp->AddFixture( sName, GDB_ID_NULL, ptPos, dAngRotDeg, dMov) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -150,7 +150,7 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
|
||||
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ;
|
||||
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
|
||||
if ( nId == nFxtId) {
|
||||
pDisp->AddFixture( sName, ptPos, dAngDeg, dMov) ;
|
||||
pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetUnusedFixture( const string& sName, int nPhase)
|
||||
MachMgr::GetUnusedFixture( const string& sName, int nPhase) const
|
||||
{
|
||||
// Verifico validità nome
|
||||
if ( IsEmptyOrSpaces( sName))
|
||||
@@ -304,3 +304,24 @@ MachMgr::GetUnusedFixture( const string& sName, int nPhase)
|
||||
// non trovato
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsUnusedFixture( int nId, int nPhase) const
|
||||
{
|
||||
// Recupero il gruppo dei bloccaggi
|
||||
int nFxtGroupId = GetCurrFixtGroupId() ;
|
||||
// Verifico appartenga al gruppo dei bloccaggi
|
||||
if ( m_pGeomDB->GetParentId( nId) != nFxtGroupId)
|
||||
return false ;
|
||||
// Verifico non sia usata nella fase indicata
|
||||
// recupero le fasi in cui è già usato
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
|
||||
vPhase.emplace_back( 1) ;
|
||||
// se non c'è la fase corrente, è libero
|
||||
if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end())
|
||||
return true ;
|
||||
// già usato
|
||||
return false ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user