diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 14f173e..f5678ce 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Milling.cpp b/Milling.cpp index 5c6a213..00168b3 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -2673,12 +2673,12 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool int nLoType = GetLeadOutType() ; if ( nLiType == MILL_LI_NONE && ( nLoType == MILL_LO_NONE || nLoType == MILL_LO_AS_LI)) bMidRetract = false ; - if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR) && + if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR || nLiType == MILL_LI_TG_PERP) && nLoType == MILL_LO_AS_LI && abs( m_Params.m_dLiTang) < EPS_SMALL) bMidRetract = false ; - if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR) && - ( nLoType == MILL_LO_TANGENT || nLoType == MILL_LO_LINEAR) && + if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR || nLiType == MILL_LI_TG_PERP) && + ( nLoType == MILL_LO_TANGENT || nLoType == MILL_LO_LINEAR || nLoType == MILL_LO_PERP_TG) && abs( m_Params.m_dLiTang) < EPS_SMALL && abs( m_Params.m_dLoTang) < EPS_SMALL && abs( m_Params.m_dLiPerp - m_Params.m_dLoPerp) < EPS_SMALL) @@ -3735,6 +3735,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) { switch ( m_Params.m_nLeadOutType) { case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ; + case MILL_LO_PERP_TG : nType = MILL_LI_TG_PERP ; break ; case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ; case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ; case MILL_LO_AS_LI : /* resta inalterato */ ; break ; @@ -3749,7 +3750,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || - ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'ingresso a inseguimento if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LI_NONE ; @@ -3759,6 +3760,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const ptP1 = ptStart ; return true ; case MILL_LI_LINEAR : + case MILL_LI_TG_PERP : case MILL_LI_TANGENT : { Vector3d vtPerp = vtStart ; Vector3d vtRot = vtN - vtN * vtStart * vtStart ; @@ -3806,12 +3808,14 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& // Assegno il tipo int nType = GetLeadInType() ; double dTang = m_Params.m_dLiTang ; + double dPerp = m_Params.m_dLiPerp ; // se step invertito if ( bInvert) { // va aggiustato se non zigzag o spirale if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) { switch ( GetLeadOutType()) { case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ; + case MILL_LO_PERP_TG : nType = MILL_LI_TG_PERP ; break ; case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ; case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ; case MILL_LO_AS_LI : /* resta inalterato */ ; break ; @@ -3819,8 +3823,12 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& } if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) dTang = m_Params.m_dLoTang ; + dPerp = m_Params.m_dLoPerp ; } } + // senso di rotazione da dir tg a dir esterna + bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'ingresso a inseguimento if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LI_NONE ; @@ -3830,6 +3838,16 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& return true ; case MILL_LI_LINEAR : return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ; + case MILL_LI_TG_PERP : + { + // direzione perpendicolare + Vector3d vtPerp = vtStart ; + Vector3d vtRot = vtN - vtN * vtStart * vtStart ; + vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; + Point3d ptMid = ptStart + vtPerp * dPerp ; + return ( AddLinearMove( ptMid, MCH_CL_LEADIN) != GDB_ID_NULL && + AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ; + } case MILL_LI_TANGENT : { PtrOwner pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ; @@ -4022,6 +4040,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d int nLiType = GetLeadInType() ; switch ( nLiType) { case MILL_LI_LINEAR : nType = MILL_LO_LINEAR ; break ; + case MILL_LI_TG_PERP : nType = MILL_LO_PERP_TG ; break ; case MILL_LI_TANGENT : nType = MILL_LO_TANGENT ; break ; case MILL_LI_GLIDE : nType = MILL_LO_GLIDE ; break ; case MILL_LI_ZIGZAG : nType = MILL_LO_NONE ; break ; @@ -4038,7 +4057,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || - ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'uscita a inseguimento if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LO_NONE ; @@ -4055,6 +4074,16 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtN * dElev ; return ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ; } + case MILL_LO_PERP_TG : + { + Vector3d vtPerp = vtEnd ; + Vector3d vtRot = vtN - vtN * vtEnd * vtEnd ; + vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; + Point3d ptMid = ptEnd + vtPerp * dPerp ; + ptP1 = ptMid + vtEnd * dTang + vtN * dElev ; + return ( AddLinearMove( ptMid, MCH_CL_LEADOUT) != GDB_ID_NULL && + AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ; + } case MILL_LO_TANGENT : { // calcolo punto finale dell'uscita diff --git a/MillingData.cpp b/MillingData.cpp index a06fa96..3d1a2a7 100644 --- a/MillingData.cpp +++ b/MillingData.cpp @@ -574,7 +574,8 @@ MillingData::VerifyLeadInType( int nVal) const { return ( nVal == MILL_LI_NONE || nVal == MILL_LI_LINEAR || nVal == MILL_LI_TANGENT || nVal == MILL_LI_GLIDE || - nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX) ; + nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX || + nVal == MILL_LI_TG_PERP) ; } //---------------------------------------------------------------------------- @@ -583,7 +584,7 @@ MillingData::VerifyLeadOutType( int nVal) const { return ( nVal == MILL_LO_NONE || nVal == MILL_LO_LINEAR || nVal == MILL_LO_TANGENT || nVal == MILL_LO_GLIDE || - nVal == MILL_LO_AS_LI) ; + nVal == MILL_LO_AS_LI || nVal == MILL_LO_PERP_TG) ; } //----------------------------------------------------------------------------