EgtGeomKernel 3.1e5 :
- in CalcPocketing piccole migliorie e correzioni per ZigZag.
This commit is contained in:
+83
-80
@@ -6856,19 +6856,20 @@ CalcZigZagLink( ICurveComposite* pCrv1, ICurveComposite* pCrv2, const PocketPara
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, ICRVCOMPOPOVECTOR& vpCrvs,
|
||||
CalcZigZag( const ISurfFlatRegion* pSfrZigZag, const PocketParams& PockParams, ICRVCOMPOPOVECTOR& vpCrvs,
|
||||
bool bFromInfill)
|
||||
{
|
||||
|
||||
// check parametri
|
||||
if ( pSrfZigZag == nullptr || ! pSrfZigZag->IsValid())
|
||||
if ( pSfrZigZag == nullptr || ! pSfrZigZag->IsValid())
|
||||
return true ;
|
||||
|
||||
// creo il vettore dei contorni
|
||||
ICRVCOMPOPOVECTOR vFirstOff ;
|
||||
for ( int c = 0 ; c < pSrfZigZag->GetChunkCount() ; ++ c)
|
||||
for ( int l = 0 ; l < pSrfZigZag->GetLoopCount( c) ; ++ l)
|
||||
vFirstOff.emplace_back( GetCurveComposite( pSrfZigZag->GetLoop( c, l))) ;
|
||||
for ( int nC = 0 ; nC < pSfrZigZag->GetChunkCount() ; ++ nC) {
|
||||
for ( int nL = 0 ; nL < pSfrZigZag->GetLoopCount( nC) ; ++ nL)
|
||||
vFirstOff.emplace_back( GetCurveComposite( pSfrZigZag->GetLoop( nC, nL))) ;
|
||||
}
|
||||
|
||||
// ingombro del contorno offsettato
|
||||
BBox3d b3Pocket ;
|
||||
@@ -6883,15 +6884,14 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
int nYStep ;
|
||||
double dYStep ;
|
||||
if ( ! bFromInfill) {
|
||||
nYStep = static_cast< int >( ceil(( dDimY - 30 * EPS_SMALL) / PockParams.dSideStep)) ;
|
||||
dYStep = ( nYStep > 0 ? ( dDimY - 30 * EPS_SMALL) / nYStep : 0) ;
|
||||
nYStep = static_cast<int>( ceil( ( dDimY - 30. * EPS_SMALL) / PockParams.dSideStep)) ;
|
||||
dYStep = ( nYStep > 0 ? ( dDimY - 30. * EPS_SMALL) / nYStep : 0) ;
|
||||
}
|
||||
else {
|
||||
nYStep = static_cast< int >( floor(( dDimY + 30 * EPS_SMALL) / PockParams.dSideStep)) ;
|
||||
nYStep = static_cast<int>( floor( ( dDimY + 30. * EPS_SMALL) / PockParams.dSideStep)) ;
|
||||
dYStep = PockParams.dSideStep ;
|
||||
}
|
||||
|
||||
int nRef = (( nYStep + ( PockParams.bInvert ? 0 : 1)) % 2) ;
|
||||
int nRef = ( PockParams.bInvert ? 1 : 0) ;
|
||||
|
||||
// tratto valido
|
||||
struct Section {
|
||||
@@ -6903,7 +6903,6 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
int nOffIndS ;
|
||||
int nOffIndE ;
|
||||
} ;
|
||||
|
||||
struct ParIsland {
|
||||
double dU ;
|
||||
int nInd ;
|
||||
@@ -6917,27 +6916,26 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i <= nYStep ; ++ i) {
|
||||
// determino senso
|
||||
bool bPlus = (( i % 2) == nRef) ;
|
||||
bool bPlus = ( ( i % 2) == nRef) ;
|
||||
// definisco la linea
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
const double EXP_LEN = 1.0 ;
|
||||
Point3d ptStart ;
|
||||
if ( ! bFromInfill)
|
||||
ptStart.Set( ptMin.x - EXP_LEN, ptMin.y + 10 * EPS_SMALL + i * dYStep, ptMin.z + dDimZ) ;
|
||||
ptStart.Set( ptMin.x - EXP_LEN, ptMin.y + 10. * EPS_SMALL + i * dYStep, ptMin.z + dDimZ) ;
|
||||
else {
|
||||
double dShift = ( i == 0 ? 10 * EPS_SMALL : ( i == nYStep ? - 10 * EPS_SMALL : 0.)) ;
|
||||
double dShift = ( i == 0 ? 10. * EPS_SMALL : ( i == nYStep ? - 10. * EPS_SMALL : 0.)) ;
|
||||
ptStart.Set( ptMin.x - EXP_LEN, ptMin.y + dShift + i * dYStep, ptMin.z + dDimZ) ;
|
||||
}
|
||||
if ( IsNull( pLine) || ! pLine->SetPVL( ptStart, X_AX, dDimX + 2 * EXP_LEN))
|
||||
if ( IsNull( pLine) || ! pLine->SetPVL( ptStart, X_AX, dDimX + 2. * EXP_LEN))
|
||||
return false ;
|
||||
|
||||
if ( ! bPlus)
|
||||
pLine->Invert() ;
|
||||
|
||||
// calcolo la classificazione della linea rispetto alla superficie
|
||||
CRVCVECTOR ccClass ;
|
||||
pSrfZigZag->GetCurveClassification( *pLine, EPS_SMALL, ccClass) ;
|
||||
for ( int j = 0 ; j < int( ccClass.size()) ; ++ j) {
|
||||
pSfrZigZag->GetCurveClassification( *pLine, EPS_SMALL, ccClass) ;
|
||||
for ( int j = 0 ; j < ssize( ccClass) ; ++ j) {
|
||||
// se interno
|
||||
if ( ccClass[j].nClass == CRVC_IN) {
|
||||
// recupero il tratto
|
||||
@@ -6946,21 +6944,21 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
PtrOwner<ICurveLine> pSeg( GetCurveLine( pLine->CopyParamRange( ccClass[j].dParS, ccClass[j].dParE))) ;
|
||||
if ( IsNull( pSeg))
|
||||
continue ;
|
||||
Point3d ptS, ptE ;
|
||||
pSeg->GetStartPoint( ptS) ; pSeg->GetEndPoint( ptE) ;
|
||||
Point3d ptS ; pSeg->GetStartPoint( ptS) ;
|
||||
Point3d ptE ; pSeg->GetEndPoint( ptE) ;
|
||||
// se troppo piccolo, lo scarto
|
||||
if ( SqDist( ptS, ptE) < 250 * 250 * SQ_EPS_SMALL)
|
||||
if ( SqDist( ptS, ptE) < ( 250. * 250.) * SQ_EPS_SMALL)
|
||||
continue ;
|
||||
currSec.ptS = ptS ; currSec.ptE = ptE ;
|
||||
for ( int k = 0 ; k < int( vFirstOff.size()) ; ++ k) {
|
||||
for ( int k = 0 ; k < ssize( vFirstOff) ; ++ k) {
|
||||
if ( vFirstOff[k]->IsPointOn( ptS)) {
|
||||
currSec.nOffIndS = k ;
|
||||
double dUOS; vFirstOff[k]->GetParamAtPoint( ptS, dUOS) ;
|
||||
double dUOS ; vFirstOff[k]->GetParamAtPoint( ptS, dUOS) ;
|
||||
currSec.dOs = dUOS ;
|
||||
}
|
||||
if ( vFirstOff[k]->IsPointOn( ptE)){
|
||||
currSec.nOffIndE = k ;
|
||||
double dUOE; vFirstOff[k]->GetParamAtPoint( ptE, dUOE) ;
|
||||
double dUOE ; vFirstOff[k]->GetParamAtPoint( ptE, dUOE) ;
|
||||
currSec.dOe = dUOE ;
|
||||
}
|
||||
}
|
||||
@@ -6971,10 +6969,12 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
}
|
||||
|
||||
int nStatus = 0 ; // 0 -> inizio oppure ho inserito una parte di isola | 2 -> sto inserendo un segmento
|
||||
Point3d ptS_ref ;
|
||||
Point3d ptSRef ;
|
||||
PtrOwner<ICurveComposite> pLastSeg( CreateCurveComposite()) ; // ultimo segmento nel percorso
|
||||
PtrOwner<ICurveComposite> pCrvLink( CreateCurveComposite()) ; // ultimo link aggiunto
|
||||
// vettore dei link aggiunti ( per Feed )
|
||||
if ( IsNull( pLastSeg) || IsNull( pCrvLink))
|
||||
return false ;
|
||||
// vettore dei link aggiunti (per Feed)
|
||||
ICRVCOMPOPOVECTOR vAddedLinks ;
|
||||
bool bFirstLine = true ; // flag per prima linea di ogni percorso
|
||||
|
||||
@@ -6985,8 +6985,8 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
// se sezione non valida
|
||||
if ( nI < 0 || nJ < 0) {
|
||||
// ricerco la prima valida ( il primo segmento con bActive messo a true)
|
||||
for ( int k = 0 ; k < int( vvSec.size()) && nI < 0 ; ++ k) {
|
||||
for ( int l = 0 ; l < int( vvSec[k].size()) && nJ < 0 ; ++ l) {
|
||||
for ( int k = 0 ; k < ssize( vvSec) && nI < 0 ; ++ k) {
|
||||
for ( int l = 0 ; l < ssize( vvSec[k]) && nJ < 0 ; ++ l) {
|
||||
if ( vvSec[k][l].bActive) {
|
||||
nI = k ;
|
||||
nJ = l ;
|
||||
@@ -6994,9 +6994,11 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
}
|
||||
}
|
||||
// se trovata, creo nuova curva composita
|
||||
if ( nI >= 0 && nJ >= 0) {
|
||||
if ( nI >= 0 && nJ >= 0) {
|
||||
// creo la curva
|
||||
vpCrvs.emplace_back( CreateCurveComposite()) ;
|
||||
if ( IsNull( vpCrvs.back()))
|
||||
return false ;
|
||||
nStatus = 0 ;
|
||||
// aggiungo punto iniziale
|
||||
vpCrvs.back()->AddPoint( vvSec[nI][nJ].ptS) ;
|
||||
@@ -7007,28 +7009,30 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
break ;
|
||||
}
|
||||
// determino senso
|
||||
bool bPlus = (( nI % 2) == nRef) ;
|
||||
bool bPlus = ( ( nI % 2) == nRef) ;
|
||||
// aggiungo la sezione alla curva
|
||||
Section& Sec = vvSec[nI][nJ] ;
|
||||
Sec.bActive = false ;
|
||||
// creo i vettori con le linee Under e Above nella struttura della Section
|
||||
ICURVEPOVECTOR vLineAbove ;
|
||||
if ( nI < nYStep) {
|
||||
for ( int a = 0 ; a < ( int)vvSec[nI + 1].size() ; ++ a) {
|
||||
if ( vvSec[nI + 1][a].bActive)
|
||||
for ( int nA = 0 ; nA < ssize( vvSec[nI + 1]) ; ++ nA) {
|
||||
if ( vvSec[nI + 1][nA].bActive)
|
||||
continue ;
|
||||
PtrOwner<ICurveLine> pLA( CreateCurveLine()) ;
|
||||
pLA->Set( vvSec[nI + 1][a].ptS, vvSec[nI + 1][a].ptE) ;
|
||||
if ( IsNull( pLA) || pLA->Set( vvSec[nI + 1][nA].ptS, vvSec[nI + 1][nA].ptE))
|
||||
return false ;
|
||||
vLineAbove.emplace_back( Release( pLA)) ;
|
||||
}
|
||||
}
|
||||
ICURVEPOVECTOR vLineUnder ;
|
||||
if ( nI > 0) {
|
||||
for ( int u = 0 ; u < int( vvSec[nI-1].size()) ; ++ u) {
|
||||
if ( vvSec[nI-1][u].bActive)
|
||||
for ( int nU = 0 ; nU < ssize( vvSec[nI - 1]) ; ++ nU) {
|
||||
if ( vvSec[nI - 1][nU].bActive)
|
||||
continue ;
|
||||
PtrOwner<ICurveLine> pLU( CreateCurveLine()) ;
|
||||
pLU->Set( vvSec[nI-1][u].ptS, vvSec[nI-1][u].ptE) ;
|
||||
if ( IsNull( pLU) || ! pLU->Set( vvSec[nI - 1][nU].ptS, vvSec[nI - 1][nU].ptE))
|
||||
return false ;
|
||||
vLineUnder.emplace_back( Release( pLU)) ;
|
||||
}
|
||||
}
|
||||
@@ -7037,13 +7041,13 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
if ( IsNull( pLineCompo))
|
||||
return false ;
|
||||
|
||||
Point3d ptE_l ;
|
||||
Point3d ptEL ;
|
||||
if ( bFirstLine)
|
||||
ptE_l = vvSec[nI][nJ].ptS ;
|
||||
ptEL = vvSec[nI][nJ].ptS ;
|
||||
else
|
||||
vpCrvs.back()->GetEndPoint( ptE_l) ;
|
||||
vpCrvs.back()->GetEndPoint( ptEL) ;
|
||||
|
||||
pLineCompo->AddPoint( ptE_l) ;
|
||||
pLineCompo->AddPoint( ptEL) ;
|
||||
pLineCompo->AddLine( vvSec[nI][nJ].ptE) ;
|
||||
// assegno la feed al tratto lineare
|
||||
if ( ! AssignFeedZigZagOneWay( pLineCompo, false, vLineAbove, vLineUnder, vAddedLinks, PockParams)) // Assegno la Feed
|
||||
@@ -7054,7 +7058,7 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
|
||||
if ( nStatus == 0) { // primo segmento per il raccordo smussato
|
||||
pLastSeg.Set( pLineCompo) ;
|
||||
pLastSeg->GetStartPoint( ptS_ref) ;
|
||||
pLastSeg->GetStartPoint( ptSRef) ;
|
||||
}
|
||||
if ( nStatus == 2) { // ho precedentemente aggiunto il bordo di un'isola, quindi mi salvo il secondo segmento
|
||||
|
||||
@@ -7076,8 +7080,8 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
vpCrvs.back()->Clear() ;
|
||||
|
||||
if ( bFromInfill)
|
||||
for ( int u = 0 ; u < pCrvLink->GetCurveCount() ; ++ u)
|
||||
pCrvLink->SetCurveTempProp( u, -1, 1) ;
|
||||
for ( int k = 0 ; k < pCrvLink->GetCurveCount() ; ++ k)
|
||||
pCrvLink->SetCurveTempProp( k, TEMP_PROP_INVALID, 1) ;
|
||||
|
||||
if ( ! AssignFeedZigZagOneWay( pCrvLink, true, vLineAbove, vLineUnder, vAddedLinks, PockParams))
|
||||
return false ;
|
||||
@@ -7086,11 +7090,9 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
vpCrvs.back()->AddCurve( pSeg2->Clone()) ; // aggiungo pSeg2
|
||||
|
||||
// aggiorno il vettore dei Link ( nel caso sia un link tra due segmenti sullo stesso livello )
|
||||
Point3d ptS1 ;
|
||||
pSeg1->GetStartPoint( ptS1) ;
|
||||
Point3d ptS2 ;
|
||||
pSeg2->GetStartPoint( ptS2) ;
|
||||
if ( abs( ptS1.y - ptS2.y) < 50 * EPS_SMALL)
|
||||
Point3d ptS1 ; pSeg1->GetStartPoint( ptS1) ;
|
||||
Point3d ptS2 ; pSeg2->GetStartPoint( ptS2) ;
|
||||
if ( abs( ptS1.y - ptS2.y) < 50. * EPS_SMALL)
|
||||
vAddedLinks.emplace_back( pCrvLink->Clone()) ;
|
||||
|
||||
// pSeg2 ora diventa pSeg1 e il procedimento si itera per tutto il percorso
|
||||
@@ -7105,21 +7107,21 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
double dUref = ( bPlus ? INFINITO : -INFINITO) ;
|
||||
int nNextI = -1 ;
|
||||
int nNextJ = -1 ;
|
||||
int li = nJ + 1 ;
|
||||
for ( int k = nI ; k <= nI + 1 && k < int( vvSec.size()) ; ++ k) {
|
||||
for ( int l = li ; l < int( vvSec[k].size()) ; ++ l) {
|
||||
if ( ! vvSec[k][l].bActive) // se sezione non attiva... non la considero
|
||||
int nLi = nJ + 1 ;
|
||||
for ( int k = nI ; k <= nI + 1 && k < ssize( vvSec) ; ++ k) {
|
||||
for ( int nL = nLi ; nL < ssize( vvSec[k]) ; ++ nL) {
|
||||
if ( ! vvSec[k][nL].bActive) // se sezione non attiva... non la considero
|
||||
continue ;
|
||||
if ( vvSec[k][l].nOffIndS != nIndexIslandE) // se isola diversa... non la considero
|
||||
if ( vvSec[k][nL].nOffIndS != nIndexIslandE) // se isola diversa... non la considero
|
||||
continue ;
|
||||
double dU = vvSec[k][l].dOs ;
|
||||
double dU = vvSec[k][nL].dOs ;
|
||||
if ( bPlus) {
|
||||
if ( dU < dUstart)
|
||||
dU += dUspan ;
|
||||
if ( dU < dUref) {
|
||||
dUref = dU ;
|
||||
nNextI = k ;
|
||||
nNextJ = l ;
|
||||
nNextJ = nL ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -7128,15 +7130,15 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
if ( dU > dUref) {
|
||||
dUref = dU ;
|
||||
nNextI = k ;
|
||||
nNextJ = l ;
|
||||
nNextJ = nL ;
|
||||
}
|
||||
}
|
||||
}
|
||||
li = 0 ;
|
||||
nLi = 0 ;
|
||||
}
|
||||
// se trovato, controllo il contorno dell'isola
|
||||
if ( nNextI != -1) {
|
||||
PtrOwner<ICurve> pCopy ;
|
||||
PtrOwner<ICurve> pCopy( nullptr) ;
|
||||
if ( bPlus) {
|
||||
if ( dUref > dUmax)
|
||||
dUref -= dUspan ;
|
||||
@@ -7165,7 +7167,8 @@ CalcZigZag( const ISurfFlatRegion* pSrfZigZag, const PocketParams& PockParams, I
|
||||
BBox3d b3Copy ;
|
||||
if ( ! IsNull( pCopy))
|
||||
pCopy->GetLocalBBox( b3Copy) ;
|
||||
if ( ! b3Copy.IsEmpty() && ( b3Copy.GetMax().y - b3Copy.GetMin().y) < dYStep + 10 * EPS_SMALL) { // tengo la curva (non ritorno indietro più dello step)
|
||||
if ( ! b3Copy.IsEmpty() && ( b3Copy.GetMax().y - b3Copy.GetMin().y) < dYStep + 10. * EPS_SMALL) {
|
||||
// tengo la curva, non torno indietro dello Step
|
||||
Point3d ptS, ptE ;
|
||||
pCrvLink->Clear() ;
|
||||
pCrvLink->AddCurve( pCopy->Clone()) ;
|
||||
@@ -7502,8 +7505,7 @@ GetZigZagOneWayBorderCrvs( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegio
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
AddZigZag( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketParams& PockParams,
|
||||
ICRVCOMPOPOVECTOR& vCrvCompoRes)
|
||||
AddZigZag( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketParams& PockParams, ICRVCOMPOPOVECTOR& vCrvCompoRes)
|
||||
{
|
||||
// ricavo il numero di Chunk da svuotare
|
||||
if ( pSrfPock == nullptr)
|
||||
@@ -7554,7 +7556,7 @@ AddZigZag( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
|
||||
if ( ! IsChunkAllHomogeneous( pSrfPock, nChunkInd, bIsChunkClosed, bIsChunkAllOpen))
|
||||
return false ;
|
||||
// se il Chunk originale aveva lati aperti, estendo il percorso a ZigZag
|
||||
for ( int nU = 0 ; nU < int( vpCrvs.size()) ; ++ nU) {
|
||||
for ( int nU = 0 ; nU < ssize( vpCrvs) ; ++ nU) {
|
||||
Vector3d vtRef ; vpCrvs[nU]->GetStartDir( vtRef) ;
|
||||
vtRef.Invert() ;
|
||||
bool bIsExtended = false ;
|
||||
@@ -7568,7 +7570,7 @@ AddZigZag( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
|
||||
// se lucidatura
|
||||
if ( PockParams.bPolishing) {
|
||||
// ciclo sui percorsi
|
||||
for ( int k = 0 ; k < int( vpCrvs.size()) ; ++ k) {
|
||||
for ( int k = 0 ; k < ssize( vpCrvs) ; ++ k) {
|
||||
// se attacco a scivolo
|
||||
if ( PockParams.nLiType == LEAD_IN_GLIDE) {
|
||||
double dU ;
|
||||
@@ -7722,7 +7724,7 @@ AddOneWay( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
|
||||
b3Pocket.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
|
||||
|
||||
// passi in Y
|
||||
int nYStep = static_cast<int>( ceil(( dDimY + 2 * dExtra) / PockParams.dSideStep)) ;
|
||||
int nYStep = static_cast<int>( ceil( ( dDimY + 2 * dExtra) / PockParams.dSideStep)) ;
|
||||
double dYStep = ( nYStep > 0 ? ( dDimY + 2 * dExtra) / nYStep : 0) ;
|
||||
-- nYStep ;
|
||||
|
||||
@@ -7737,7 +7739,7 @@ AddOneWay( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
|
||||
|
||||
// definisco la linea
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
Point3d ptStart( ptMin.x - EXP_LEN, ptMin.y + ( - dExtra + i * dYStep), ptMin.z + dDimZ) ;
|
||||
Point3d ptStart( ptMin.x - EXP_LEN, ptMin.y + ( - dExtra + i * dYStep), ptMin.z + dDimZ) ;
|
||||
if ( IsNull( pLine) || ! pLine->SetPVL( ptStart, X_AX, dDimX + 2 * EXP_LEN))
|
||||
return false ;
|
||||
|
||||
@@ -9808,7 +9810,7 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
myParams.dRadialOffset = dRadOffs + ( myParams.bToolCompensation ? dStep : 0.0) ;
|
||||
myParams.bSmooth = bSmooth ;
|
||||
myParams.dAngle = dAngle ;
|
||||
myParams.dSideStep = dStep ;
|
||||
myParams.dSideStep = Clamp( dStep, 10. * EPS_SMALL, 2. * dRad) ;
|
||||
myParams.dOpenMinSafe = dOpenMinSafe ;
|
||||
myParams.bCalcUnclearedRegs = bCalcUnclReg ;
|
||||
myParams.bInvert = bInvert ;
|
||||
@@ -9835,10 +9837,11 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
! myParams.frLocXY.Rotate( ptCenter, pSfr->GetNormVersor() , myParams.dAngle))
|
||||
return false ;
|
||||
|
||||
// porto la superficie da svuotare nel sistema di riferimento lungo Z_AX
|
||||
PtrOwner<ISurfFlatRegion> pSfrAdj( pSfr->Clone()) ;
|
||||
if ( IsNull( pSfrAdj) || ! pSfrAdj->ToLoc( myParams.frLocXY))
|
||||
// porto la superficie da svuotare nel sistema di riferimento locale
|
||||
PtrOwner<ISurfFlatRegion> pSfrAdjLoc( pSfr->Clone()) ;
|
||||
if ( IsNull( pSfrAdjLoc) || ! pSfrAdjLoc->ToLoc( myParams.frLocXY))
|
||||
return false ;
|
||||
|
||||
// porto la superficie limite ( se valida) in tale sistema
|
||||
if ( myParams.SfrLimit.IsValid())
|
||||
myParams.SfrLimit.ToLoc( myParams.frLocXY) ;
|
||||
@@ -9852,20 +9855,20 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
// Se richiesti contorni tengo una copia della supericie attuale ( le funzioni sotto potrebbero rimuoverne dei Chunks)
|
||||
PtrOwner<ISurfFlatRegion> pSfrContour( nullptr) ;
|
||||
if ( myParams.bToolCompensation) {
|
||||
if ( ! pSfrContour.Set( CloneSurfFlatRegion( pSfrAdj)) || ! pSfrAdj->IsValid())
|
||||
if ( ! pSfrContour.Set( CloneSurfFlatRegion( pSfrAdjLoc)) || ! pSfrAdjLoc->IsValid())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// ------------ casi ottimizzati ------------------------------------------
|
||||
ICRVCOMPOPOVECTOR vCrvOptCurves ;
|
||||
if ( ! GetPocketingOptimizedCurves( pSfrAdj, myParams, vCrvOptCurves))
|
||||
if ( ! GetPocketingOptimizedCurves( pSfrAdjLoc, myParams, vCrvOptCurves))
|
||||
return false ;
|
||||
for ( int i = 0 ; i < ssize( vCrvOptCurves) ; ++ i) {
|
||||
vCrvOptCurves[i]->ToGlob( myParams.frLocXY) ;
|
||||
vCrvCompoRes.emplace_back( Release( vCrvOptCurves[i])) ;
|
||||
}
|
||||
// se ho svuotato tutta la superficie, allora ho finito
|
||||
if ( IsNull( pSfrAdj) || ! pSfrAdj->IsValid() || pSfrAdj->GetChunkCount() == 0) {
|
||||
if ( IsNull( pSfrAdjLoc) || ! pSfrAdjLoc->IsValid() || pSfrAdjLoc->GetChunkCount() == 0) {
|
||||
// se necessario aggiungo i bordi ed esco
|
||||
if ( myParams.bToolCompensation)
|
||||
return AddContours( pSfrContour, myParams, vCrvCompoRes) ;
|
||||
@@ -9874,14 +9877,14 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
|
||||
// ------------ recupero le singole curve di svuotatura -------------------
|
||||
ICRVCOMPOPOVECTOR vCrvSingleCurves ;
|
||||
if ( ! GetSinglePocketingCurves( pSfrAdj, myParams, vCrvSingleCurves))
|
||||
if ( ! GetSinglePocketingCurves( pSfrAdjLoc, myParams, vCrvSingleCurves))
|
||||
return false ;
|
||||
for ( int i = 0 ; i < ssize( vCrvSingleCurves) ; ++ i) {
|
||||
vCrvSingleCurves[i]->ToGlob( myParams.frLocXY) ;
|
||||
vCrvCompoRes.emplace_back( Release( vCrvSingleCurves[i])) ;
|
||||
}
|
||||
// se ho svuotato tutta la superficie, allora ho finito
|
||||
if ( IsNull( pSfrAdj) || ! pSfrAdj->IsValid() || pSfrAdj->GetChunkCount() == 0) {
|
||||
if ( IsNull( pSfrAdjLoc) || ! pSfrAdjLoc->IsValid() || pSfrAdjLoc->GetChunkCount() == 0) {
|
||||
// se necessario aggiunfo i bordi ed esco
|
||||
if ( myParams.bToolCompensation)
|
||||
return AddContours( pSfrContour, myParams, vCrvCompoRes) ;
|
||||
@@ -9889,7 +9892,7 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
}
|
||||
|
||||
// ------------ estensione lati aperti ------------------------------------
|
||||
if ( ! ModifySurfByOpenEdges( pSfrAdj, myParams))
|
||||
if ( ! ModifySurfByOpenEdges( pSfrAdjLoc, myParams))
|
||||
return false ;
|
||||
|
||||
// porto una copia della superficie originale nel frame creato
|
||||
@@ -9901,24 +9904,24 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
ICRVCOMPOPOVECTOR vCrvCompoPock ;
|
||||
switch ( nType) {
|
||||
case POCKET_ZIGZAG :
|
||||
if ( ! AddZigZag( pSfrAdj, pSfrLoc, myParams, vCrvCompoPock))
|
||||
if ( ! AddZigZag( pSfrAdjLoc, pSfrLoc, myParams, vCrvCompoPock))
|
||||
return false ;
|
||||
break ;
|
||||
case POCKET_ONEWAY :
|
||||
if ( ! AddOneWay( pSfrAdj, pSfrLoc, myParams, vCrvCompoPock))
|
||||
if ( ! AddOneWay( pSfrAdjLoc, pSfrLoc, myParams, vCrvCompoPock))
|
||||
return false ;
|
||||
break ;
|
||||
case POCKET_SPIRALIN :
|
||||
if ( ! AddSpiralIn( pSfrAdj, pSfrLoc, myParams, vCrvCompoPock))
|
||||
if ( ! AddSpiralIn( pSfrAdjLoc, pSfrLoc, myParams, vCrvCompoPock))
|
||||
return false ;
|
||||
break ;
|
||||
case POCKET_SPIRALOUT :
|
||||
if ( ! AddSpiralOut( pSfrAdj, pSfrLoc, myParams, vCrvCompoPock))
|
||||
if ( ! AddSpiralOut( pSfrAdjLoc, pSfrLoc, myParams, vCrvCompoPock))
|
||||
return false ;
|
||||
break ;
|
||||
case POCKET_CONFORMAL_ZIGZAG :
|
||||
case POCKET_CONFORMAL_ONEWAY :
|
||||
if ( ! AddConformal( pSfrAdj, pSfrLoc, myParams, vCrvCompoPock))
|
||||
if ( ! AddConformal( pSfrAdjLoc, pSfrLoc, myParams, vCrvCompoPock))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user