EgtMachKernel 1.6r7 :
- possibilità di collegare e scollegare fixtures da gruppi macchina (come i grezzi) - aggiunto richiamo funzione script OnSetHead.
This commit is contained in:
+68
@@ -936,3 +936,71 @@ Machine::UnlinkAllRawPartsFromGroups( void)
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LinkFixtureToGroup( int nFxtId, const std::string& sGroupName)
|
||||
{
|
||||
// verifico DB geometrico e gestore lavorazioni
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
// recupero il gruppo delle fixtures nella macchinata corrente
|
||||
int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ;
|
||||
if ( nFixtGrpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che il bloccaggio appartenga a questo gruppo
|
||||
if ( m_pGeomDB->GetParentId( nFxtId) != nFixtGrpId)
|
||||
return false ;
|
||||
// recupero il gruppo di macchina indicato
|
||||
int nGrpId = GetGroup( sGroupName) ;
|
||||
if ( nGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggancio il bloccaggio al gruppo
|
||||
if ( ! m_pGeomDB->RelocateGlob( nFxtId, nGrpId))
|
||||
return false ;
|
||||
// inserisco il bloccaggio nell'elenco dei linkati
|
||||
m_vLinkedFixtures.push_back( nFxtId) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::IsLinkedFixture( int nFxtId) const
|
||||
{
|
||||
return ( find( m_vLinkedFixtures.begin(), m_vLinkedFixtures.end(), nFxtId) != m_vLinkedFixtures.end()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::UnlinkFixtureFromGroup( int nFxtId)
|
||||
{
|
||||
// verifico DB geometrico e gestore lavorazioni
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
// recupero il gruppo delle fixtures nella macchinata corrente
|
||||
int nFixtGrpId = m_pMchMgr->GetCurrFixtGroupId() ;
|
||||
if ( nFixtGrpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// verifico che il bloccaggio indicato sia nell'elenco dei linkati
|
||||
auto iIter = find( m_vLinkedFixtures.begin(), m_vLinkedFixtures.end(), nFxtId) ;
|
||||
if ( iIter == m_vLinkedFixtures.end())
|
||||
return false ;
|
||||
// riporto il bloccaggio nel gruppo delle fixtures
|
||||
if ( ! m_pGeomDB->RelocateGlob( nFxtId, nFixtGrpId))
|
||||
return false ;
|
||||
// tolgo il bloccaggio dall'elenco dei linkati
|
||||
m_vLinkedFixtures.erase( iIter) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::UnlinkAllFixturesFromGroups( void)
|
||||
{
|
||||
while ( m_vLinkedFixtures.size() > 0) {
|
||||
int nFxtId = m_vLinkedFixtures.back() ;
|
||||
if ( ! UnlinkFixtureFromGroup( nFxtId))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user