diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index f08f144..e617416 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/GeoConst.h b/GeoConst.h index 6640e32..8ff565a 100644 --- a/GeoConst.h +++ b/GeoConst.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- // EgalTech 2019-2019 //---------------------------------------------------------------------------- -// File : GeoConst.h Data : 13.03.19 Versione : 2.1c3 +// File : GeoConst.h Data : 08.05.19 Versione : 2.1e2 // Contenuto : Costanti generali per calcoli geometrici di lavorazioni. // // @@ -22,3 +22,6 @@ const double LIN_TOL_MID = 0.05 ; const double ANG_TOL_MAX_DEG = 90 ; const double ANG_TOL_STD_DEG = 15 ; const double LIN_FEA_STD = 20 ; + +//----------- Costante per offset salva spigoli di lama su cornici curve ---- +const double SAWRF_OFFS = 0.01 ; diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 7dce825..d4543a1 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -958,18 +958,18 @@ SawFinishing::AdjustGeometry( int nAuxId) pGuide.Set( Release( pCompo)) ; } // deve iniziare in comune con la prima sezione ed essere ivi perpendicolare - Point3d ptStStart, ptGdStart ; - if ( ! vpSects[0]->GetStartPoint( ptStStart) || - ! pGuide->GetStartPoint( ptGdStart) || - ! AreSamePointApprox( ptStStart, ptGdStart)) - return false ; Vector3d vtGdDir ; if ( ! pGuide->GetStartDir( vtGdDir) || ! AreSameOrOppositeVectorApprox( vtN, vtGdDir)) return false ; + Point3d ptStStart, ptGdStart ; + if ( ! vpSects[0]->GetStartPoint( ptStStart) || + ! pGuide->GetStartPoint( ptGdStart) || + ( ptGdStart - ptStStart) * vtGdDir > 10 * EPS_SMALL) + return false ; // creo sottogruppo di ausiliario per le sezioni con riferimento avente - // l'origine nel punto di inizio della prima sezione e la Z opposta alla direzione della guida + // l'origine nel punto di inizio della guida e la Z opposta alla direzione della guida Frame3d frSect ; - if ( ! frSect.Set( ptStStart, - vtGdDir)) + if ( ! frSect.Set( ptGdStart, - vtGdDir)) return false ; int nGrpSectId = m_pGeomDB->AddGroup( GDB_ID_NULL, nAuxId, frSect) ; if ( nGrpSectId == GDB_ID_NULL) @@ -1546,7 +1546,7 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect) pCrv.Set( OffsCrvX.GetLongerCurve()) ; // eseguo trim (se richiesto) - if ( ! TrimSection( pCrv)) + if ( IsNull( pCrv) || ! TrimSection( pCrv)) return false ; pSect = Release( pCrv) ; @@ -2183,10 +2183,14 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, // ascissa double dX = b3Cut.GetMax().x - i * dStep ; // creo la curva di taglio - PtrOwner pCut( pGuide->Clone()) ; double dOffs = dX ; Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; - pCut->SimpleOffset( dOffs) ; + OffsetCurve OffsCrv ; + OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; + PtrOwner pCut( OffsCrv.GetLongerCurve()) ; + if ( IsNull( pCut)) + return false ; + pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; pCut->Translate( vtMove) ; Point3d ptStart ; pCut->GetStartPoint( ptStart) ; // se diverso da precedente, eseguo il taglio @@ -2253,10 +2257,14 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax, Point3d ptP ; pSect->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ; // creo la curva di taglio - PtrOwner pCut( pGuide->Clone()) ; double dOffs = ptP.x ; Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ; - pCut->SimpleOffset( dOffs) ; + OffsetCurve OffsCrv ; + OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; + PtrOwner pCut( OffsCrv.GetLongerCurve()) ; + if ( IsNull( pCut)) + return false ; + pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; pCut->Translate( vtMove) ; Point3d ptStart ; pCut->GetStartPoint( ptStart) ; // se diverso da precedente, eseguo il taglio diff --git a/SawRoughing.cpp b/SawRoughing.cpp index be85b5c..7f21eb5 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -916,18 +916,18 @@ SawRoughing::AdjustGeometry( int nAuxId) pGuide.Set( Release( pCompo)) ; } // deve iniziare in comune con la prima sezione ed essere ivi perpendicolare - Point3d ptStStart, ptGdStart ; - if ( ! vpSects[0]->GetStartPoint( ptStStart) || - ! pGuide->GetStartPoint( ptGdStart) || - ! AreSamePointApprox( ptStStart, ptGdStart)) - return false ; Vector3d vtGdDir ; if ( ! pGuide->GetStartDir( vtGdDir) || ! AreSameOrOppositeVectorApprox( vtN, vtGdDir)) return false ; + Point3d ptStStart, ptGdStart ; + if ( ! vpSects[0]->GetStartPoint( ptStStart) || + ! pGuide->GetStartPoint( ptGdStart) || + ( ptGdStart - ptStStart) * vtGdDir > 10 * EPS_SMALL) + return false ; // creo sottogruppo per le sezioni con riferimento avente - // l'origine nel punto di inizio della prima sezione e la Z opposta alla direzione della guida + // l'origine nel punto di inizio della guida e la Z opposta alla direzione della guida Frame3d frSect ; - if ( ! frSect.Set( ptStStart, - vtGdDir)) + if ( ! frSect.Set( ptGdStart, - vtGdDir)) return false ; int nGrpSectId = m_pGeomDB->AddGroup( GDB_ID_NULL, nAuxId, frSect) ; if ( nGrpSectId == GDB_ID_NULL) @@ -1293,9 +1293,12 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId) if ( ! GetWidthOnSection( pCrv, dY, dSectXMin, dSectXMax, dX)) return false ; // creo la curva di taglio - PtrOwner pCut( pGuide->Clone()) ; + OffsetCurve OffsCrv ; + OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ; + PtrOwner pCut( OffsCrv.GetLongerCurve()) ; + if ( IsNull( pCut)) + return false ; Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; - pCut->SimpleOffset( dX) ; pCut->Translate( vtMove) ; // ne determino la massima elevazione double dElev = 0 ; @@ -1307,6 +1310,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId) pCut->SimpleOffset( dOffs) ; dElev = dMaxDepth ; } + else + pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; // esecuzione del taglio if ( m_Params.m_nStepType != SAWROU_ST_ZIGZAG) { //if ( ! CalculateOneWayCut( ptStart, ptEnd, vtGdDir, vtTool, vtCorr, dElev, bFirst, bLast)) @@ -1852,10 +1857,12 @@ SawRoughing::CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtToo GetElevation( m_nPhase, ptStart, - vtDirStart, dTgElevStart) ; double dOrtElevStart = 0 ; GetElevation( m_nPhase, ptStart, vtOrtStart, dOrtElevStart) ; + dOrtElevStart = max( dOrtElevStart, dElev) ; double dTgElevEnd = 0 ; GetElevation( m_nPhase, ptEnd, vtDirEnd, dTgElevEnd) ; double dOrtElevEnd = 0 ; GetElevation( m_nPhase, ptEnd, vtOrtEnd, dOrtElevEnd) ; + dOrtElevEnd = max( dOrtElevEnd, dElev) ; // se attacco/uscita/collegamento esterno allungo inizio e fine if ( m_Params.m_nLeadLinkType == SAWROU_LL_OUT) { @@ -1979,12 +1986,12 @@ SawRoughing::CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtToo int nStep = static_cast( ceil( dCutH / m_Params.m_dStep)) ; double dStep = dCutH / nStep ; // offset iniziale della curva - pCompo->SimpleOffset( bInvert ? - nStep * dStep : nStep * dStep) ; + pCompo->SimpleOffset( bInvert ? - nStep * dStep : nStep * dStep, ICurve::OFF_FORCE_OPEN) ; // esecuzione degli step for ( int i = nStep - 1 ; i >= 0 ; -- i) { // distanza dal fondo double dDelta = ( ( i != 0) ? i * dStep : 0) ; - pCompo->SimpleOffset( bInvert ? dStep : -dStep) ; + pCompo->SimpleOffset( bInvert ? dStep : -dStep, ICurve::OFF_FORCE_OPEN) ; // movimento in affondo al punto iniziale // con attacco centrato sono sul materiale e devo usare feed di testa if ( m_Params.m_nLeadLinkType != SAWROU_LL_OUT) {