diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index c4d32d3..65a7dc4 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 0fd665e..d1f8f2b 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -1029,6 +1029,7 @@ SawFinishing::CalculateAcrossToolPath( int nAuxId, int nClId) int nGuideId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetFirstNameInGroup( nAuxId, MCH_GUIDE)) ; if ( ! CalculateGuideLine( nGuideId, b3Sect, ptGdStart, ptGdEnd, vtGdDir)) return false ; + Vector3d vtDeltaSect = vtGdDir * ( vtGdDir * ( ptGdStart - frSect.Orig())) ; if ( m_Params.m_bInvert) { swap( ptGdStart, ptGdEnd) ; vtGdDir.Invert() ; @@ -1093,6 +1094,7 @@ SawFinishing::CalculateAcrossToolPath( int nAuxId, int nClId) } // La porto in globale PL.ToGlob( frSect) ; + PL.Translate( vtDeltaSect) ; if ( m_Params.m_bInvert) PL.Translate( ptGdStart - ptGdEnd) ; @@ -1231,10 +1233,6 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect) if ( ! TrimSection( pCrv)) return false ; - int nCrvId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ::Release( pCrv)) ; - m_pGeomDB->Save( nCrvId, "C:\\EgtData\\Varie\\Test\\aaa.nge", GDB_SV_TXT) ; - pCrv.Set( ::GetCurveComposite( m_pGeomDB->RemoveGeoObjAndErase( nCrvId))) ; - pSect = Release( pCrv) ; return true ; @@ -1847,7 +1845,7 @@ SawFinishing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, if ( m_nCuts == 0) { SetFlag( 1) ; if ( AddRapidStart( ptP1) == GDB_ID_NULL) - return false ; + return false ; } else { SetFlag( 0) ; @@ -1866,8 +1864,11 @@ SawFinishing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, } else { SetFlag( 0) ; - if ( AddRapidMove( ptP1a) == GDB_ID_NULL) - return false ; + Point3d ptCurr ; GetCurrPos( ptCurr) ; + if ( ! AreSamePointEpsilon( ptCurr, ptP1a, 10 * EPS_SMALL)) { + if ( AddRapidMove( ptP1a) == GDB_ID_NULL) + return false ; + } } // 1b -> punto appena sopra inizio SetFlag( 0) ; @@ -1882,19 +1883,24 @@ bool SawFinishing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) { + Point3d ptCurr ; GetCurrPos( ptCurr) ; if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) { // 4 -> movimento di risalita sopra il punto finale SetFeed( GetEndFeed()) ; Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr) ; - if ( AddLinearMove( ptP4) == GDB_ID_NULL) - return false ; + if ( ! AreSamePointEpsilon( ptP4, ptCurr, 10 * EPS_SMALL)) { + if ( AddLinearMove( ptP4) == GDB_ID_NULL) + return false ; + } } else { // 4a -> movimento di risalita appena sopra il punto finale - SetFeed( GetEndFeed()) ; Point3d ptP4a = ptP + vtCorr * ( dElev + dAppr) ; - if ( AddLinearMove( ptP4a) == GDB_ID_NULL) - return false ; + if ( ! AreSamePointEpsilon( ptP4a, ptCurr, 10 * EPS_SMALL)) { + SetFeed( GetEndFeed()) ; + if ( AddLinearMove( ptP4a) == GDB_ID_NULL) + return false ; + } // 4b -> movimento di risalita sopra il punto finale Point3d ptP4b = ptP4a + Z_AX * ( dSafeZ - m_Params.m_dStartPos) ; if ( AddRapidMove( ptP4b) == GDB_ID_NULL) diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 11f13e1..cc549d9 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -967,10 +967,6 @@ SawRoughing::CalculateToolPath( int nAuxId, int nClId) return false ; } - //int nBBBId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ::Release( pCrv)) ; - //m_pGeomDB->Save( nBBBId, "C:\\EgtData\\Varie\\Test\\bbb.nge", GDB_SV_TXT) ; - //pCrv.Set( ::GetCurve( m_pGeomDB->RemoveGeoObjAndErase( nBBBId))) ; - // determino l'ingombro della curva risultante in locale BBox3d b3Crv ; pCrv->GetLocalBBox( b3Crv) ; @@ -1298,8 +1294,11 @@ SawRoughing::CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, c // con attacco centrato sono sul materiale e devo usare feed di testa if ( m_Params.m_nLeadLinkType != SAWROU_LL_OUT) { SetFeed( GetTipFeed()) ; - if ( AddLinearMove( ptNewStart) == GDB_ID_NULL) - return false ; + Point3d ptCurr ; GetCurrPos( ptCurr) ; + if ( ! AreSamePointEpsilon( ptCurr, ptNewStart, 10 * EPS_SMALL)) { + if ( AddLinearMove( ptNewStart) == GDB_ID_NULL) + return false ; + } } // con attacco fuori sono in aria else { @@ -1517,8 +1516,11 @@ SawRoughing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSaf // 4a -> movimento di risalita appena sopra il punto finale SetFeed( GetEndFeed()) ; Point3d ptP4a = ptP + vtCorr * ( dElev + dAppr) ; - if ( AddLinearMove( ptP4a) == GDB_ID_NULL) - return false ; + Point3d ptCurr ; GetCurrPos( ptCurr) ; + if ( ! AreSamePointEpsilon( ptCurr, ptP4a, 10 * EPS_SMALL)) { + if ( AddLinearMove( ptP4a) == GDB_ID_NULL) + return false ; + } // 4b -> movimento di risalita sopra il punto finale Point3d ptP4b = ptP4a + Z_AX * ( dSafeZ - m_Params.m_dStartPos) ; if ( AddRapidMove( ptP4b) == GDB_ID_NULL)