EgtGeomKernel :
- in CalcPocketing Conformal migliorata la gestione delle entrate.
This commit is contained in:
+55
-40
@@ -7400,27 +7400,6 @@ AdjustCloseEsgesForConformalGuide( ICurveComposite* pCrvCompo, const PocketParam
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetConformalBordersCrvs( const ISurfFlatRegion* pSfrOrig, PocketParams& PockParams,
|
||||
ICRVCOMPOPOVECTOR& vCrvCompo)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pSfrOrig == nullptr || ! pSfrOrig->IsValid())
|
||||
return false ;
|
||||
vCrvCompo.clear() ;
|
||||
|
||||
// La regione da costruire è una FlatRegion dove si estendono i lati aperti di R/2 + OffsR
|
||||
double dIntRad = - PockParams.dRad - PockParams.dRadialOffset ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrBorders( pSfrOrig->CreateOffsetSurf( dIntRad, ICurve::OFF_FILLET)) ;
|
||||
if ( IsNull( pSfrBorders) || ! pSfrBorders->IsValid())
|
||||
return false ;
|
||||
|
||||
// restituisco i Loops
|
||||
return ( GetSfrCrvCompoLoops( pSfrBorders, vCrvCompo)) ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
ModifyConformalStartPoint( ICurveComposite* pCrvFirst, const PocketParams& PockParams,
|
||||
@@ -7732,8 +7711,8 @@ AddLeadInToCurveConformalPaths( const ISurfFlatRegion* pSfrOrig, const ISurfFlat
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
OrderConformalPaths( ICRVCOMPOPOVECTOR& vCrvPaths, const ISurfFlatRegion* pSfrChunk, const ISurfFlatRegion* pSfrOrig,
|
||||
PocketParams& PockParams)
|
||||
OrderAndExtendConformalPaths( ICRVCOMPOPOVECTOR& vCrvPaths, const ISurfFlatRegion* pSfrChunk, const ISurfFlatRegion* pSfrOrig,
|
||||
PocketParams& PockParams)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pSfrChunk == nullptr || ! pSfrChunk->IsValid() ||
|
||||
@@ -7750,18 +7729,10 @@ OrderConformalPaths( ICRVCOMPOPOVECTOR& vCrvPaths, const ISurfFlatRegion* pSfrCh
|
||||
|
||||
// creo le regioni piane di svuotatura dei percorsi
|
||||
ISURFFRPOVECTOR vSfrRemoved ; vSfrRemoved.resize( vCrvPaths.size()) ;
|
||||
ISURFFRPOVECTOR vSfrRemaining ; vSfrRemaining.reserve( vCrvPaths.size()) ;
|
||||
for ( int i = 0 ; i < int( vCrvPaths.size()) ; ++ i) {
|
||||
// dato che le curve di primo Offset sono chiuse, rimuovo per il calcolo della FatCurve
|
||||
// i segmenti di entrata e di uscita
|
||||
PtrOwner<ICurveComposite> pCompoPath( CloneCurveComposite( vCrvPaths[i])) ;
|
||||
if ( IsNull( pCompoPath) || ! pCompoPath->IsValid())
|
||||
return false ;
|
||||
if ( vCrvPaths[i]->GetFirstCurve()->GetTempProp( 0) == TEMP_PROP_OUT_START)
|
||||
PtrOwner<ICurve> pFirstCrv( pCompoPath->RemoveFirstOrLastCurve( false)) ;
|
||||
if ( vCrvPaths[i]->GetLastCurve()->GetTempProp( 0) == TEMP_PROP_OUT_START)
|
||||
PtrOwner<ICurve> pLastCrv( pCompoPath->RemoveFirstOrLastCurve( true)) ;
|
||||
// creo la regione di svuotatura di tale percorso
|
||||
vSfrRemoved[i].Set( GetSurfFlatRegionFromFatCurve( CloneCurveComposite( pCompoPath), PockParams.dRad + 500 * EPS_SMALL, false, false)) ;
|
||||
vSfrRemoved[i].Set( GetSurfFlatRegionFromFatCurve( CloneCurveComposite( vCrvPaths[i]), PockParams.dRad + 500 * EPS_SMALL, false, false)) ;
|
||||
if ( IsNull( vSfrRemoved[i]) || ! vSfrRemoved[i]->IsValid())
|
||||
return false ;
|
||||
}
|
||||
@@ -7946,16 +7917,62 @@ OrderConformalPaths( ICRVCOMPOPOVECTOR& vCrvPaths, const ISurfFlatRegion* pSfrCh
|
||||
}
|
||||
}
|
||||
}
|
||||
// salvo la regione rimanente ( è già in posizione corretta nel vettore)
|
||||
vSfrRemaining.emplace_back( CloneSurfFlatRegion( pSfrToRemove)) ;
|
||||
// aggiorno la regione da svuotare e il numero di Chunk che si sono formati
|
||||
pSfrToRemove->Subtract( *vSfrRemoved[vInds[i]]) ;
|
||||
nChunkRef = pSfrToRemove->GetChunkCount() ;
|
||||
}
|
||||
|
||||
// riordino i percorsi trovati
|
||||
// ordino percorsi e superfici progressive per estendendere le curve presso gli aperti progressivi
|
||||
ICRVCOMPOPOVECTOR vCrvOrderedPaths ; vCrvOrderedPaths.resize( vCrvPaths.size()) ;
|
||||
for ( int i = 0 ; i < int( vInds.size()) ; ++ i)
|
||||
ISURFFRPOVECTOR vSfrRemovedOrdered ; vSfrRemovedOrdered.resize( vCrvPaths.size()) ;
|
||||
for ( int i = 0 ; i < int( vInds.size()) ; ++ i) {
|
||||
// ordino la superficie rimossa dal percorso attuale
|
||||
vSfrRemovedOrdered[i].Set( vSfrRemoved[vInds[i]]) ;
|
||||
// ordino il percorso
|
||||
vCrvOrderedPaths[i].Set( vCrvPaths[vInds[i]]) ;
|
||||
swap( vCrvOrderedPaths, vCrvPaths) ;
|
||||
}
|
||||
|
||||
// controllo che i percorsi effettivamente rimuovano del materiale
|
||||
/*
|
||||
NB. Nel caso di lati aperti, può capitare che si formino delle piccole curve ( estese poi
|
||||
per il LeadIn/LeadOut ) che siano interne ad eventuali estensioni per i lati aperti ma che
|
||||
di fatto non svuotano materiale effettivo ( questo accade, perchè gli Offset non sono come
|
||||
per il caso degli Spiral fatti a partire dai bordi, ma sono calcolati tagliando gli offset
|
||||
dei lati chiusi su una superficie estesa di 1.05 * ( dRad + GetOffsR() )
|
||||
*/
|
||||
vCrvPaths.clear() ;
|
||||
for ( int i = 0 ; i < int( vCrvOrderedPaths.size()) ; ++ i) {
|
||||
// se percorso non valido, passo al successivo
|
||||
if ( IsNull( vCrvOrderedPaths[i]) || ! vCrvOrderedPaths[i]->IsValid())
|
||||
continue ;
|
||||
// se con il percorso i-esimo ho già rimosso tutta la superficie, allora ho finito
|
||||
if ( IsNull( vSfrRemaining[i]) || ! vSfrRemaining[i]->IsValid())
|
||||
break ;
|
||||
// se superficie rimossa dal percorso attuale non valida, errore
|
||||
if ( IsNull( vSfrRemovedOrdered[i]) || ! vSfrRemovedOrdered[i]->IsValid())
|
||||
return false ;
|
||||
// controllo se la superficie rimossa ( + 500 * EPS_SMALL ) interseca la regione da svuotare
|
||||
if ( ! vSfrRemovedOrdered[i]->Intersect( *vSfrRemaining[i]) || IsNull( vSfrRemovedOrdered[i]))
|
||||
return false ;
|
||||
|
||||
if ( vSfrRemovedOrdered[i]->IsValid() && vSfrRemovedOrdered[i]->GetChunkCount() > 0) {
|
||||
// il percorso rimuove materiale, aggiungo LeadIn e LeadOut
|
||||
ICRVCOMPOPOVECTOR vCurrPath ; vCurrPath.resize( 1) ;
|
||||
vCurrPath[0].Set( vCrvOrderedPaths[i]) ;
|
||||
AddLeadInToCurveConformalPaths( vSfrRemaining[i], pSfrChunk, PockParams, vCurrPath) ;
|
||||
vCrvPaths.emplace_back( Release( vCurrPath[0])) ;
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo leadIn e LeadOut per i percorsi rimasti
|
||||
for ( int i = 0 ; i < int( vCrvPaths.size()) ; ++ i) {
|
||||
ICRVCOMPOPOVECTOR vCurrPath ; vCurrPath.resize( 1) ;
|
||||
vCurrPath[0].Set( vCrvPaths[i]) ;
|
||||
AddLeadInToCurveConformalPaths( vSfrRemaining[i], pSfrChunk, PockParams, vCurrPath) ;
|
||||
vCrvPaths[i].Set( vCurrPath[0]) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -8528,10 +8545,8 @@ AddConformal( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig,
|
||||
// concateno Offset e Links
|
||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||
bOk = bOk && ChainConformalOffsWithLinks( vCrvOffs, vCrvLink, vCrvPaths) ;
|
||||
// estendo i percorsi per entrate/uscite dai lati aperti
|
||||
bOk = bOk && AddLeadInToCurveConformalPaths( pSfrOrig, pSfrChunk, PockParams, vCrvPaths) ;
|
||||
// ordino i percorsi trovati
|
||||
bOk = bOk && OrderConformalPaths( vCrvPaths, pSfrChunk, pSfrOrig, PockParams) ;
|
||||
// estendo per lati aperti ed ordino i percorsi trovati
|
||||
bOk = bOk && OrderAndExtendConformalPaths( vCrvPaths, pSfrChunk, pSfrOrig, PockParams) ;
|
||||
if ( ! bOk) {
|
||||
// se qualche passaggio restituisce errore, provo in SpiralIn
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunk_cl( CloneSurfFlatRegion( pSfrChunk)) ;
|
||||
|
||||
Reference in New Issue
Block a user