EgtMachKernel :
- aggiunta nuova VerifyFixture e vecchia rinominata VerifyFixtureInGroup.
This commit is contained in:
+73
-59
@@ -91,65 +91,6 @@ MachMgr::ShowOnlyTable( bool bVal)
|
||||
return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyFixture( int nFxtId, bool bLinkedAllowed) const
|
||||
{
|
||||
// se il bloccaggio fa parte del gruppo dei bloccaggi, va bene
|
||||
int nFxtGroupId = GetCurrFixtGroupId() ;
|
||||
if ( nFxtGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nFxtId) == nFxtGroupId)
|
||||
return true ;
|
||||
// se consentito linkaggio ed il bloccaggio è linkato ad un gruppo della macchina corrente, va bene
|
||||
if ( bLinkedAllowed) {
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch != nullptr && pMch->IsLinkedFixture( nFxtId))
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const
|
||||
{
|
||||
// pulisco parametro di ritorno
|
||||
vPhase.clear() ;
|
||||
// verifica validità bloccaggio
|
||||
if ( ! VerifyFixture( nFxtId))
|
||||
return false ;
|
||||
// recupero le fasi in cui è presente la fixture (se manca è fase 1)
|
||||
if ( ! m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
|
||||
vPhase.emplace_back( 1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetUnusedFixture( const string& sName, int nPhase)
|
||||
{
|
||||
// Verifico validità nome
|
||||
if ( IsEmptyOrSpaces( sName))
|
||||
return false ;
|
||||
// Recupero il gruppo dei bloccaggi
|
||||
int nFxtGroupId = GetCurrFixtGroupId() ;
|
||||
// Cerco i bloccaggi non usati nella fase indicata
|
||||
int nId = m_pGeomDB->GetFirstNameInGroup( nFxtGroupId, sName) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// 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 nId ;
|
||||
// passo al successivo
|
||||
nId = m_pGeomDB->GetNextName( nId, sName) ;
|
||||
}
|
||||
// non trovato
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
|
||||
@@ -207,6 +148,20 @@ MachMgr::RemoveFixture( int nFxtId)
|
||||
return pDisp->RemoveFixture( nFxtId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyFixture( int nFxtId) const
|
||||
{
|
||||
// verifica validità bloccaggio
|
||||
if ( ! VerifyFixtureInGroup( nFxtId, false))
|
||||
return false ;
|
||||
// recupero fasi in cui è presente
|
||||
INTVECTOR vPhase ;
|
||||
if ( ! GetFixturePhases( nFxtId, vPhase))
|
||||
return false ;
|
||||
return ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetFirstFixture( void)
|
||||
@@ -266,3 +221,62 @@ MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
|
||||
// eseguo l'operazione
|
||||
return pDisp->MoveFixtureMobile( nId, dDeltaMov) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const
|
||||
{
|
||||
// se il bloccaggio fa parte del gruppo dei bloccaggi, va bene
|
||||
int nFxtGroupId = GetCurrFixtGroupId() ;
|
||||
if ( nFxtGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nFxtId) == nFxtGroupId)
|
||||
return true ;
|
||||
// se consentito linkaggio ed il bloccaggio è linkato ad un gruppo della macchina corrente, va bene
|
||||
if ( bLinkedAllowed) {
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch != nullptr && pMch->IsLinkedFixture( nFxtId))
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const
|
||||
{
|
||||
// pulisco parametro di ritorno
|
||||
vPhase.clear() ;
|
||||
// verifica validità bloccaggio
|
||||
if ( ! VerifyFixtureInGroup( nFxtId))
|
||||
return false ;
|
||||
// recupero le fasi in cui è presente la fixture (se manca è fase 1)
|
||||
if ( ! m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
|
||||
vPhase.emplace_back( 1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetUnusedFixture( const string& sName, int nPhase)
|
||||
{
|
||||
// Verifico validità nome
|
||||
if ( IsEmptyOrSpaces( sName))
|
||||
return false ;
|
||||
// Recupero il gruppo dei bloccaggi
|
||||
int nFxtGroupId = GetCurrFixtGroupId() ;
|
||||
// Cerco i bloccaggi non usati nella fase indicata
|
||||
int nId = m_pGeomDB->GetFirstNameInGroup( nFxtGroupId, sName) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// 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 nId ;
|
||||
// passo al successivo
|
||||
nId = m_pGeomDB->GetNextName( nId, sName) ;
|
||||
}
|
||||
// non trovato
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user