From f0b00ea95eff683c9f9e97cc4920a47fb05add4c Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 22 Dec 2022 15:17:50 +0100 Subject: [PATCH] EgtMachKernel : - in fresature ammesso step negativo con utensili che lavorano di lato( frese non di testa e lame). --- Milling.cpp | 54 ++++++++++++++++++++++++++++++++++------------------- Milling.h | 8 ++++---- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Milling.cpp b/Milling.cpp index 3210946..38b1ac0 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1779,7 +1779,16 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) FromString( ExtractInfo( m_Params.m_sUserNotes, "SideElev="), dSideElev) ; // verifico che lo step dell'utensile sia sensato - double dOkStep = ( m_Params.m_dStep > EPS_SMALL ? m_Params.m_dStep + EPS_ZERO : 0) ; + double dOkStep = 0 ; + bool bStepUp = false ; + if ( m_Params.m_dStep > EPS_SMALL) + dOkStep = m_Params.m_dStep + EPS_ZERO ; + else if ( m_Params.m_dStep < -EPS_SMALL && + ( m_TParams.m_nType == TT_MILL_NOTIP || + ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 && dSideElev < 10 * EPS_SMALL))) { + dOkStep = abs( m_Params.m_dStep) + EPS_ZERO ; + bStepUp = true ; + } const double MIN_ZSTEP = ( m_TParams.m_nType != TT_MILL_POLISHING ? 0.1 : EPS_SMALL) ; if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) { dOkStep = MIN_ZSTEP + EPS_ZERO ; @@ -1912,6 +1921,14 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) m_Params.m_dLoElev = 0 ; } + // Controlli per fresa che non lavora di punta (non deve fare movimenti assiali nel pezzo) + if ( m_TParams.m_nType == TT_MILL_NOTIP) { + // Non ammesse passate a spirale + if ( m_Params.m_nStepType == MILL_ST_SPIRAL) + m_Params.m_nStepType = MILL_ST_ZIGZAG ; + // Ammessa elevazione in attacco e uscita + } + bool bOk = false ; // Se lama con elevazione e step di fianco @@ -1927,12 +1944,12 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) // se altrimenti passate a zig-zag else if ( m_Params.m_nStepType == MILL_ST_ZIGZAG) { m_bStepOn = true ; - bOk = AddZigZagMilling( pCompo, vtTool, dDepth, dElev, dOkStep, bSplitArcs, bPathTabsEnable, bPathOscEnable) ; + bOk = AddZigZagMilling( pCompo, vtTool, dDepth, dElev, dOkStep, bStepUp, bSplitArcs, bPathTabsEnable, bPathOscEnable) ; } // se altrimenti passate a one-way else if ( m_Params.m_nStepType == MILL_ST_ONEWAY) { m_bStepOn = true ; - bOk = AddOneWayMilling( pCompo, vtTool, dDepth, dElev, dOkStep, bSplitArcs, bPathTabsEnable, bPathOscEnable) ; + bOk = AddOneWayMilling( pCompo, vtTool, dDepth, dElev, dOkStep, bStepUp, bSplitArcs, bPathTabsEnable, bPathOscEnable) ; } // se altrimenti passate a spirale else if ( m_Params.m_nStepType == MILL_ST_SPIRAL) { @@ -2515,8 +2532,8 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo //---------------------------------------------------------------------------- bool -Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, - double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) +Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, + double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) { // recupero distanze di sicurezza double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; @@ -2552,9 +2569,10 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool int nMaxInd = pCompo->GetCurveCount() - 1 ; // ciclo sugli step - for ( int j = 1 ; j <= nStep ; ++ j) { + for ( int k = 1 ; k <= nStep ; ++ k) { // flag direzione (prima passata indice 1) - bool bInvert = ( ( j % 2) == 0) ; + bool bInvert = ( ( k % 2) == 0) ; + int j = ( bStepUp ? nStep - k + 1 : k) ; m_dCurrTabsLen = 0 ; m_dCurrOscillLen = 2 * dOscRampLen + 1.5 * dOscFlatLen ; // ciclo sulle curve elementari @@ -2578,7 +2596,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool pCurve->GetStartDir( vtStart) ; // determino elevazione su inizio attacco double dStElev ; - if ( j == 1) { + if ( k == 1) { if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dStep ; } @@ -2602,7 +2620,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // imposto versore correzione e ausiliario sul punto di partenza CalcAndSetCorrAuxDir( pCompo, ( bInvert ? nMaxInd - i + 1 : i)) ; // se primo step aggiungo approccio per frese normali - if ( j == 1 && ( m_TParams.m_nType & TF_SAWBLADE) == 0) { + if ( k == 1 && ( m_TParams.m_nType & TF_SAWBLADE) == 0) { // correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-) Vector3d vtEscape = vtTool ; if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) { @@ -2631,7 +2649,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // se lama if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) { SetFlag( 0) ; - if ( j == 1) { + if ( k == 1) { // verifico di entrare in aria if ( ! bOutStart) { m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ; @@ -2715,7 +2733,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool pCurve->GetEndDir( vtEnd) ; // elevazione sul punto finale double dEndElev ; - if ( j == nStep) { + if ( k == nStep) { if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev)) dEndElev = dElev ; } @@ -2723,7 +2741,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool dEndElev = - LIO_ELEV_TOL ; // se non c'è attacco a zigzag o a spirale oppure ultimo step, aggiungo uscita Point3d ptP1 = ptEnd ; - if ( ! IsLeadInHelixOrZigzag() || j == nStep) { + if ( ! IsLeadInHelixOrZigzag() || k == nStep) { SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ; @@ -2731,7 +2749,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) { + if ( k == nStep && ( m_TParams.m_nType & TF_SAWBLADE) == 0) { // determino se la fine dell'uscita è sopra il grezzo bool bAboveEnd = false ; if ( m_bAboveHead) { @@ -2769,8 +2787,8 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool //---------------------------------------------------------------------------- bool -Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, - double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) +Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, + double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) { // recupero distanze di sicurezza double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; @@ -2877,7 +2895,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // ciclo sugli step int nMaxInd = pCompo->GetCurveCount() - 1 ; - for ( int j = 1 ; j <= nStep ; ++ j) { + for ( int k = 1 ; k <= nStep ; ++ k) { + int j = ( bStepUp ? nStep - k + 1 : k) ; m_dCurrTabsLen = 0 ; m_dCurrOscillLen = 2 * dOscRampLen + 1.5 * dOscFlatLen ; // ciclo sulle curve elementari @@ -3892,9 +3911,6 @@ Milling::GetLeadInType( void) const if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) && ( m_Params.m_dLiTang < min( 0.1 * m_TParams.m_dDiam, 1.0) || m_Params.m_dLiElev < 10 * EPS_SMALL)) return MILL_LI_NONE ; - //if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) && - // m_bStepOn && m_Params.m_nStepType == MILL_ST_ZIGZAG) - // return MILL_LI_NONE ; if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) && m_bStepOn && m_Params.m_nStepType == MILL_ST_SPIRAL) return MILL_LI_NONE ; diff --git a/Milling.h b/Milling.h index 6e48a09..4448ff8 100644 --- a/Milling.h +++ b/Milling.h @@ -88,10 +88,10 @@ class Milling : public Machining bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ; bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; - bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, - double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; - bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, - double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; + bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, + double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; + bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, + double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; bool AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ; bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,