From 66f763a772a072a4f7e86282a788c2ca38213a4f Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Wed, 11 Feb 2026 17:24:19 +0100 Subject: [PATCH] EgtMachKernel : - in sgrossature aggiunto parametro utente per offset radiale da superfici di supporto - in sgrossature modifiche stilistiche - in sgrossature correzioni nel calcolo delle superfici nei vari Step e SubSteps. --- OperUserNotesConst.h | 1 + SurfRoughing.cpp | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/OperUserNotesConst.h b/OperUserNotesConst.h index 3a1d510..a86b5af 100644 --- a/OperUserNotesConst.h +++ b/OperUserNotesConst.h @@ -67,6 +67,7 @@ static const std::string UN_ANGLETOL = "AngleTol" ; // Solo per SurfRoughing static const std::string UN_PLANEZ = "PlaneZ" ; static const std::string UN_ORDER = "Order" ; +static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ; // Solo per Waterjetting static const std::string UN_START = "START" ; diff --git a/SurfRoughing.cpp b/SurfRoughing.cpp index 2361af8..ead270f 100644 --- a/SurfRoughing.cpp +++ b/SurfRoughing.cpp @@ -129,7 +129,6 @@ static string KEY_SUBSTEP = "SUBSTEP" ; const double STEP_TOL = 10. * EPS_SMALL ; const double SIL_DEPTH_TOL = 100. * EPS_SMALL ; const double OFFS_CORR_OPEN_EDGES = 25. * EPS_SMALL ; -const double SUPP_SURF_RADIAL_OFFS = 5. ; const double TOL_OFFS_CORNER_COLL = 50. * EPS_SMALL ; const double DIST_TABLE = 5. * EPS_SMALL ; @@ -1495,6 +1494,13 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) // temporaneo. L'analisi per la superficie di Sgrossatura, Limite e Removed non dipende // dall'ordine, ma semplicemente dalla quota Z del piano di sgrossatura ] + // controllo se presente parametro di Offset radiale per superfici di supporto + double dSuppRadOffs = 5. ; + double dSuppRadOffsByNotes = 0. ; + if ( GetValInNotes( m_Params.m_sUserNotes, UN_SUPP_RAD_OFFS, dSuppRadOffsByNotes) && + dSuppRadOffsByNotes > - EPS_ZERO) + dSuppRadOffs = dSuppRadOffsByNotes ; + // creo un frame centrato sulla superficie Frame3d frSfr ; Point3d ptCenter ; pSfrSgro->GetCentroid( ptCenter) ; @@ -1796,9 +1802,6 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) return false ; } if ( ! IsNull( pSfrSil) && ! it->bPlaneZStep) { - #if ENABLE_DEBUG_SFR - DrawLoopsSurf( pSfrSil, true, Color( .1, .1, .1, .2), false, ToString( it->dDepth)) ; - #endif // provo prima con un Offset Chamfer, se non funziona provo con il Fillet ( pezza da sistemare ! ) PtrOwner pSfrSilCheck( pSfrSil->CreateOffsetSurf( GetOffsR(), ICurve::OFF_CHAMFER)) ; if ( IsNull( pSfrSilCheck) || ! pSfrSilCheck->IsValid()) { @@ -1830,18 +1833,30 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) return false ; } if ( ! IsNull( pSfrSil_supp)) { - pSfrSil_supp->Offset( SUPP_SURF_RADIAL_OFFS, ICurve::OFF_CHAMFER) ; // offset radiale sulla Silhouette - pSfr->Subtract( *pSfrSil_supp) ; // sottraggo le parti da non lavorare - pSfrSil->Add( *pSfrSil_supp) ; // aggiungo la regione alla Silhouette + // Offset radiale sulla Silhouette + pSfrSil_supp->Offset( dSuppRadOffs + GetOffsR(), ICurve::OFF_CHAMFER) ; + // Sottraggo le parti da non lavorare + pSfr->Subtract( *pSfrSil_supp) ; + // Aggiungo la regione alla Silhouette + if ( ! IsNull( pSfrSil) && pSfrSil->IsValid() && pSfrSil->GetChunkCount() > 0) + pSfrSil->Add( *pSfrSil_supp) ; + else + pSfrSil.Set( Release( pSfrSil_supp)) ; + // Aggiorno la regione Ipotetica + if ( ! IsNull( pSfrSil_Hypothetical) && pSfrSil_Hypothetical->IsValid() && pSfrSil_Hypothetical->GetChunkCount() > 0) + pSfrSil_Hypothetical->Add( *pSfrSil_supp) ; + else + pSfrSil_Hypothetical.Set( Release( pSfrSil_supp)) ; } - if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) // se superficie non valida - continue ; // passo allo step successivo + // Se superficie non valida, passo allo step successivo + if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) + continue ; } // salvo la superficie rimossa delete( it->pSfrRemoved) ; it->pSfrRemoved = CloneSurfFlatRegion( pSfrRemoved_tmp) ; - if ( pSfrSil_Hypothetical->IsValid() && pSfrSil_Hypothetical->GetChunkCount() > 0) { + if ( ! IsNull( pSfrSil_Hypothetical) && pSfrSil_Hypothetical->IsValid() && pSfrSil_Hypothetical->GetChunkCount() > 0) { pSfrSil_Hypothetical->Offset( m_TParams.m_dDiam / 2, ICurve::OFF_FILLET) ; // si può ingrandire leggermente (più conservativo) pSfrSil_Hypothetical->Offset( - m_TParams.m_dDiam / 2, ICurve::OFF_FILLET) ; // la silhouette ipotetica ora ha i lati chiusi definiti dal rotalamento del tool lungo il chiuso reale @@ -2573,7 +2588,7 @@ SurfRoughing::GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& d // determino la superficie di ricerca per la pulizia dei corners pSfrSearchCorners->Clear() ; pSfrSearchCorners->CopyFrom( pSfrColl) ; - pSfrSearchCorners->Offset( m_TParams.m_dDiam + TOL_OFFS_CORNER_COLL, ICurve::OFF_FILLET) ; + pSfrSearchCorners->Offset( 1.5 * m_TParams.m_dDiam + TOL_OFFS_CORNER_COLL, ICurve::OFF_FILLET) ; if ( ! pSfrSearchCorners->Intersect( *pSfrSgro)) return false ; } @@ -2721,7 +2736,7 @@ SurfRoughing::GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pS di unione dei lati aperti originali con i nuovi chiusi). questa funzione aggiunge delle piccole parti di regione in questi punti, evitando quindi la presenza di colonne di materiale non rimosso - NB. questa parti non riguardano nè le regioni nons vuotate, nè le regioni si silhouette ipotetica + NB. questa parti non riguardano nè le regioni non vuotate, nè le regioni di silhouette ipotetica */ // se la superficie di collissione non è valida non faccio nulla @@ -2931,7 +2946,7 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf const ISurfFlatRegion* pSfrPock = GetSurfFlatRegion( m_pGeomDB->GetGeoObj( vId.first)) ; if ( pSfrPock == nullptr || ! pSfrPock->IsValid()) continue ; - vStepInfo[nInd].pSfrPock.Set( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( vId.first))) ; + vStepInfo[nInd].pSfrPock.Set( CloneSurfFlatRegion( pSfrPock)) ; // --- recupero Flag per step normale o extra ( SubStep/PlaneZ) string sIsExtraStep = "" ; bool bIsExtraStep = false ;