From 5dc854adb34f896ea497e722f91e398178f80252 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 24 Oct 2020 14:48:56 +0000 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=202.2j5=20:=20-=20tramite=20Info?= =?UTF-8?q?=20di=20testa=20ZEXTRA=20possibilit=C3=A0=20di=20assegnare=20un?= =?UTF-8?q?a=20extra=20risalita=20in=20Z=20per=20evitare=20collisioni=20ne?= =?UTF-8?q?l=20collegamento=20di=20due=20lavorazioni.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Machine.h | 2 ++ MachineCalc.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++ MachineStruConst.h | 4 +++- Operation.cpp | 34 +++++++++++++++++++++++++++++++-- Operation.h | 1 + 6 files changed, 84 insertions(+), 3 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 63409f847b199e3df219ffb542b4fbd5dbdb29c0..f23e2d01c262f8841de46436bd521978a336fda1 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFy6^ItYwW=7M=j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQiUK= delta 97 zcmZpRX^YwLhmFx>^ItYwW=50Aj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQ1Kv2 diff --git a/Machine.h b/Machine.h index 93183e7..c595673 100644 --- a/Machine.h +++ b/Machine.h @@ -113,6 +113,8 @@ class Machine bool GetAllCurrAxesName( STRVECTOR& vAxName) const ; bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ; bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ; + bool GetCurrAxisMin( int nInd, double& dMin) const ; + bool GetCurrAxisMax( int nInd, double& dMax) const ; bool GetCurrAxisHomePos( int nInd, double& dHome) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, diff --git a/MachineCalc.cpp b/MachineCalc.cpp index a997a43..b139aeb 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1632,6 +1632,52 @@ Machine::GetAllCurrAxesToken( STRVECTOR& vAxToken) const return bOk ; } +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisMin( int nInd, double& dMin) 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 ; + dMin = pAx->GetStroke().Min ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + dMin = pAx->GetStroke().Min ; + return true ; + } + return false ; +} + +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisMax( int nInd, double& dMax) 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 ; + dMax = pAx->GetStroke().Max ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + dMax = pAx->GetStroke().Max ; + return true ; + } + return false ; +} + //---------------------------------------------------------------------------- bool Machine::GetCurrAxisHomePos( int nInd, double& dHome) const diff --git a/MachineStruConst.h b/MachineStruConst.h index 3efef06..b209370 100644 --- a/MachineStruConst.h +++ b/MachineStruConst.h @@ -100,8 +100,10 @@ const std::string MCH_AUX_VECT = "AV" ; const std::string MCH_EXIT = "T" ; //---------------------------------------------------------------------------- -// Info in rinvio rotante per forzare risalita alla rotazione +// Info di testa per forzare risalita alla rotazione const std::string MCH_ZMAXONROT = "ZMAXONROT" ; +// Info di testa per una extra risalita in Z +const std::string MCH_ZEXTRA = "ZEXTRA" ; //---------------------------------------------------------------------------- // Dati aggregato rotante da sotto diff --git a/Operation.cpp b/Operation.cpp index cf8141e..d00a04c 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1642,8 +1642,18 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) if ( m_pMchMgr->GetCurrAxisHomePos( 2, dSafeZ)) { DBLVECTOR vAxVal2 = vAxVal ; vAxVal2[2] = dSafeZ ; DBLVECTOR vAxIni2 = vAxIni ; vAxIni2[2] = dSafeZ ; - if ( ! TestCollisionAvoid( vAxVal2, vAxIni2)) - return false ; + if ( ! TestCollisionAvoid( vAxVal2, vAxIni2)) { + double dExtraZ = GetExtraZ( dSafeZ) ; + if ( dExtraZ > EPS_SMALL) { + dSafeZ += dExtraZ ; + vAxVal2[2] = dSafeZ ; + vAxIni2[2] = dSafeZ ; + if ( ! TestCollisionAvoid( vAxVal2, vAxIni2)) + return false ; + } + else + return false ; + } } else return false ; @@ -2280,6 +2290,26 @@ Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR return true ; } +//---------------------------------------------------------------------------- +double +Operation::GetExtraZ( double dSafeZ) const +{ + double dExtraZ = 0 ; + // Recupero macchina corrente + Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ; + if ( pMch == nullptr) + return 0 ; + // Se testa con Info ZEXTRA la recupero e la limito alla corsa dell'asse + int nHeadId = pMch->GetCurrHead() ; + double dVal ; + if ( m_pGeomDB->GetInfo( nHeadId, MCH_ZEXTRA, dVal) && dVal > EPS_SMALL) { + double dZmax ; + pMch->GetCurrAxisMax( 2, dZmax) ; + dExtraZ = min( dVal, dZmax - dSafeZ) ; + } + return dExtraZ ; +} + //---------------------------------------------------------------------------- bool Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const diff --git a/Operation.h b/Operation.h index 84f34b3..1d60732 100644 --- a/Operation.h +++ b/Operation.h @@ -109,6 +109,7 @@ class Operation : public IUserObj bool RemoveRise( int nClPathId = GDB_ID_NULL) ; bool AddHome( void) ; bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ; + double GetExtraZ( double dSafeZ) const ; bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; bool SpecialMoveZup( Vector3d& vtTool, DBLVECTOR& vAx, bool& bModif) ;