diff --git a/Pocketing.cpp b/Pocketing.cpp index c3827b4..83bdaf7 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -2006,6 +2006,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; + bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se inizio, approccio globale al punto iniziale if ( bStart) { @@ -2142,6 +2145,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; + bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco if ( GetLeadInType() == POCKET_LI_ZIGZAG || @@ -2505,6 +2511,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; + bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco if ( GetLeadInType() == POCKET_LI_ZIGZAG || @@ -2655,6 +2664,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptS - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; + bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; dStElev -= ( ptP - ptS) * vtExtr ; // sempre approccio di collegamento if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) { @@ -2796,8 +2808,10 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; - dStElev -= ( ptP1 - ptStart) * vtExtr ; bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; + dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco if ( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX || @@ -2978,6 +2992,9 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dElev ; + bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderStart) + dStElev = max( dStElev, dElev) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco if ( GetLeadInType() == POCKET_LI_ZIGZAG ||