From 60d97d5657de3d440acb5d34d2e06ede6b55e9f7 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 18 Jul 2016 18:11:52 +0000 Subject: [PATCH] EgtMachKernel 1.6s5 : - migliorato controllo elevazione utensile in fresatura su attacco e uscita. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Milling.cpp | 34 +++++++++++++++++++++------------- Milling.h | 3 ++- Operation.cpp | 43 ++++++++++++++++++++++++++++++++++++------- Operation.h | 2 ++ 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index ed06facf7f7d3f8eaf63066201b9c336a3b52c6d..be7badb0109cf1a715ccd2ec1d5694c5812f6bd7 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/Milling.cpp b/Milling.cpp index 2d8fefe..a07d1f7 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -999,7 +999,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) // calcolo l'elevazione massima double dElev ; - if ( CalcElevation( pCompo, vtTool, dDepth, dElev)) { + if ( CalcPathElevation( pCompo, vtTool, dDepth, dElev)) { if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) { BBox3d b3Crv ; pCompo->GetLocalBBox( b3Crv) ; @@ -1047,8 +1047,8 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) //---------------------------------------------------------------------------- bool -Milling::CalcElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, - double& dElev) +Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, + double& dElev) { dElev = 0 ; int nMaxInd = pCompo->GetCurveCount() - 1 ; @@ -1110,7 +1110,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo // aggiungo approccio per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dStElev ; - if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev)) + if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev)) dStElev = dElev ; if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) return false ; @@ -1170,7 +1170,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo // aggiungo retrazione per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dEndElev ; - if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev)) + if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dEndElev)) dEndElev = dElev ; // aggiungo retrazione if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) @@ -1229,7 +1229,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // se primo step aggiungo approccio per frese normali if ( j == 1 && ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dStElev ; - if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev)) + if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev)) dStElev = dElev ; if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) return false ; @@ -1303,7 +1303,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // se ultimo step aggiungo retrazione per frese normali if ( j == nStep && ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dEndElev ; - if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev)) + if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dEndElev)) dEndElev = dElev ; // aggiungo retrazione if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) @@ -1359,7 +1359,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo approccio per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dStElev ; - if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev)) + if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev)) dStElev = dElev ; if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) return false ; @@ -1419,7 +1419,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo retrazione per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dEndElev ; - if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev)) + if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dEndElev)) dEndElev = dElev ; // aggiungo retrazione if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) @@ -1481,7 +1481,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo approccio per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dStElev ; - if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev)) + if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev)) dStElev = 0 ; if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) return false ; @@ -1544,7 +1544,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo retrazione per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dEndElev ; - if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev)) + if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dEndElev)) dEndElev = dElev ; // aggiungo retrazione if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) @@ -1593,7 +1593,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo approccio per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dStElev ; - if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev)) + if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev)) dStElev = dElev ; if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr)) return false ; @@ -1656,7 +1656,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo retrazione per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { double dEndElev ; - if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev)) + if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dEndElev)) dEndElev = dElev ; // aggiungo retrazione if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr)) @@ -1985,3 +1985,11 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d return false ; } } + +//---------------------------------------------------------------------------- +double +Milling::GetRadiusForStartEndElevation( void) +{ + const double DELTA_ELEV_RAD = 20.0 ; + return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ; +} diff --git a/Milling.h b/Milling.h index c4411e1..a373298 100644 --- a/Milling.h +++ b/Milling.h @@ -66,7 +66,7 @@ class Milling : public Machining ICurve* GetCurve( SelData Id) ; bool Chain( int nGrpDestId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ; - bool CalcElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double& dElev) ; + bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double& dElev) ; bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, bool bSplitArcs) ; bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr, @@ -83,6 +83,7 @@ class Milling : public Machining const Vector3d& vtN, bool bInvert, bool bSplitArcs) ; bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, bool bInvert, bool bSplitArcs, Point3d& ptP1) ; + double GetRadiusForStartEndElevation( void) ; private : double GetSpeed() const diff --git a/Operation.cpp b/Operation.cpp index 9c0406c..68b1010 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -217,13 +217,42 @@ Operation::GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, c if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; // approssimo l'arco con due linee - double dElev1, dElev2 ; - if ( ! GetElevation( nPhase, ptP1, ptP2, vtDir, dElev1)) - return false ; - if ( ! GetElevation( nPhase, ptP2, ptP3, vtDir, dElev2)) - return false ; - dElev = max( dElev1, dElev2) ; - return true ; + double dElev1, dElev2 ; + if ( ! GetElevation( nPhase, ptP1, ptP2, vtDir, dElev1)) + return false ; + if ( ! GetElevation( nPhase, ptP2, ptP3, vtDir, dElev2)) + return false ; + dElev = max( dElev1, dElev2) ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +Operation::GetElevation( int nPhase, const Point3d& ptP, + const Vector3d& vtDir, double dRad, double& dElev) +{ + if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) + return false ; + // considero il punto + if ( ! GetElevation( nPhase, ptP, vtDir, dElev)) + return false ; + // considero i 4 punti sulla circonferenza + Frame3d frLoc ; + frLoc.Set( ptP, vtDir) ; + double dElevT ; + if ( ! GetElevation( nPhase, ptP + frLoc.VersX() * dRad, vtDir, dElevT)) + return false ; + dElev = max( dElev, dElevT) ; + if ( ! GetElevation( nPhase, ptP - frLoc.VersX() * dRad, vtDir, dElevT)) + return false ; + dElev = max( dElev, dElevT) ; + if ( ! GetElevation( nPhase, ptP + frLoc.VersY() * dRad, vtDir, dElevT)) + return false ; + dElev = max( dElev, dElevT) ; + if ( ! GetElevation( nPhase, ptP - frLoc.VersY() * dRad, vtDir, dElevT)) + return false ; + dElev = max( dElev, dElevT) ; + return true ; } //---------------------------------------------------------------------------- diff --git a/Operation.h b/Operation.h index fd24b31..2cb1f2e 100644 --- a/Operation.h +++ b/Operation.h @@ -58,6 +58,8 @@ class Operation : public IUserObj const Vector3d& vtDir, double& dElev) ; bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, const Vector3d& vtDir, double& dElev) ; + bool GetElevation( int nPhase, const Point3d& ptP, + const Vector3d& vtDir, double dRad, double& dElev) ; bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) ; bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist) ; bool GetRawGlobBox( int nPhase, int nPathId, BBox3d& b3Raw) ;