diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 65d2640..d48143e 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ 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 ; } }