EgtMachKernel :
- Gestione LeadIn/Out ( inizio stesura funzioni).
This commit is contained in:
+89
-8
@@ -5921,23 +5921,19 @@ Pocketing::AddSpiralIn( ISURFFRPOVECTOR& vSfr, const vector<ICRVCOMPOPOVECTOR>&
|
||||
}
|
||||
|
||||
// 3 punti critici per entrate ed uscite
|
||||
Point3d ptA, ptB ;
|
||||
Point3d ptS, ptE ;
|
||||
|
||||
// per ogni entità trovata...
|
||||
int nSpiralEntity = int( vMCrv.size()) ;
|
||||
for ( int e = 0 ; e < nSpiralEntity ; ++ e) {
|
||||
|
||||
// se non sono al primo step, regolo l'uscita all'ultima entità dello step precedente
|
||||
if ( j != 1) {
|
||||
// DEVO AVERE PTE PRECEDNETE E PTS ATTUALE
|
||||
// CALCOLO LA QUOTA CORRETTA
|
||||
|
||||
// uscita e retrazione entità precedente
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
Point3d ptEnd ; vMCrv[e]->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ; vMCrv[e]->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
double dEndElev = dElev ;
|
||||
@@ -5951,7 +5947,6 @@ Pocketing::AddSpiralIn( ISURFFRPOVECTOR& vSfr, const vector<ICRVCOMPOPOVECTOR>&
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
@@ -6150,6 +6145,92 @@ Pocketing::AddSpiralIn( ISURFFRPOVECTOR& vSfr, const vector<ICRVCOMPOPOVECTOR>&
|
||||
vRCrv_step_prec_tot.swap( vRCrv) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const double& dSafeZ, const ISurfFlatRegion* pSfr,
|
||||
ICurveComposite* pCrvStepLink)
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( ! ptS.IsValid() || ! ptE.IsValid() ||
|
||||
pSfr == nullptr || ! pSfr->IsValid() ||
|
||||
pCrvStepLink == nullptr)
|
||||
return false ;
|
||||
pCrvStepLink->Clear() ;
|
||||
|
||||
// prendo la regione ed Offsetto internamente per ricavare la regione sicura dove posso muovermi
|
||||
PtrOwner<ISurfFlatRegion> pSfrSafe( pSfr->CreateOffsetSurf( - m_TParams.m_dDiam - GetOffsR() + 5 * EPS_SMALL,
|
||||
ICurve::OFF_FILLET)) ;
|
||||
if ( IsNull( pSfrSafe) || ! pSfrSafe->IsValid())
|
||||
return false ;
|
||||
|
||||
// creo un sistema di riferimento centrato nella regione
|
||||
Frame3d frCurr ;
|
||||
frCurr.Set( ptS, pSfr->GetNormVersor()) ;
|
||||
if ( ! frCurr.IsValid())
|
||||
return false ;
|
||||
|
||||
// porto la supercie Safe nel riferimento creato
|
||||
pSfrSafe->ToLoc( frCurr) ;
|
||||
|
||||
// ricavo il punto finale proiettato sul piano Z = 0 ( quello di svuotatura attuale)
|
||||
Point3d ptEProj = ptE ; ptEProj.ToLoc( frCurr) ; ptEProj.z = 0 ;
|
||||
|
||||
// Se il punto proiettato coincide con l'ORIG ( ptS) allora ho già finito ( il collegamento non serve)
|
||||
if ( AreSamePointEpsilon( ORIG, ptEProj, 10 * EPS_SMALL))
|
||||
return true ;
|
||||
|
||||
// creo un Segmento tra l'ORIG ( ptS) e la proiezione del punto finale
|
||||
PtrOwner<ICurveLine> pSeg( CreateCurveLine()) ;
|
||||
if ( IsNull( pSeg) ||
|
||||
! pSeg->Set( ORIG, ptEProj) ||
|
||||
! pSeg->IsValid())
|
||||
return false ;
|
||||
|
||||
// se il segmento è tutto interno alla regione Safe...
|
||||
CRVCVECTOR ccClass ;
|
||||
if ( ! pSfrSafe->GetCurveClassification( *pSeg, EPS_SMALL, ccClass) ||
|
||||
ccClass.empty())
|
||||
return false ;
|
||||
if ( int( ccClass.size()) == 1 && ccClass[0].nClass == CRVC_IN)
|
||||
// creo il tratto lineare leggermente rialzato
|
||||
return ( pCrvStepLink->AddPoint( ORIG) &&
|
||||
pCrvStepLink->AddLine( ORIG + dSafeZ * Z_AX) &&
|
||||
pCrvStepLink->AddLine( ptEProj + dSafeZ * Z_AX) &&
|
||||
pCrvStepLink->IsValid() &&
|
||||
pCrvStepLink->ToGlob( frCurr)) ;
|
||||
|
||||
// se invece esistono intersezioni devo prendere in considerazione i tratti esterni alla regione
|
||||
// su di essi calcolo l'elevazione considerata sopra la segmento
|
||||
double dMAxElev = 0. ;
|
||||
for ( int i = 0 ; i < int( ccClass.size()) ; ++ i) {
|
||||
if ( ccClass[i].nClass == CRVC_IN)
|
||||
continue ;
|
||||
Point3d ptS_i, ptE_i ;
|
||||
if ( ! pSeg->GetPointD1D2( ccClass[i].dParS, ICurve::FROM_MINUS, ptS_i) ||
|
||||
! pSeg->GetPointD1D2( ccClass[i].dParE, ICurve::FROM_PLUS, ptE_i))
|
||||
return false ;
|
||||
double dElev = 0. ;
|
||||
ptS_i.ToGlob( frCurr) ;
|
||||
ptE_i.ToGlob( frCurr) ;
|
||||
if ( ! GetElevation( m_nPhase, ptS_i, ptE_i, pSfr->GetNormVersor(), m_TParams.m_dDiam * 0.5, m_TParams.m_dLen,
|
||||
pSfr->GetNormVersor(), dElev))
|
||||
return false ;
|
||||
dMAxElev = max( dMAxElev, dElev) ;
|
||||
}
|
||||
// se l'elevazione massima è nulla, allora sono sempre fuori dal grezzo ( quindi passo per i lati aperti)
|
||||
if ( dMAxElev < EPS_SMALL)
|
||||
return ( pCrvStepLink->AddPoint( ORIG) &&
|
||||
pCrvStepLink->AddLine( ORIG + dSafeZ * Z_AX) &&
|
||||
pCrvStepLink->AddLine( ptEProj + dSafeZ * Z_AX) &&
|
||||
pCrvStepLink->IsValid() &&
|
||||
pCrvStepLink->ToGlob( frCurr)) ;
|
||||
|
||||
|
||||
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,10 @@ class Pocketing : public Machining
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
|
||||
bool CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const double& dSafeZ, const ISurfFlatRegion* pSfr,
|
||||
ICurveComposite* pCrvStepLink) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
private :
|
||||
|
||||
Reference in New Issue
Block a user