From 68a92f942c4ffdbd39cdc380b7356f59d5bd11f7 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 29 Jul 2024 10:15:38 +0200 Subject: [PATCH] EgtMachKerenel : - ulteriore modifica per controllo punto medio in calcolo assi macchina di tipo centro di lavoro. --- Operation.cpp | 18 +++++++++++------- Operation.h | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Operation.cpp b/Operation.cpp index a726b74..8224b64 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1984,6 +1984,8 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, Vector3d vtBackAux ; pMachine->GetBackAuxDirFromAngles( vAxRot, vtBackAux) ; pCamData->SetBackAuxDir( vtBackAux) ; + // tipo di movimento + int nMoveType = pCamData->GetMoveType() ; // se punto finale di linea if ( ! bFirst && pCamData->IsLine()) { // Verifica ricorsiva del punto medio @@ -1991,7 +1993,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, bool bAxesError ; if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec, ptP, vtDir, vtAux, vtCorr, vAxVal, - 0, nEntId, dRot1W, bMidAdded, bAxesError)) { + 0, nEntId, dRot1W, nMoveType, bMidAdded, bAxesError)) { LOG_ERROR( GetEMkLogger(), "Error : VerifyLineMidPoint of CalculateClPathAxesValues failed") return false ; } @@ -2301,7 +2303,7 @@ Operation::CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Ve bool Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec, const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal, - int nCnt, int nEntId, double dRot1W, bool& bAdded, bool& bAxError) + int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) { // impostazioni bAdded = false ; @@ -2340,6 +2342,8 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, return false ; // LOG_INFO( GetEMkLogger(), ( "Midpoint dist =" + ToString( dDist, 3)).c_str()) double dLinTol = GetApproxLinTol() ; + if ( nMoveType == 0) + dLinTol = max( 10 * dLinTol, LIN_TOL_RAW) ; // Se posizione in tolleranza, non devo fare alcunché if ( dDist <= dLinTol) @@ -2349,13 +2353,13 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, Point3d ptMid = Media( ptPrec, ptP) ; Vector3d vtDirMid = Media( vtDirPrec, vtDir) ; if ( ! vtDirMid.Normalize()) - return true ; + return ( nMoveType == 0) ; Vector3d vtAuxMid = Media( vtAuxPrec, vtAux) ; if ( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ! vtAuxMid.Normalize()) - return true ; + return ( nMoveType == 0) ; Vector3d vtCorrMid = Media( vtCorrPrec, vtCorr) ; if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ! vtCorrMid.Normalize()) - return true ; + return ( nMoveType == 0) ; // inserisco nuova entità e modifico vecchia int nMidEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ; if ( nMidEntId == GDB_ID_NULL) @@ -2415,7 +2419,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, bool bAdded1, bAxError1, bAdded2, bAxError2 ; if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec, ptMid, vtDirMid, vtAuxMid, vtCorrMid, vAxMid, - nCnt, nMidEntId, dRot1W, bAdded1, bAxError1)) + nCnt, nMidEntId, dRot1W, nMoveType, bAdded1, bAxError1)) return false ; if ( bAxError1) { bAxError = true ; @@ -2423,7 +2427,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, } if ( ! VerifyLineMidPoint( ptMid, vtDirMid, vtAuxMid, vtCorrMid, vAxMid, ptP, vtDir, vtAux, vtCorr, vAxVal, - nCnt, nEntId, dRot1W, bAdded2, bAxError2)) + nCnt, nEntId, dRot1W, nMoveType, bAdded2, bAxError2)) return false ; if ( bAxError2) { bAxError = true ; diff --git a/Operation.h b/Operation.h index f477f21..fed8795 100644 --- a/Operation.h +++ b/Operation.h @@ -192,7 +192,7 @@ class Operation : public IUserObj const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ; bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec, const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal, - int nCnt, int nEntId, double dRot1W, bool& bAdded, bool& bAxError) ; + int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ; bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;