EgtMachKernel :

- modifiche e migliorie per gestione assi di disposizione dipendenti dalla tavola.
This commit is contained in:
Dario Sassi
2024-10-16 19:49:10 +02:00
parent ab63e1908c
commit 1497d7bb25
10 changed files with 80 additions and 34 deletions
+35 -3
View File
@@ -224,6 +224,34 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const
{
if ( m_pGeomDB == nullptr)
return false ;
// recupero Id asse
int nAxId = GetAxisId( sAxis) ;
if ( nAxId == GDB_ID_NULL)
return false ;
// recupero eventuale Id tavola
int nTabId = GDB_ID_NULL ;
if ( ! sTable.empty()) {
nTabId = GetTableId( sTable) ;
if ( nTabId == GDB_ID_NULL)
return false ;
}
// se direttamente dipendente dalla tavola
int nParentId = m_pGeomDB->GetParentId( nAxId) ;
if ( ( nTabId != GDB_ID_NULL && nParentId == nTabId) || IsTableGroup( nParentId))
return true ;
// altrimenti deve dipendere da asse dipendente dalla tavola
if ( ! IsAxisGroup( nParentId))
return false ;
int nGrParId = m_pGeomDB->GetParentId( nParentId) ;
return ( ( nTabId != GDB_ID_NULL && nGrParId == nTabId) || IsTableGroup( nGrParId)) ;
}
//----------------------------------------------------------------------------
bool
Machine::ResetAxisPos( const string& sAxis)
@@ -241,13 +269,17 @@ Machine::ResetAxisPos( const string& sAxis)
//----------------------------------------------------------------------------
bool
Machine::ResetAllAxesPos( void)
Machine::ResetAllAxesPos( bool bStdAxes, bool bDispAxes)
{
// ciclo sui gruppi della macchina
for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) {
if ( IsAxisGroup( Iter->second)) {
if ( ! ResetAxisPos( Iter->first))
return false ;
if ( ( bStdAxes && bDispAxes) ||
( bStdAxes && ! IsDispositionAxis( Iter->first)) ||
( bDispAxes && IsDispositionAxis( Iter->first))) {
if ( ! ResetAxisPos( Iter->first))
return false ;
}
}
}
return true ;