EgtGeomKernel :
- In CalcPocketing migliorato controllo per entrate da fuori - corretta gestione delle curve singole di svuotatura.
This commit is contained in:
+37
-20
@@ -198,7 +198,7 @@ AssignFeedZigZagOneWay( ICurveComposite* pCompo, const bool bIsLink, const ICURV
|
||||
// controllo che la pCompoLine sia effettivamente una linea valida
|
||||
if ( pCompo == nullptr || ! pCompo->IsValid())
|
||||
return false ;
|
||||
|
||||
|
||||
// controllo se il Flag per assegnare la Feed è attivo
|
||||
if ( ! PockParams.bCalcFeed)
|
||||
return AssignMaxFeed( pCompo, PockParams) ;
|
||||
@@ -841,7 +841,7 @@ IsSfrChunkMadeOnlyByClosedIslands( const ISurfFlatRegion* pSfrChunk, const Pocke
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
ExtendPath( ICurveComposite* pCompo, const ISurfFlatRegion* pSfr, const PocketParams& PockParams,
|
||||
Vector3d& vtFirstOut, bool bEndOrStart, bool& bOkExtended)
|
||||
const Vector3d& vtFirstOut, bool bEndOrStart, bool& bOkExtended)
|
||||
{
|
||||
/*
|
||||
Estensione della curva pCompo con un segmento lineare.
|
||||
@@ -858,23 +858,25 @@ ExtendPath( ICurveComposite* pCompo, const ISurfFlatRegion* pSfr, const PocketPa
|
||||
return false ;
|
||||
bOkExtended = false ;
|
||||
|
||||
// recupero il punto iniziale/finale della curva
|
||||
// recupero il punto iniziale/finale della curva con versore tangente
|
||||
Point3d pt ;
|
||||
Vector3d vtTan ;
|
||||
if ( bEndOrStart) {
|
||||
if ( ! pCompo->GetEndPoint( pt))
|
||||
if ( ! pCompo->GetEndPoint( pt) || ! pCompo->GetEndDir( vtTan))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCompo->GetStartPoint( pt))
|
||||
if ( ! pCompo->GetStartPoint( pt) || ! pCompo->GetStartDir( vtTan))
|
||||
return false ;
|
||||
vtTan.Invert() ;
|
||||
}
|
||||
|
||||
// ruoto il versore di uscita cercando un'entrata valida
|
||||
Vector3d vtRotOut = vtFirstOut ;
|
||||
double dMinDist = PockParams.dRad + PockParams.dRadialOffset ;
|
||||
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||
// evito il 180deg
|
||||
if ( i != 2) {
|
||||
// evito il 180deg ( se c'è tangenza )
|
||||
if ( ! AreOppositeVectorEpsilon( vtTan, vtRotOut, 25. * EPS_SMALL)) {
|
||||
// calcolo il punto di caduta dell'utensile
|
||||
Point3d ptFall = pt + vtRotOut * ( PockParams.dRad + PockParams.dOpenMinSafe) ;
|
||||
// controllo che sia sufficientemente distante dalla superficie limite
|
||||
@@ -1721,18 +1723,6 @@ GetPocketCurvesByClosedEdges( const ISurfFlatRegion* pSfrChunk, const PocketPara
|
||||
for ( int i = 0 ; i < int( vCrvVroniOffs.size()) ; ++ i)
|
||||
vCrvCompoRes_tmp.emplace_back( ConvertCurveToComposite( Release( vCrvVroniOffs[i]))) ;
|
||||
|
||||
// controllo che effetticamente l'utensile svuoti la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrNoRemoved( CloneSurfFlatRegion( pSfrChunk)) ;
|
||||
if ( IsNull( pSfrNoRemoved) || ! pSfrNoRemoved->IsValid())
|
||||
return false ;
|
||||
for ( int i = 0 ; i < int( vCrvCompoRes_tmp.size()) ; ++ i) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrRemoved( GetSurfFlatRegionFromFatCurve( CloneCurveComposite( vCrvCompoRes_tmp[i]), PockParams.dRad + PockParams.dRadialOffset + 50 * EPS_SMALL, false, false)) ;
|
||||
if ( ! IsNull( pSfrRemoved) && pSfrRemoved->IsValid())
|
||||
pSfrNoRemoved->Subtract( *pSfrNoRemoved) ;
|
||||
}
|
||||
if ( pSfrNoRemoved->IsValid() && pSfrNoRemoved->GetChunkCount() > 0)
|
||||
return true ;
|
||||
|
||||
/*
|
||||
Casi gestiti :
|
||||
1) La curva esterna e mista e non ho isole ( ho già il percorso)
|
||||
@@ -1777,8 +1767,10 @@ GetPocketCurvesByClosedEdges( const ISurfFlatRegion* pSfrChunk, const PocketPara
|
||||
PtrOwner<ISurfFlatRegion> pSrfIslands( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSrfIslands))
|
||||
return false ;
|
||||
for ( int i = 1 ; i < pSfrChunk->GetLoopCount( 0) ; ++ i)
|
||||
for ( int i = 1 ; i < pSfrChunk->GetLoopCount( 0) ; ++ i) {
|
||||
pSrfIslands->AddExtLoop( pSfrChunk->GetLoop( 0, i)) ;
|
||||
vpCrvs.emplace_back( ConvertCurveToComposite( pSfrChunk->GetLoop( 0, i))) ;
|
||||
}
|
||||
pSrfIslands->Offset( PockParams.dRad + PockParams.dRadialOffset, ICurve::OFF_FILLET) ;
|
||||
for ( int nC = 0 ; nC < pSrfIslands->GetChunkCount() ; ++ nC)
|
||||
for ( int nL = 0 ; nL < pSrfIslands->GetLoopCount( nL) ; ++ nL)
|
||||
@@ -1790,6 +1782,31 @@ GetPocketCurvesByClosedEdges( const ISurfFlatRegion* pSfrChunk, const PocketPara
|
||||
if ( vCrvCompoRes_tmp.empty())
|
||||
return true ;
|
||||
|
||||
// controllo che effettivamente l'utensile svuoti la regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrNoRemoved( CloneSurfFlatRegion( pSfrChunk)) ;
|
||||
if ( IsNull( pSfrNoRemoved) || ! pSfrNoRemoved->IsValid())
|
||||
return false ;
|
||||
for ( int i = 0 ; i < int( vCrvCompoRes_tmp.size()) ; ++ i) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrRemoved( GetSurfFlatRegionFromFatCurve( CloneCurveComposite( vCrvCompoRes_tmp[i]), PockParams.dRad + PockParams.dRadialOffset + 50 * EPS_SMALL, false, false)) ;
|
||||
if ( ! IsNull( pSfrRemoved) && pSfrRemoved->IsValid()) {
|
||||
if ( AreOppositeVectorEpsilon( pSfrRemoved->GetNormVersor(), pSfrNoRemoved->GetNormVersor(), 25. * EPS_SMALL))
|
||||
pSfrRemoved->Invert() ;
|
||||
pSfrNoRemoved->Subtract( *pSfrRemoved) ;
|
||||
}
|
||||
}
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
|
||||
if ( vpCrvs[i]->GetTempProp( 0) == TEMP_PROP_CLOSE_EDGE) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrRemoved( GetSurfFlatRegionFromFatCurve( CloneCurveComposite( vpCrvs[i]), PockParams.dRad + PockParams.dRadialOffset + 50 * EPS_SMALL, false, false)) ;
|
||||
if ( ! IsNull( pSfrRemoved) && pSfrRemoved->IsValid()) {
|
||||
if ( AreOppositeVectorEpsilon( pSfrRemoved->GetNormVersor(), pSfrNoRemoved->GetNormVersor(), 25. * EPS_SMALL))
|
||||
pSfrRemoved->Invert() ;
|
||||
pSfrNoRemoved->Subtract( *pSfrRemoved) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pSfrNoRemoved->IsValid() && pSfrNoRemoved->GetChunkCount() > 0)
|
||||
return true ;
|
||||
|
||||
bAllRemoved = true ;
|
||||
|
||||
// recupero la superficie limite ( se esiste ed è valida)
|
||||
|
||||
Reference in New Issue
Block a user