From 8f7fdc3a807dac511dd782c5e4eff8d0fa79281a Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 26 May 2023 08:43:48 +0200 Subject: [PATCH] EgtMachKernel 2.5e4 : - negli angoli macchina suggeriti ora si tiene conto di Invert e di Offset (quindi per l'utente sono i valori che vede in simulazione e sul CN). --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Machine.h | 2 ++ MachineCalc.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Operation.cpp | 11 ++++++++++- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 65d26402cbc840a08dc648810ac6238d836c5f20..d48143ef5f4177eb263885932e978ab7cebcf4e8 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P#&A-`fnHfzcKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUI`BbWdH delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 diff --git a/Machine.h b/Machine.h index 116cbba..2a19ccd 100644 --- a/Machine.h +++ b/Machine.h @@ -125,6 +125,8 @@ class Machine bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ; bool GetCurrAxisMin( int nInd, double& dMin) const ; bool GetCurrAxisMax( int nInd, double& dMax) const ; + bool GetCurrAxisOffset( int nInd, double& dOffset) const ; + bool GetCurrAxisInvert( int nInd, bool& bInvert) const ; bool GetCurrAxisHomePos( int nInd, double& dHome) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; const Frame3d& GetCurrLinAxesFrame( void) const diff --git a/MachineCalc.cpp b/MachineCalc.cpp index ff32903..6f6b963 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1827,6 +1827,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const return false ; } +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisOffset( int nInd, double& dOffset) const +{ + int nLinAxes = int( m_vCalcLinAx.size()) ; + int nRotAxes = int( m_vCalcRotAx.size()) ; + if ( nInd >= 0 && nInd < nLinAxes) { + Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ; + if ( pAx == nullptr) + return false ; + dOffset = pAx->GetOffset() ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + dOffset = pAx->GetOffset() ; + return true ; + } + return false ; +} + +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const +{ + int nLinAxes = int( m_vCalcLinAx.size()) ; + int nRotAxes = int( m_vCalcRotAx.size()) ; + if ( nInd >= 0 && nInd < nLinAxes) { + Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ; + if ( pAx == nullptr) + return false ; + bInvert = pAx->GetInvert() ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + bInvert = pAx->GetInvert() ; + return true ; + } + return false ; +} + //---------------------------------------------------------------------------- bool Machine::GetCurrAxisHomePos( int nInd, double& dHome) const diff --git a/Operation.cpp b/Operation.cpp index fbe724b..b43de94 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1632,8 +1632,17 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) && szKey == Trim( sAxToken)) { double dVal ; - if ( FromString( szVal, dVal)) + if ( FromString( szVal, dVal)) { + double dOffset = 0 ; + m_pMchMgr->GetCurrMachine()->GetCurrAxisOffset( nLinAxes + i, dOffset) ; + if ( abs( dOffset) > EPS_ANG_SMALL) + dVal -= dOffset ; + bool bInvert = false ; + m_pMchMgr->GetCurrMachine()->GetCurrAxisInvert( nLinAxes + i, bInvert) ; + if ( bInvert) + dVal = -dVal ; vAxRotPrec[i] = dVal ; + } break ; } }