diff --git a/Milling.cpp b/Milling.cpp index 9bb4d56..98f53f7 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -181,6 +181,7 @@ Milling::Milling( void) m_TParams.m_sName = "*" ; m_TParams.m_sHead = "*" ; m_nMills = 0 ; + m_bStepOn = false ; } //---------------------------------------------------------------------------- @@ -1360,6 +1361,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) } // eventuale sovrapposizione per percorso chiuso + double dAddedOverlap = 0 ; if ( pCompo->IsClosed()) { if ( m_Params.m_dOverlap > EPS_SMALL) { double dParS, dParE ; @@ -1368,6 +1370,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) PtrOwner pCrv( pCompo->CopyParamRange( dParS, dParE)) ; if ( ! IsNull( pCrv)) { pCompo->AddCurve( Release( pCrv)) ; + dAddedOverlap = m_Params.m_dOverlap ; } } } @@ -1531,22 +1534,30 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) // Se una sola passata if ( dOkStep < EPS_SMALL || dElev <= dOkStep) { - // eseguo lavorazione + m_bStepOn = false ; if ( ! AddStandardMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs)) return false ; } // se altrimenti passate a zig-zag else if ( m_Params.m_nStepType == MILL_ST_ZIGZAG) { + m_bStepOn = true ; if ( ! AddZigZagMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs)) return false ; } // se altrimenti passate a one-way else if ( m_Params.m_nStepType == MILL_ST_ONEWAY) { + m_bStepOn = true ; if ( ! AddOneWayMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs)) return false ; } // se altrimenti passate a spirale else if ( m_Params.m_nStepType == MILL_ST_SPIRAL) { + m_bStepOn = true ; + if ( dAddedOverlap > EPS_SMALL) { + pCompo->Invert() ; + pCompo->TrimStartAtLen( dAddedOverlap) ; + pCompo->Invert() ; + } if ( ! AddSpiralMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs)) return false ; } @@ -2641,10 +2652,10 @@ Milling::GetLeadInType( void) const ( 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_Params.m_nStepType == MILL_ST_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_Params.m_nStepType == MILL_ST_SPIRAL) + m_bStepOn && m_Params.m_nStepType == MILL_ST_SPIRAL) return MILL_LI_NONE ; if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) && ( m_TParams.m_nType & TF_SAWBLADE) != 0) @@ -2887,7 +2898,8 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d double dElev = min( m_Params.m_dLoElev, dEndElev + LIO_ELEV_TOL) ; // se uscita come ingresso o step invertito if ( nType == MILL_LO_AS_LI || bInvert) { - switch ( GetLeadInType()) { + int nLiType = GetLeadInType() ; + switch ( nLiType) { case MILL_LI_LINEAR : nType = MILL_LO_LINEAR ; break ; case MILL_LI_TANGENT : nType = MILL_LO_TANGENT ; break ; case MILL_LI_GLIDE : nType = MILL_LO_GLIDE ; break ; @@ -2897,6 +2909,10 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d } dTang = m_Params.m_dLiTang ; dPerp = m_Params.m_dLiPerp ; + if ( nLiType == MILL_LI_HELIX) { + dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ; + dPerp = dTang ; + } dElev = min( m_Params.m_dLiElev, dEndElev + LIO_ELEV_TOL) ; } // senso di rotazione da dir tg a dir esterna diff --git a/Milling.h b/Milling.h index a3828ee..1a26e2d 100644 --- a/Milling.h +++ b/Milling.h @@ -121,6 +121,7 @@ class Milling : public Machining MillingData m_Params ; // parametri lavorazione ToolData m_TParams ; // parametri utensile int m_nMills ; // numero di percorsi di lavoro generati + bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto