EgtMachKernel :
- Test per entrate/Uscite con tool non cilindrici. - Proiezioni facce chiuse con tool non cilindrici.
This commit is contained in:
+185
-159
@@ -2303,10 +2303,11 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
BOOLVECTOR vbChangedPrec( nStep, false) ; // vettore di Flag per superfici uguali tra steps consecutivi
|
||||
VCT3DVECTOR vVtTrasl( nStep, V_NULL) ; // vettore contenente le quote per le passate di svuotature
|
||||
ISURFFRPOVECTOR vSrfLimit ; // vettore delle superfici limite
|
||||
double dExtraLenInOut ; // Lunghezza extra per Tool non cilindrici per LeadIn/Out
|
||||
|
||||
// ricavo le superfici di svuotatura
|
||||
if ( ! SliceVolume( pStm_PartVolume, pStm_Part, pStm_Raw, vSrfSliced, vSrfLimit, vCrvOEWithFlags,
|
||||
vbChangedPrec, vVtTrasl, nStep, vtTool, dElev, dDepth, dStep))
|
||||
vbChangedPrec, vVtTrasl, nStep, vtTool, dElev, dDepth, dStep, dExtraLenInOut))
|
||||
return false ;
|
||||
|
||||
// riporto il volume nel frame globale
|
||||
@@ -2343,7 +2344,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
break ;
|
||||
case POCKET_SUB_SPIRALIN :
|
||||
if ( ! AddSpiralIn( vSrfSliced, vCrvOEWithFlags, vbChangedPrec, vVtTrasl, vSrfLimit, vtTool, vtTool, dDepth, dElev,
|
||||
dMaxElev, dOkStep, bSplitArcs))
|
||||
dMaxElev, dOkStep, bSplitArcs, dExtraLenInOut))
|
||||
return false ;
|
||||
break ;
|
||||
case POCKET_SUB_SPIRALOUT :
|
||||
@@ -2414,7 +2415,7 @@ Pocketing::SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Pa
|
||||
ISURFFRPOVECTOR& vSrfSliced, ISURFFRPOVECTOR& vSfrLimit,
|
||||
std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep)
|
||||
const double dElev, const double dDepth, const double dStep, double& dExtraLenInOut)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pStmVol == nullptr || ! pStmVol->IsValid() ||
|
||||
@@ -2451,14 +2452,16 @@ Pocketing::SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Pa
|
||||
! GetProjectionOfStmToNotPocket( pStm_Raw, pStmVol, vVtTrasl[j-1], pSfrLimitElevation))
|
||||
return false ;
|
||||
// determino se è uno step base o extra
|
||||
bool bIsExtraStep = ! vIndExtraSteps.empty() && ( find( vIndExtraSteps.begin(), vIndExtraSteps.end(), j-1) != vIndExtraSteps.end()) ;
|
||||
bool bIsExtraStep = ! vIndExtraSteps.empty() &&
|
||||
( find( vIndExtraSteps.begin(), vIndExtraSteps.end(), j-1) != vIndExtraSteps.end()) ;
|
||||
// taglio il volume con il piano di svuotatura attuale
|
||||
PtrOwner<ISurfFlatRegion> pSfrCurr( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfrCurr) ||
|
||||
! CutVolumeByPlane( pStmVol, pStm_Part, vVtTrasl[j-1], bIsExtraStep, pSfrCurr))
|
||||
return false ;
|
||||
// tolgo/aggiungo eventuali proiezioni
|
||||
if ( ! ProjectVolume( pStmVol, pStm_Part, vVtTrasl[j-1], j == 1 ? V_INVALID : vVtTrasl[j-2], pSfrLimit, pSfrCurr))
|
||||
if ( ! ProjectVolume( pStmVol, pStm_Part, vVtTrasl[j-1], j == 1 ? V_INVALID : vVtTrasl[j-2], pSfrLimit,
|
||||
pSfrCurr, int( vVtTrasl.size()) == 1), dExtraLenInOut)
|
||||
return false ;
|
||||
// ricavo le proprietà di lato aperto/chiuso
|
||||
if ( ! ChooseCloseOrOpenEdge( pSfrCurr, ( bIsExtraStep && ! m_bPocketPlane) ? vStmES_Edges_OC[j-1] : pStm_Part,
|
||||
@@ -2923,133 +2926,150 @@ Pocketing::CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pS
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Above, const ISurfTriMesh* pStm_Part,
|
||||
ISurfFlatRegion* pSfr_Projection)
|
||||
ISurfFlatRegion* pSfr_Projection, double& dExtraLenInOut)
|
||||
{
|
||||
//// controllo dei parametri
|
||||
// if ( pStmVol_Above == nullptr || ! pStmVol_Above->IsValid() ||
|
||||
// pStm_Part == nullptr || ! pStm_Part->IsValid())
|
||||
// return false ;
|
||||
// NB. Questa funzione è chimata solo in caso ci sia uno Step e il tool non sia cilindrico
|
||||
|
||||
//// se non ho un volume da svuotare, allora non faccio nulla
|
||||
// if ( ! pStmVol_Sliced->IsValid())
|
||||
// return true ;
|
||||
// controllo dei parametri
|
||||
if ( pStmVol_Above == nullptr || ! pStmVol_Above->IsValid() ||
|
||||
pStm_Part == nullptr || ! pStm_Part->IsValid())
|
||||
return false ;
|
||||
|
||||
//// seleziono lo faccia a Z_minima con normale -Z_AX ( è un volume)
|
||||
// double Z_min = INFINITO ;
|
||||
// int nFace = -1 ;
|
||||
// Point3d ptC ;
|
||||
// for ( int f = 0 ; f < pStmVol_Sliced->GetFacetCount() ; ++ f) {
|
||||
// Vector3d vtN ;
|
||||
// if ( ! pStmVol_Sliced->GetFacetCenter( f, ptC, vtN))
|
||||
// return false ;
|
||||
// if ( AreSameVectorEpsilon( vtN, -Z_AX, 10 * EPS_SMALL)) {
|
||||
// if ( ptC.z < Z_min) {
|
||||
// Z_min = ptC.z ;
|
||||
// nFace = f ;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if ( nFace == -1)
|
||||
// return false ;
|
||||
// se non ho un volume da svuotare, allora non faccio nulla
|
||||
if ( ! pStmVol_Above->IsValid())
|
||||
return true ;
|
||||
|
||||
//// controllo gli angoli che la faccia da svuotare con le facce Chiuse adiacenti
|
||||
//// Se l'angolo della faccia Chiusa è > 180° la sua proiezione non influisce nella regione da svuotare -> NON PROIETTO
|
||||
//// Se l'angolo della faccia Chiusa è compreso tra m_TParams.m_dSideAng e 180° -> NON PROIETTO
|
||||
//// Se l'angolo della faccia Chiusa è < m_TParams.m_dSideAng, allora proietto ( migliorabile...)
|
||||
// chiudo il volume con il piano a Z minima ( quindi posso vedere semplicemente i Loop presenti)
|
||||
POLYLINEVECTOR vPL_tmp ;
|
||||
Point3d ptC_tmp ;
|
||||
Plane3d pl_noFace ;
|
||||
PtrOwner<ISurfTriMesh> pStmVol( CloneSurfTriMesh( pStmVol_Above)) ;
|
||||
if ( IsNull( pStmVol) || ! pStmVol->IsValid() ||
|
||||
! pStmVol->GetLoops( vPL_tmp) || vPL_tmp.empty() ||
|
||||
! vPL_tmp[0].GetFirstPoint( ptC_tmp) ||
|
||||
! pl_noFace.Set( ptC_tmp, -Z_AX) ||
|
||||
! pl_noFace.IsValid() ||
|
||||
! SewingMissingFacesOnPlanes( pStmVol, pl_noFace))
|
||||
return false ;
|
||||
|
||||
//// NB. Anche la lunghezza del Tool va ad influire... non è detto che un angolo ammissibile presenti
|
||||
//// una faccia sufficientemente corta lungo Z da non intersecare il Tool
|
||||
// seleziono le facce a Z_minima con normale -Z_AX ( è un volume)
|
||||
INTVECTOR vnFaces ;
|
||||
Point3d ptC ;
|
||||
for ( int f = 0 ; f < pStmVol->GetFacetCount() ; ++ f) {
|
||||
Vector3d vtN ;
|
||||
if ( ! pStmVol->GetFacetCenter( f, ptC, vtN))
|
||||
return false ;
|
||||
if ( AreSameVectorEpsilon( vtN, -Z_AX, 10 * EPS_SMALL) &&
|
||||
abs( ptC.z - ptC_tmp.z) < 20 * EPS_SMALL)
|
||||
vnFaces.push_back( f) ;
|
||||
}
|
||||
if ( vnFaces.empty())
|
||||
return false ;
|
||||
|
||||
//// recupero i contorni della faccia
|
||||
// POLYLINEVECTOR vPL ;
|
||||
// pStmVol_Sliced->GetFacetLoops( nFace, vPL) ;
|
||||
// if ( vPL.empty())
|
||||
// return false ;
|
||||
// controllo gli angoli che la faccia da svuotare con le facce Chiuse adiacenti
|
||||
// Se il SideAngle del tool è positivo, vuol dire che si stringe, in caso contrario si allarga
|
||||
// Se SideAngle > 0 -> proietto tutte le facce con angolo < SideAngle
|
||||
// Se SideAngle < 0 -> proietto tutte le facce con angolo < 180° + |SideAngle| ( ovvero 180° - SideAngle)
|
||||
|
||||
// INTVECTOR vInd_TriaToProj ;
|
||||
// NB. Anche la lunghezza del Tool va ad influire... non è detto che un angolo ammissibile presenti
|
||||
// una faccia sufficientemente corta lungo Z da non intersecare il Tool ( per SideAngle < 0)
|
||||
|
||||
//// per ogni bordo che trovo... ( potrebbero esserci isole)
|
||||
// for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
// // creo la curva a partire da quello esterno
|
||||
// PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
// pCrvCompo->FromPolyLine( vPL[i]) ;
|
||||
// if ( ! pCrvCompo->IsValid())
|
||||
// return false ;
|
||||
// // ricavo il parametro sulla PolyLine coincidente all'indice della faccia adiacente
|
||||
// int nInd = 0 ; double dPar ;
|
||||
// bool bFound = vPL[i].GetFirstU( dPar, true) ;
|
||||
// while ( bFound) {
|
||||
// // recupero il flag
|
||||
// int nFlag = int( dPar) ;
|
||||
// // se non c'è nulla di adiacente, errore
|
||||
// if ( nFlag == SVT_NULL)
|
||||
// return false ;
|
||||
// // ricavo il centroide di questa faccia
|
||||
// Point3d ptC_Adj ; Vector3d vtN_Adj ;
|
||||
// if ( ! pStmVol_Sliced->GetFacetCenter( nFlag, ptC_Adj, vtN_Adj))
|
||||
// return false ;
|
||||
// // controllo se si tratta di una faccia interna alla Part ( quindi Chiusa)
|
||||
// DistPointSurfTm distPtStm( ptC_Adj, *pStm_Part) ;
|
||||
// if ( distPtStm.IsPointInside()) {
|
||||
// // è una faccia Chiusa, ricavo l'angolo
|
||||
// bool bAdjac ; Point3d ptP1, ptP2 ; double dAng ;
|
||||
// if ( ! pStmVol_Sliced->GetFacetsContact( nFace, nFlag, bAdjac, ptP1, ptP2, dAng))
|
||||
// return false ;
|
||||
// // controllo la relazione con l'angolo
|
||||
// if ( dAng < ANG_RIGHT) {
|
||||
// // in questo caso devo controllolare che la lunghezza della faccia adiacente Chiusa lungo z
|
||||
// // sia più piccola della lunghezza del Tool
|
||||
// BBox3d BBox ;
|
||||
// if ( ! pStmVol_Sliced->GetFacetBBox( nFlag, GLOB_FRM, BBox))
|
||||
// return false ;
|
||||
// if ( BBox.GetDimZ() < m_TParams.m_dLen) {
|
||||
// // la lunghezza risulta accettabile, controllo ora il Side_Angle
|
||||
// if ( m_TParams.m_dSideAng < dAng + 1000 * EPS_ANG_SMALL) {
|
||||
// // in questo caso proietto, recupero i triangoli della faccia
|
||||
// INTVECTOR vT ;
|
||||
// if ( ! pStmVol_Sliced->GetAllTriaInFacet( nFlag, vT))
|
||||
// return false ;
|
||||
// // ... e aggiungo i loro indici al vettore generale dei triangoli da proiettare
|
||||
// for ( int t = 0 ; t < int( vT.size()) ; ++ t)
|
||||
// vInd_TriaToProj.push_back( vT[t]) ;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // passo al successivo
|
||||
// ++ nInd ;
|
||||
// bFound = vPL[0].GetNextU( dPar, true) ;
|
||||
// }
|
||||
// }
|
||||
// inverto il volume per trovare gli angoli corretti tra le facce
|
||||
//pStmVol->Invert() ;
|
||||
m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStmVol->Clone()) ;
|
||||
// vettore dei triangoli da proiettare
|
||||
INTVECTOR vInd_TriaToProj ;
|
||||
// per ogni faccia da controllare
|
||||
for ( int f = 0 ; f < int( vnFaces.size()) ; ++ f) {
|
||||
// recupero il bordo della faccia
|
||||
POLYLINEVECTOR vPL ;
|
||||
pStmVol->GetFacetLoops( vnFaces[f], vPL) ;
|
||||
if ( vPL.empty())
|
||||
return false ;
|
||||
// per ogni bordo che trovo... ( potrebbero esserci isole)
|
||||
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
|
||||
// creo la curva a partire da quello esterno
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
pCrvCompo->FromPolyLine( vPL[i]) ;
|
||||
if ( ! pCrvCompo->IsValid())
|
||||
return false ;
|
||||
// ricavo il parametro sulla PolyLine coincidente all'indice della faccia adiacente
|
||||
int nInd = 0 ; double dPar ;
|
||||
bool bFound = vPL[i].GetFirstU( dPar, true) ;
|
||||
while ( bFound) {
|
||||
// recupero il flag
|
||||
int nFlag = int( dPar) ;
|
||||
// se non c'è nulla di adiacente, errore
|
||||
if ( nFlag == SVT_NULL)
|
||||
return false ;
|
||||
// ricavo il centroide di questa faccia
|
||||
Point3d ptC_Adj ; Vector3d vtN_Adj ;
|
||||
if ( ! pStmVol->GetFacetCenter( nFlag, ptC_Adj, vtN_Adj))
|
||||
return false ;
|
||||
// controllo se si tratta di una faccia interna alla Part ( quindi Chiusa)
|
||||
DistPointSurfTm distPtStm( ptC_Adj, *pStm_Part) ;
|
||||
if ( distPtStm.IsPointInside()) {
|
||||
// è una faccia Chiusa, ricavo l'angolo
|
||||
bool bAdjac ; Point3d ptP1, ptP2 ; double dAng ;
|
||||
if ( ! pStmVol->GetFacetsContact( vnFaces[f], nFlag, bAdjac, ptP1, ptP2, dAng))
|
||||
return false ;
|
||||
bool bProj = false ; // flag di proiezione della faccia
|
||||
if ( m_TParams.m_dSideAng < 0) {
|
||||
// se la lunghezza del lato lungo Z supera quella del Tool, allora proietto
|
||||
BBox3d BBox ;
|
||||
if ( ! pStmVol->GetFacetBBox( nFlag, GLOB_FRM, BBox))
|
||||
return false ;
|
||||
bProj = BBox.GetDimZ() > m_TParams.m_dLen ;
|
||||
if ( ! bProj)
|
||||
// se la lunghezza della faccia è valida, allora controllo la relazione con gli angoli
|
||||
bProj = dAng < ANG_RIGHT - m_TParams.m_dSideAng - 2500 * EPS_ANG_SMALL ;
|
||||
}
|
||||
else if ( m_TParams.m_dSideAng < 0 && dAng > ANG_RIGHT - m_TParams.m_dSideAng + 2500 * EPS_ANG_SMALL)
|
||||
bProj = true ;
|
||||
|
||||
//// se non ho nessun triangolo da proiettare, allora non faccio nulla
|
||||
// if ( vInd_TriaToProj.empty())
|
||||
// return true ;
|
||||
// se la faccia è da proiettare
|
||||
if ( bProj) {
|
||||
// recupero i triangoli della faccia
|
||||
INTVECTOR vT ;
|
||||
if ( ! pStmVol->GetAllTriaInFacet( nFlag, vT))
|
||||
return false ;
|
||||
// aggiungo i loro indici al vettore generale dei triangoli da proeittare
|
||||
for ( int t = 0 ; t < int( vT.size()) ; ++ t)
|
||||
vInd_TriaToProj.push_back( vT[t]) ;
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
++ nInd ;
|
||||
bFound = vPL[0].GetNextU( dPar, true) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// dalla superficie tra i due piani rimouovo i triangoli ottenuti
|
||||
// PtrOwner<ISurfTriMesh> pStmToProj( CloneSurfTriMesh( pStmVol_Sliced)) ;
|
||||
// if ( IsNull( pStmToProj) || ! pStmToProj->IsValid())
|
||||
// return false ;
|
||||
// for ( int t = 0 ; t < int( vInd_TriaToProj.size()) ; ++ t)
|
||||
// if ( ! pStmToProj->RemoveTriangle( vInd_TriaToProj[t]))
|
||||
// return false ;
|
||||
// pStmToProj->DoCompacting() ;
|
||||
// if ( ! pStmToProj->IsValid())
|
||||
// return false ;
|
||||
// se non ho nessun triangolo da proiettare, allora non faccio nulla
|
||||
if ( vInd_TriaToProj.empty())
|
||||
return true ;
|
||||
|
||||
//// proietto questa superficie sul piano Z = Z_min, quindi creo il piano
|
||||
// Plane3d plProj ;
|
||||
// plProj.Set( ptC, Z_AX) ;
|
||||
// if ( ! plProj.IsValid() ||
|
||||
// ! ProjectStmOnPlane( pStmToProj, plProj, pSfr_Projection))
|
||||
// return false ;
|
||||
// Dal volume rimouovo i triangoli ottenuti
|
||||
PtrOwner<ISurfTriMesh> pStmToProj( CloneSurfTriMesh( pStmVol)) ;
|
||||
if ( IsNull( pStmToProj) || ! pStmToProj->IsValid())
|
||||
return false ;
|
||||
for ( int t = 0 ; t < int( vInd_TriaToProj.size()) ; ++ t)
|
||||
if ( ! pStmToProj->RemoveTriangle( vInd_TriaToProj[t]))
|
||||
return false ;
|
||||
pStmToProj->DoCompacting() ;
|
||||
if ( ! pStmToProj->IsValid())
|
||||
return false ;
|
||||
|
||||
//// controllo ( per estrema sicurezza) la coerenza con le normali
|
||||
// if ( AreOppositeVectorApprox( Z_AX, pSfr_Projection->GetNormVersor()))
|
||||
// pSfr_Projection->Invert() ;
|
||||
// proietto questa superficie sul piano Z = Z_min
|
||||
Plane3d plProj ;
|
||||
plProj.Set( ptC, Z_AX) ;
|
||||
if ( ! plProj.IsValid() ||
|
||||
! ProjectStmOnPlane( pStmToProj, plProj, pSfr_Projection))
|
||||
return false ;
|
||||
|
||||
//// ATTENZIONE, questa superficie è valida solo per lo Step corrente, tutto ciò che succede sopra al volume
|
||||
//// non influenza questa regione di proiezione
|
||||
// controllo ( per estrema sicurezza) la coerenza con le normali
|
||||
if ( AreOppositeVectorApprox( Z_AX, pSfr_Projection->GetNormVersor()))
|
||||
pSfr_Projection->Invert() ;
|
||||
|
||||
return true ;
|
||||
|
||||
@@ -3058,7 +3078,8 @@ Pocketing::CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Above, const ISu
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const Vector3d& vtTrasl1, const ISurfFlatRegion* pSfrLimit, ISurfFlatRegion* pSfr)
|
||||
const Vector3d& vtTrasl1, const ISurfFlatRegion* pSfrLimit, ISurfFlatRegion* pSfr,
|
||||
const bool bOneStep, double& dExtraLenInOut)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pStmVol == nullptr || ! pStmVol->IsValid() ||
|
||||
@@ -3177,45 +3198,51 @@ Pocketing::ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_
|
||||
|
||||
// per pStmAbove_Near ricavo gli indici dei triangoli delle facce A ( tutti questi triangoli andranno rimossi
|
||||
// lasciando quindi solo le facce C)
|
||||
INTVECTOR vAllTria_A ;
|
||||
for ( int f = 0 ; f < pStmAbove_Near->GetFacetCount() ; ++ f) {
|
||||
// ricavo i parametri della faccia
|
||||
Point3d ptC_f ; Vector3d vtN_f ;
|
||||
if ( ! pStmAbove_Near->GetFacetCenter( f, ptC_f, vtN_f))
|
||||
return false ;
|
||||
// controllo se si tratta di una faccia interna alla Part
|
||||
DistPointSurfTm distPtStm( ptC_f, *pStm_Part) ;
|
||||
if ( ! distPtStm.IsPointInside()) {
|
||||
// se faccia interna, prendo tutti i suoi tringoli ...
|
||||
INTVECTOR vT ;
|
||||
if ( ! pStmAbove_Near->GetAllTriaInFacet( f, vT))
|
||||
return false ;
|
||||
// ... e aggiungo i loro indici al vettore
|
||||
for ( int t = 0 ; t < int( vT.size()) ; ++ t)
|
||||
vAllTria_A.push_back( vT[t]) ;
|
||||
}
|
||||
}
|
||||
// dalla superficie sopra al piano di svuotatura rimouovo i triangoli ottenuti
|
||||
for ( int t = 0 ; t < int( vAllTria_A.size()) ; ++ t)
|
||||
if ( ! pStmAbove_Near->RemoveTriangle( vAllTria_A[t]))
|
||||
return false ;
|
||||
pStmAbove_Near->DoCompacting() ;
|
||||
|
||||
// se non ho ricavato nulla, significa che il volume di svuotatura ( tagliato con il piano, e quindi senza le
|
||||
// facce da svuotare) descrive la stessa geometria della Part ( quindi ogni faccia è sulla Part)
|
||||
// ---> non c'è nulla da proiettare
|
||||
PtrOwner<ISurfFlatRegion> pSfrProjection( CreateSurfFlatRegion()) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrProjection( CreateSurfFlatRegion()) ; // superficie di proiezione
|
||||
if ( IsNull( pSfrProjection))
|
||||
return false ;
|
||||
if ( pStmAbove_Near->IsValid() && pStmAbove_Near->GetTriangleCount() > 0) {
|
||||
// tutta questa superficie contiene solo facce C, le proietto sul piano plNear
|
||||
if ( ! ProjectStmOnPlane( pStmAbove_Near, plNear, pSfrProjection))
|
||||
return false ;
|
||||
// controllo ( per estrema sicurezza) la coerenza con le normali
|
||||
if ( AreOppositeVectorApprox( pSfr->GetNormVersor(), pSfrProjection->GetNormVersor()))
|
||||
pSfrProjection->Invert() ;
|
||||
}
|
||||
|
||||
if ( m_TParams.m_dSideAng != 0 && bOneStep) {
|
||||
if ( ! CheckSideAngleForVolume( pStmAbove_Near, pStm_Part, pSfrProjection, dExtraLenInOut))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
INTVECTOR vAllTria_A ;
|
||||
for ( int f = 0 ; f < pStmAbove_Near->GetFacetCount() ; ++ f) {
|
||||
// ricavo i parametri della faccia
|
||||
Point3d ptC_f ; Vector3d vtN_f ;
|
||||
if ( ! pStmAbove_Near->GetFacetCenter( f, ptC_f, vtN_f))
|
||||
return false ;
|
||||
// controllo se si tratta di una faccia interna alla Part
|
||||
DistPointSurfTm distPtStm( ptC_f, *pStm_Part) ;
|
||||
if ( ! distPtStm.IsPointInside()) {
|
||||
// se faccia interna, prendo tutti i suoi tringoli ...
|
||||
INTVECTOR vT ;
|
||||
if ( ! pStmAbove_Near->GetAllTriaInFacet( f, vT))
|
||||
return false ;
|
||||
// ... e aggiungo i loro indici al vettore
|
||||
for ( int t = 0 ; t < int( vT.size()) ; ++ t)
|
||||
vAllTria_A.push_back( vT[t]) ;
|
||||
}
|
||||
}
|
||||
// dalla superficie sopra al piano di svuotatura rimouovo i triangoli ottenuti
|
||||
for ( int t = 0 ; t < int( vAllTria_A.size()) ; ++ t)
|
||||
if ( ! pStmAbove_Near->RemoveTriangle( vAllTria_A[t]))
|
||||
return false ;
|
||||
pStmAbove_Near->DoCompacting() ;
|
||||
|
||||
// se non ho ricavato nulla, significa che il volume di svuotatura ( tagliato con il piano, e quindi senza le
|
||||
// facce da svuotare) descrive la stessa geometria della Part ( quindi ogni faccia è sulla Part)
|
||||
// ---> non c'è nulla da proiettare
|
||||
if ( pStmAbove_Near->IsValid() && pStmAbove_Near->GetTriangleCount() > 0) {
|
||||
// tutta questa superficie contiene solo facce C, le proietto sul piano plNear
|
||||
if ( ! ProjectStmOnPlane( pStmAbove_Near, plNear, pSfrProjection))
|
||||
return false ;
|
||||
// controllo ( per estrema sicurezza) la coerenza con le normali
|
||||
if ( AreOppositeVectorApprox( pSfr->GetNormVersor(), pSfrProjection->GetNormVersor()))
|
||||
pSfrProjection->Invert() ;
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
// 1) La superficie con le facce A tra i due piani plNear e plFar indentificano una proeizione che estende la
|
||||
@@ -3223,8 +3250,6 @@ Pocketing::ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_
|
||||
// 2) La superficie con le facce C al di sopra del piano plNear identificano una proeizione che riduce la
|
||||
// superficie attuale da svuotare
|
||||
|
||||
|
||||
|
||||
// 1) ricavo la superificie da svuotare come addizione tra la ( *Sfr) e la ( *pSfr_ExtendProjection)
|
||||
if ( pSfr_ExtendProjection->IsValid())
|
||||
if ( ! pSfr->Add( *pSfr_ExtendProjection))
|
||||
@@ -5902,7 +5927,8 @@ Pocketing::AddOneWay( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR
|
||||
bool
|
||||
Pocketing::AddSpiralIn( ISURFFRPOVECTOR& vSfr, const vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs)
|
||||
const double dDepth, const double dElev, const double dMaxElev, const double dOkStep, const bool bSplitArcs,
|
||||
const double dExtraLenInOut)
|
||||
{
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
|
||||
+6
-4
@@ -101,16 +101,17 @@ class Pocketing : public Machining
|
||||
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const ISurfTriMesh* pSt_Raw,
|
||||
ISURFFRPOVECTOR& vSrfSliced, ISURFFRPOVECTOR& vSfrLimit, std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags,
|
||||
BOOLVECTOR& vbChangedPrec, VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep) ;
|
||||
const double dElev, const double dDepth, const double dStep, double& dExtraLenInOut) ;
|
||||
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
|
||||
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
|
||||
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
|
||||
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
|
||||
bool CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Sliced, const ISurfTriMesh* pStm_Part,
|
||||
ISurfFlatRegion* pSfr_Projection) ;
|
||||
ISurfFlatRegion* pSfr_Projection, double& dExtraLenInOut) ;
|
||||
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const Vector3d& vtTraslPrec, const ISurfFlatRegion* pSfrOpenProjPrec, ISurfFlatRegion* pSfr) ;
|
||||
const Vector3d& vtTraslPrec, const ISurfFlatRegion* pSfrOpenProjPrec, ISurfFlatRegion* pSfr,
|
||||
const bool bOneStep, double& dExtraLenInOut) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
|
||||
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
|
||||
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
|
||||
@@ -175,7 +176,8 @@ class Pocketing : public Machining
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralIn( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
const double dDepth, const double dElev, const double dMaxElev, const double dOkStep,
|
||||
const bool bSplitArcs, const double dExtraLenInOut) ;
|
||||
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
|
||||
Reference in New Issue
Block a user