From b6657d56a5558fa22b79b7299d608becfdd37742 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 28 Jun 2018 18:59:10 +0000 Subject: [PATCH] EgtMachKernel : - in simulazione aggiunto controllo corse su assi ausiliari. --- Machine.h | 1 + MachineCalc.cpp | 36 ++++++++++++++++++++++++++++++++++++ Simulator.cpp | 6 +++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Machine.h b/Machine.h index 50afee6..487b53f 100644 --- a/Machine.h +++ b/Machine.h @@ -130,6 +130,7 @@ class Machine bool LimitAngleToStroke( int nInd, double& dAng) const ; bool VerifyAngleOutstroke( int nInd, double dAng) const ; bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ; + bool VerifyOutstroke( const std::string& sAxName, double dVal) const ; std::string GetOutstrokeInfo( bool bMM = true) const ; void ResetOutstrokeInfo( void) const { m_OutstrokeInfo.Clear() ; } diff --git a/MachineCalc.cpp b/MachineCalc.cpp index 686de7b..4203621 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1351,6 +1351,42 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng return true ; } +//---------------------------------------------------------------------------- +bool +Machine::VerifyOutstroke( const string& sAxName, double dVal) const +{ + // recupero l'asse + Axis* pAx = GetAxis( GetAxisId( sAxName)) ; + if ( pAx == nullptr) { + m_OutstrokeInfo.sAxName = sAxName ; + m_OutstrokeInfo.sAxToken = sAxName ; + m_OutstrokeInfo.bLinear = false ; + m_OutstrokeInfo.dExtra = 0 ; + m_OutstrokeInfo.sAuxInfo = " (Unknown) " ; + return false ; + } + // verifica con l'estremo inferiore + if ( dVal < pAx->GetStroke().Min) { + m_OutstrokeInfo.sAxName = pAx->GetName() ; + m_OutstrokeInfo.sAxToken = pAx->GetToken() ; + m_OutstrokeInfo.bLinear = ( pAx->GetType() == MCH_AT_LINEAR) ; + m_OutstrokeInfo.dExtra = dVal - pAx->GetStroke().Min ; + m_OutstrokeInfo.sAuxInfo = " (Ax-) " ; + return false ; + } + // verifica con l'estremo superiore + if ( dVal > pAx->GetStroke().Max) { + m_OutstrokeInfo.sAxName = pAx->GetName() ; + m_OutstrokeInfo.sAxToken = pAx->GetToken() ; + m_OutstrokeInfo.bLinear = ( pAx->GetType() == MCH_AT_LINEAR) ; + m_OutstrokeInfo.dExtra = dVal - pAx->GetStroke().Max ; + m_OutstrokeInfo.sAuxInfo = " (Ax+) " ; + return false ; + } + // va bene + return true ; +} + //---------------------------------------------------------------------------- string Machine::GetOutstrokeInfo( bool bMM) const diff --git a/Simulator.cpp b/Simulator.cpp index e3e7e39..644e0f8 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -1500,7 +1500,11 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr) m_AuxAxesInvert.push_back( bInvert) ; m_AuxAxesLinear.push_back( bLinear) ; m_AuxAxesVal.emplace_back( dVal) ; - m_AuxAxesEnd.emplace_back( dEnd) ; + m_AuxAxesEnd.emplace_back( dEnd) ; + if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) { + nErr = 1 ; + bOk = false ; + } } else bOk = false ;