diff --git a/CamData.h b/CamData.h index 8988e47..d8fa12f 100644 --- a/CamData.h +++ b/CamData.h @@ -67,6 +67,8 @@ class CamData : public IUserObj bool SetBackAuxDir( const Vector3d& vtDir) ; const int GetMoveType( void) const { return m_nMove ; } + const bool IsLine( void) const + { return ( m_nMove == 0 || m_nMove == 1) ; } const bool IsArc( void) const { return ( m_nMove == 2 || m_nMove == 3) ; } const Vector3d& GetToolDir( void) const diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index e617416..016744f 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/MachMgr.h b/MachMgr.h index d452eab..6909785 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -395,6 +395,7 @@ class MachMgr : public IMachMgr bool SetCalcSolCh( int nScc, bool bExact) ; bool VerifyAngleOutstroke( int nInd, double dAng) const ; bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ; + bool ExistProtectedAreas( void) const ; // Operations bool GetOperationNewName( std::string& sName) const ; const ToolData* GetMachiningToolData( void) const ; diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp index e95c0a8..b4921a1 100644 --- a/MachMgrMachines.cpp +++ b/MachMgrMachines.cpp @@ -653,6 +653,14 @@ MachMgr::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng return ( ( pMch != nullptr) ? pMch->VerifyOutstroke( dX, dY, dZ, vAng, bClear, nStat) : false) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::ExistProtectedAreas( void) const +{ + Machine* pMch = GetCurrMachine() ; + return ( ( pMch != nullptr) ? pMch->ExistProtectedAreas() : false) ; +} + //---------------------------------------------------------------------------- std::string MachMgr::GetOutstrokeInfo( bool bMM) const diff --git a/Machine.h b/Machine.h index 31c0481..f8b1643 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 ExistProtectedAreas( void) const ; bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ; bool VerifyOutstroke( const std::string& sAxName, double dVal) const ; std::string GetOutstrokeInfo( bool bMM = true) const ; diff --git a/MachineCalc.cpp b/MachineCalc.cpp index fddc17a..5bf557b 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1375,6 +1375,13 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng return true ; } +//---------------------------------------------------------------------------- + bool + Machine::ExistProtectedAreas(void) const + { + return LuaExistsFunction( ON_VERIFY_PROTECTEDAREAS) ; + } + //---------------------------------------------------------------------------- bool Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) diff --git a/Operation.cpp b/Operation.cpp index 5e195c2..952ff71 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1241,8 +1241,31 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, Vector3d vtBackAux ; m_pMchMgr->GetCurrMachine()->GetBackAuxDirFromAngles( vAng1, vtBackAux) ; pCamData->SetBackAuxDir( vtBackAux) ; + // se esiste precedente, corrente è linea ed esistono aree protette, devo verificare anche i punti interni + if ( ! bFirst && pCamData->IsLine() && m_pMchMgr->ExistProtectedAreas()) { + // verifico i limiti di corsa dei punti lungo l'arco + const int NUM_VERIF_STEP = 16 ; + Vector3d vtN = pCamData->GetAxesNormDir() ; + Point3d ptPrec( dXprec, dYprec, dZprec) ; + Point3d ptP( dX, dY, dZ) ; + for ( int i = 1 ; i < NUM_VERIF_STEP ; ++ i) { + double dCoeff = double( i) / NUM_VERIF_STEP ; + Point3d ptCurr = Media( ptPrec, ptP, dCoeff) ; + DBLVECTOR vAng( vAng1.size()) ; + for ( size_t i = 0 ; i < vAng1.size() ; ++ i) + vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAng1[i] * dCoeff ; + int nStat ; + bool bOsOk = m_pMchMgr->VerifyOutstroke( ptCurr.x, ptCurr.y, ptCurr.z, vAng, false, nStat) ; + if ( ! bOsOk || nStat != 0) { + bOk = false ; + pCamData->SetAxes( CamData::AS_OUTSTROKE, vAxVal) ; + string sInfo = "Outstroke : " + m_pMchMgr->GetOutstrokeInfo() ; + LOG_INFO( GetEMkLogger(), sInfo.c_str()) + } + } + } // se arco devo calcolarne il centro in assi macchina - if ( pCamData->IsArc()) { + else if ( pCamData->IsArc()) { // devo lavorare con arco schiacciato nel suo piano Point3d ptCen = pCamData->GetCenter() ; AdjustArcCenterForAxesCalc( pCamData, ptCen) ; @@ -1334,7 +1357,6 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, pCamData->SetAxes( CamData::AS_OUTSTROKE, vAxVal) ; string sInfo = "Outstroke : " + m_pMchMgr->GetOutstrokeInfo() ; LOG_INFO( GetEMkLogger(), sInfo.c_str()) - continue ; } } }