From e35923d9325d8633d151d9a89a3b366cceb76827 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 28 Aug 2026 15:50:34 +0200 Subject: [PATCH] EgtMachKernel : - corretto AdjustArcCenterForAxesCalc per SawFinishing - aggiunto AdjustArcCenterForAxesCalc per SawRoughing. --- Milling.cpp | 1 + SawFinishing.cpp | 13 +++++++++++-- SawRoughing.cpp | 20 +++++++++++++++++++- SawRoughing.h | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Milling.cpp b/Milling.cpp index a3b36cc..1fbd4c5 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1675,6 +1675,7 @@ Milling::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) co double dOffset = 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ; ptCen.Translate( dOffset * pCamData->GetCorrDir()) ; } + // altrimenti il centro deve rimanere inalterato } // negli altri casi, non devo fare alcunché return true ; diff --git a/SawFinishing.cpp b/SawFinishing.cpp index d3bf1c2..feb45d9 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -919,8 +919,17 @@ SawFinishing::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, b bool SawFinishing::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const { - // compenso il raggio dell'utensile - ptCen += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; + // recupero il precedente movimento + int nPrevId = m_pGeomDB->GetPrev( pCamData->GetOwner()) ; + CamData* pPrevCamData = GetCamData( m_pGeomDB->GetUserObj(nPrevId)) ; + if ( pPrevCamData == nullptr) + return false ; + // se versori correzione uguali, correggo il centro + if ( AreSameVectorApprox( pCamData->GetCorrDir(), pPrevCamData->GetCorrDir())) { + // traslazione opposta a quanto fatto in AdjustPathDrawForSaw + ptCen += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; + } + // altrimenti il centro deve rimanere inalterato return true ; } diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 8bd7b6d..8335b3d 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -895,11 +895,29 @@ bool SawRoughing::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const { // compenso il raggio dell'utensile - ptP += (bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ; + ptP += ( bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ; return true ; } +//---------------------------------------------------------------------------- +bool +SawRoughing::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const +{ + // recupero il precedente movimento + int nPrevId = m_pGeomDB->GetPrev( pCamData->GetOwner()) ; + CamData* pPrevCamData = GetCamData( m_pGeomDB->GetUserObj( nPrevId)) ; + if ( pPrevCamData == nullptr) + return false ; + // se versori correzione uguali, correggo il centro + if ( AreSameVectorApprox( pCamData->GetCorrDir(), pPrevCamData->GetCorrDir())) { + // traslazione opposta a quanto fatto in AdjustPathDrawForSaw + ptCen += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; + } + // altrimenti il centro deve rimanere inalterato + return true ; +} + //---------------------------------------------------------------------------- bool SawRoughing::VerifyGeometry( SelData Id, int& nSubs) diff --git a/SawRoughing.h b/SawRoughing.h index 241825c..b7ea6ad 100644 --- a/SawRoughing.h +++ b/SawRoughing.h @@ -54,6 +54,7 @@ class SawRoughing : public Machining int GetSolCh( void) const override { return m_Params.m_nSolCh ; } bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ; + bool AdjustArcCenterForAxesCalc(const CamData* pCamData, Point3d& ptCen) const override ; public : // Machining bool Prepare( const std::string& sSawName) override ;