From e7c2d101117679ea58c315b2673e7bbbd6b68dda Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Mon, 30 Dec 2024 18:03:14 +0100 Subject: [PATCH] EgtMachKernel : - In Sgrossature, aggiunto controllo per piccoli Chunks. --- SurfRoughing.cpp | 13 ++++++++----- SurfRoughing.h | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/SurfRoughing.cpp b/SurfRoughing.cpp index 0a24b59..ad0ef2e 100644 --- a/SurfRoughing.cpp +++ b/SurfRoughing.cpp @@ -254,6 +254,7 @@ SurfRoughing::SurfRoughing( void) m_nPaths = 0 ; m_dMaxHelixRad = INFINITO ; m_dSubStepToler = 2.0 / 2 ; + m_dStepToler = 1.0 / 1 ; m_bDetectPlaneZ = false ; } @@ -1599,7 +1600,7 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) if ( pSfr->IsValid() && pSfr->GetChunkCount() > 0) { // se si tratta di un SottoStep, rimuovo tutti i chunk troppo snelli if ( it->bSubStep) { - if ( ! RemoveChunksUnderTolerance( pSfr, it->pSfrRemoved)) { + if ( ! RemoveChunksUnderTolerance( pSfr, m_dSubStepToler, it->pSfrRemoved)) { m_pMchMgr->SetLastError( 3029, "Error in SurfRoughing : Simplify Chunks for SubSteps failed") ; return false ; } @@ -2876,7 +2877,7 @@ SurfRoughing::SimplyfySfr( ISurfFlatRegion* pSfr) const //---------------------------------------------------------------------------- bool -SurfRoughing::RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, ISurfFlatRegion* pSfrToUpdate) const +SurfRoughing::RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrToUpdate) const { /* quando si lavorano dei SubSteps, può capitare che la superfice da rimuovere sia molto snella; @@ -2894,7 +2895,7 @@ SurfRoughing::RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, ISurfFlatRegion // controllo dei parametri if ( pSfr == nullptr || ! pSfr->IsValid()) return false ; - if ( m_dSubStepToler < EPS_SMALL) // se tolleranza non presente, non faccio nulla + if ( dTol < EPS_SMALL) // se tolleranza non presente, non faccio nulla return true ; // scorro tutti i chunk della superficie @@ -2903,7 +2904,7 @@ SurfRoughing::RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, ISurfFlatRegion double dMaxOffs = EPS_SMALL ; pSfr->GetChunkMaxOffset( nC, dMaxOffs) ; // rimuovo il Chunk c-esimo se l'Offset massimo è minore della tolleranza - if ( dMaxOffs < m_dSubStepToler) { + if ( dMaxOffs < dTol) { if ( pSfrToUpdate != nullptr && pSfrToUpdate->IsValid()) { PtrOwner pSfrChunk( pSfr->CloneChunk( nC)) ; if ( ! IsNull( pSfrChunk) || pSfrChunk->IsValid()) { @@ -3058,7 +3059,7 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler } } - RemoveChunksUnderTolerance( pSfrRegular) ; + RemoveChunksUnderTolerance( pSfrRegular, m_dSubStepToler) ; // resituisco la superficie pSfr->CopyFrom( pSfrRegular) ; return true ; @@ -3213,6 +3214,8 @@ SurfRoughing::ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegio } } + // per sicurezza + RemoveChunksUnderTolerance( pSfr, m_dStepToler) ; return true ; } diff --git a/SurfRoughing.h b/SurfRoughing.h index d862403..f8a9489 100644 --- a/SurfRoughing.h +++ b/SurfRoughing.h @@ -129,7 +129,7 @@ class SurfRoughing : public Machining double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ; double GetRadiusForStartEndElevation( void) const ; bool ResetCurveAllTempProp( ICurve* pCurve) const ; - bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, ISurfFlatRegion* pSfrToUpdate = nullptr) const ; + bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrToUpdate = nullptr) const ; bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ; bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ; bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ; @@ -194,6 +194,7 @@ class SurfRoughing : public Machining int m_nStatus ; // stato di aggiornamento della lavorazione int m_nPaths ; // numero di percorsi di lavoro generati double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi + double m_dStepToler ; // tolleranza di rimozione chunk per Steps double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing } ; \ No newline at end of file