Merge commit 'f8280502c4a911d2f51f223efa7601d5edcd30cb'

This commit is contained in:
Dario Sassi
2025-05-27 15:15:03 +02:00
2 changed files with 249 additions and 152 deletions
+242 -148
View File
@@ -3357,10 +3357,10 @@ PocketingNT::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
PocketingNT::CalcLeadInOutGlide( const PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath, bool bInVsOut,
ICurveComposite* pCrvGlide)
PocketingNT::CalcLeadInOutGlide( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide)
{
/* Funzione per il calcolo della curva a sciovolo (piana) in entrata o in uscita
/* Funzione per il calcolo della curva a sciovolo (piana) in entrata o in uscita
pCrvGlide = nullptr */
// controllo dei parametri
@@ -3368,135 +3368,189 @@ PocketingNT::CalcLeadInOutGlide( const PathInfoPO& PathInfo, const StepInfoPO& S
pCrvGlide == nullptr)
return false ;
// Entrata a Scivolo
if ( bInVsOut) {
// se l'entrata non è a scivolo, non faccio nulla
if ( GetLeadInType() != POCKET_LI_GLIDE)
return true ;
// se l'entrata è presso un lato aperto, non faccio nulla
if ( PathInfo.bOutStart)
return true ;
// l'entrata a guida viene eseguita nel caso di percorsi SpiralIn/Out o curve di bordo chiuse
if ( ( PathInfo.bSingleCrv && ! pCrvPath->IsClosed()) ||
( PathInfo.bOptTrap && ! pCrvPath->IsClosed()) ||
( PathInfo.bIsZigZagOneWayBorder && ! pCrvPath->IsClosed()))
return true ;
// inizializzo e recupero il percorso :
PtrOwner<ICurveComposite> pCrvGlideIn( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideIn))
return false ;
// se chiuso
if ( pCrvPath->IsClosed())
pCrvGlideIn->CopyFrom( pCrvPath) ;
// se aperto
else {
// potrebbe esserci un percorso interno chiuso, lo cerco
Point3d ptStart ; pCrvPath->GetStartPoint( ptStart) ;
int nCrv = 0 ;
bool bOk = false ;
for ( ; nCrv < pCrvPath->GetCurveCount() ; ++ nCrv) {
const ICurve* pCrv = pCrvPath->GetCurve( nCrv) ;
if ( pCrv == nullptr)
return false ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
if ( AreSamePointApprox( ptStart, ptEnd)) {
++ nCrv ;
bOk = true ;
break ;
// se caso speciale curva a spirale
if ( bHolePocketing) {
Point3d ptStart ; pCrvPath->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ;
if ( ! AreSamePointApprox( ptStart, ptEnd)) {
Vector3d vtStart ; pCrvPath->GetStartDir( vtStart) ;
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
if ( IsNull( pArc) || ! pArc->Set2PVN( ptStart, ptEnd, - vtStart, vtTool)) {
m_pMchMgr->SetLastError( 2420, "Error in Pocketing : Return toolpath not computable") ;
return false ;
}
// inverto
pArc->Invert() ;
// definisco la curva per lo scivolo
PtrOwner<ICurveComposite> pCrvGlideTmp( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideTmp) || ! pCrvGlideTmp->AddCurve( Release( pArc)))
return false ;
// calcolo la curva in base ai parametri
double dLen = 0. ; pCrvGlideTmp->GetLength( dLen) ;
double dParS, dParE ; pCrvGlideTmp->GetDomain( dParS, dParE) ;
double dU ;
// se LeadIn a scivolo, recupero il parametro sulla curva
if ( bInVsOut) {
if ( GetLeadInType() == POCKET_LI_GLIDE) {
if ( ! pCrvGlideTmp->GetParamAtLength( dLen - m_Params.m_dLiTang, dU))
dU = 0. ;
pCrvGlide->AddCurve( pCrvGlideTmp->CopyParamRange( dU, dParE)) ;
}
else
dU = dParE ;
// calcolo la curva di ritorno
PtrOwner<ICurveComposite> pCrvRet( ConvertCurveToComposite( pCrvGlideTmp->CopyParamRange( dParS, dU))) ;
if ( ! IsNull( pCrvRet) && pCrvRet->IsValid()) {
if ( ! PathInfo.pCrvRet.Set( Release( pCrvRet)))
return false ;
}
}
// Se LeadOut a scivolo
else {
if ( GetLeadOutType() == POCKET_LO_GLIDE) {
if ( ! pCrvGlideTmp->GetParamAtLength( m_Params.m_dLoTang, dU))
dU = dParE ;
pCrvGlide->AddCurve( pCrvGlideTmp->CopyParamRange( dParS, dU)) ;
if ( ! pCrvGlide->IsValid())
return false ;
}
}
// se non trovato, non faccio nulla
if ( ! bOk)
return true ;
// altrimenti, lo memorizzo
pCrvGlideIn.Set( ConvertCurveToComposite( pCrvPath->CopyParamRange( 0, nCrv))) ;
}
// se percorso a guida non valido, non faccio nulla
if ( IsNull( pCrvGlideIn) || ! pCrvGlideIn->IsValid())
return true ;
// controllo che la lunghezza del percorso sia compatibile
double dLen = 0. ;
if ( pCrvGlideIn->GetLength( dLen) && dLen < m_Params.m_dLiTang + 10 * EPS_SMALL)
return true ;
// recupero il tratto di curva alla fine
double dU, dParS, dParE ;
if ( ! pCrvGlideIn->GetParamAtLength( dLen - m_Params.m_dLiTang, dU) ||
! pCrvGlideIn->GetDomain( dParS, dParE))
return false ;
pCrvGlide->AddCurve( pCrvGlideIn->CopyParamRange( dU, dParE)) ;
if ( ! pCrvGlide->IsValid())
return false ;
// non c'è bisogno di verificare nulla con la regione limite
return true ;
}
// Uscita a scivolo
// se regione di svuotatura generica
else {
// se l'uscita non è a scivolo, non faccio nulla
if ( GetLeadOutType() != POCKET_LO_GLIDE)
return true ;
// se l'uscita è presso un lato aperto, non faccio nulla
if ( PathInfo.bOutEnd)
return true ;
// inizializzo e recupero il percorso :
PtrOwner<ICurveComposite> pCrvGlideOut( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideOut))
return false ;
// se il tratto è chiuso
if ( pCrvPath->IsClosed())
pCrvGlideOut->CopyFrom( pCrvPath) ;
// se aperto
else {
// percorro a ritroso il percorso cercano una curva che inizi presso la fine del percorso
Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ;
int nCrv = pCrvPath->GetCurveCount() - 1 ;
bool bOk = false ;
for ( ; nCrv >= 0 ; -- nCrv) {
const ICurve* pCrv = pCrvPath->GetCurve( nCrv) ;
if ( pCrv == nullptr)
return false ;
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
if ( AreSamePointApprox( ptEnd, ptStart)) {
bOk = true ;
break ;
// Entrata a Scivolo
if ( bInVsOut) {
// se l'entrata non è a scivolo, non faccio nulla
if ( GetLeadInType() != POCKET_LI_GLIDE)
return true ;
// se l'entrata è presso un lato aperto, non faccio nulla
if ( PathInfo.bOutStart)
return true ;
// l'entrata a guida viene eseguita nel caso di percorsi SpiralIn/Out o curve di bordo chiuse
if ( ( PathInfo.bSingleCrv && ! pCrvPath->IsClosed()) ||
( PathInfo.bOptTrap && ! pCrvPath->IsClosed()) ||
( PathInfo.bIsZigZagOneWayBorder && ! pCrvPath->IsClosed()))
return true ;
// inizializzo e recupero il percorso :
PtrOwner<ICurveComposite> pCrvGlideIn( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideIn))
return false ;
// se chiuso
if ( pCrvPath->IsClosed())
pCrvGlideIn->CopyFrom( pCrvPath) ;
// se aperto
else {
// potrebbe esserci un percorso interno chiuso, lo cerco
Point3d ptStart ; pCrvPath->GetStartPoint( ptStart) ;
int nCrv = 0 ;
bool bOk = false ;
for ( ; nCrv < pCrvPath->GetCurveCount() ; ++ nCrv) {
const ICurve* pCrv = pCrvPath->GetCurve( nCrv) ;
if ( pCrv == nullptr)
return false ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
if ( AreSamePointApprox( ptStart, ptEnd)) {
++ nCrv ;
bOk = true ;
break ;
}
}
// se non trovato, non faccio nulla
if ( ! bOk)
return true ;
// altrimenti, lo memorizzo
pCrvGlideIn.Set( ConvertCurveToComposite( pCrvPath->CopyParamRange( 0, nCrv))) ;
}
// se trovata, la memorizzo
if ( bOk) {
PtrOwner<ICurveComposite> pCrvTmp( ConvertCurveToComposite( pCrvPath->CopyParamRange( nCrv, pCrvPath->GetCurveCount() - 1))) ;
if ( ! IsNull( pCrvTmp) && pCrvTmp->IsValid()) {
pCrvGlideOut.Set( Release( pCrvTmp)) ;
}
}
}
// se curva valida
if ( ! IsNull( pCrvGlideOut) && pCrvGlideOut->IsValid()) {
// controllo che la lunghezza del percorso sia compatibile
double dLen = 0. ;
if ( pCrvGlideOut->GetLength( dLen) && dLen > m_Params.m_dLoTang + 10 * EPS_SMALL) {
// recupero il tratto di curva alla fine
double dU = 0. ;
if ( ! pCrvGlideOut->GetParamAtLength( m_Params.m_dLoTang, dU))
return false ;
pCrvGlide->AddCurve( pCrvGlideOut->CopyParamRange( 0., dU)) ;
}
// se non sufficientemente lunga, la guida diventa la curva stessa
else
pCrvGlide->AddCurve( Release( pCrvGlideOut)) ;
// se percorso a guida non valido, non faccio nulla
if ( IsNull( pCrvGlideIn) || ! pCrvGlideIn->IsValid())
return true ;
// controllo che la lunghezza del percorso sia compatibile
double dLen = 0. ;
if ( pCrvGlideIn->GetLength( dLen) && dLen < m_Params.m_dLiTang + 10 * EPS_SMALL)
return true ;
// recupero il tratto di curva alla fine
double dU, dParS, dParE ;
if ( ! pCrvGlideIn->GetParamAtLength( dLen - m_Params.m_dLiTang, dU) ||
! pCrvGlideIn->GetDomain( dParS, dParE))
return false ;
pCrvGlide->AddCurve( pCrvGlideIn->CopyParamRange( dU, dParE)) ;
if ( ! pCrvGlide->IsValid())
return false ;
return false ;
}
// se curva non valida, provo con estensione lineare ( TODO : arco ?)
// Uscita a scivolo
else {
Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCrvPath->GetEndDir( vtEnd) ;
// se l'uscita non è a scivolo, non faccio nulla
if ( GetLeadOutType() != POCKET_LO_GLIDE)
return true ;
// se l'uscita è presso un lato aperto, non faccio nulla
if ( PathInfo.bOutEnd)
return true ;
// inizializzo e recupero il percorso :
PtrOwner<ICurveComposite> pCrvGlideOut( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideOut) ||
! pCrvGlideOut->AddPoint( ptEnd) ||
! pCrvGlideOut->AddLine( ptEnd + m_Params.m_dLoTang * vtEnd) ||
! pCrvGlideOut->IsValid())
return false ;
pCrvGlide->CopyFrom( pCrvGlideOut) ;
if ( ! pCrvGlide->IsValid())
if ( IsNull( pCrvGlideOut))
return false ;
// se il tratto è chiuso
if ( pCrvPath->IsClosed())
pCrvGlideOut->CopyFrom( pCrvPath) ;
// se aperto
else {
// percorro a ritroso il percorso cercano una curva che inizi presso la fine del percorso
Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ;
int nCrv = pCrvPath->GetCurveCount() - 1 ;
bool bOk = false ;
for ( ; nCrv >= 0 ; -- nCrv) {
const ICurve* pCrv = pCrvPath->GetCurve( nCrv) ;
if ( pCrv == nullptr)
return false ;
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
if ( AreSamePointApprox( ptEnd, ptStart)) {
bOk = true ;
break ;
}
}
// se trovata, la memorizzo
if ( bOk) {
PtrOwner<ICurveComposite> pCrvTmp( ConvertCurveToComposite( pCrvPath->CopyParamRange( nCrv, pCrvPath->GetCurveCount() - 1))) ;
if ( ! IsNull( pCrvTmp) && pCrvTmp->IsValid()) {
pCrvGlideOut.Set( Release( pCrvTmp)) ;
}
}
}
// se curva valida
if ( ! IsNull( pCrvGlideOut) && pCrvGlideOut->IsValid()) {
// controllo che la lunghezza del percorso sia compatibile
double dLen = 0. ;
if ( pCrvGlideOut->GetLength( dLen) && dLen > m_Params.m_dLoTang + 10 * EPS_SMALL) {
// recupero il tratto di curva alla fine
double dU = 0. ;
if ( ! pCrvGlideOut->GetParamAtLength( m_Params.m_dLoTang, dU))
return false ;
pCrvGlide->AddCurve( pCrvGlideOut->CopyParamRange( 0., dU)) ;
}
// se non sufficientemente lunga, la guida diventa la curva stessa
else
pCrvGlide->AddCurve( Release( pCrvGlideOut)) ;
if ( ! pCrvGlide->IsValid())
return false ;
}
// se curva non valida, provo con estensione lineare ( TODO : arco ?)
else {
Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCrvPath->GetEndDir( vtEnd) ;
PtrOwner<ICurveComposite> pCrvGlideOut( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideOut) ||
! pCrvGlideOut->AddPoint( ptEnd) ||
! pCrvGlideOut->AddLine( ptEnd + m_Params.m_dLoTang * vtEnd) ||
! pCrvGlideOut->IsValid())
return false ;
pCrvGlide->CopyFrom( pCrvGlideOut) ;
if ( ! pCrvGlide->IsValid())
return false ;
}
}
}
@@ -3523,9 +3577,10 @@ PocketingNT::CalcLeadInOutGlide( const PathInfoPO& PathInfo, const StepInfoPO& S
return true ;
}
//----------------------------------------------------------------------------
bool
PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo, bool& bHolePocketing)
{
/*
funzione per calcolo dei percorsi di Pockets e delle loro proprietà
@@ -3564,15 +3619,6 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
// sistemo gli archi per massimo angolo al centro
for ( int j = 0 ; j < int( vCrvPaths.size()) ; ++ j)
VerifyArcs( vCrvPaths[j]) ;
// definisco il nuovo punto di riferimento per il percorso successivo
// se l'utensile ha un raggio sotto la tolleranza, allora è il punto finale del percorso attuale
if ( m_TParams.m_dDiam / 2. < TOOL_RAD_PTSTART)
vCrvPaths.back()->GetEndPoint( ptStartRef) ;
// se l'utensile ha un raggio sopra la tolleranza, rimane fisso al punto iniziale del primo percorso
else {
if ( ! ptStartRef.IsValid())
vCrvPaths.front()->GetStartPoint( ptStartRef) ;
}
// inserisco i percorsi nel vettore dei Paths
vStepInfo[i].vPaths.resize( int( vCrvPaths.size())) ;
for ( int j = 0 ; j < int( vCrvPaths.size()) ; ++ j) {
@@ -3595,15 +3641,51 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
vStepInfo[i].vPaths[j].bOptTrap = ( vCrvPaths[j]->GetCurveCount() > 0 &&
vCrvPaths[j]->GetTempProp( 0) == TEMP_PROP_OPT_TRAPEZOID) ;
// controllo se caso ottimizzato a spirale
vStepInfo[i].vPaths[j].bOptCirle = ( vCrvPaths[j]->GetCurveCount() > 0 &&
vCrvPaths[j]->GetTempProp( 0) == TEMP_PROP_OPT_CIRCLE) ;
// controllo se è un percorso a ZigZag/OneWay ( non curva di bordo)
vStepInfo[i].vPaths[j].bIsZigZagOneWayBorder = ( vCrvPaths[j]->GetCurveCount() > 0 &&
( m_Params.m_nSubType == POCKET_SUB_ONEWAY || m_Params.m_nSubType == POCKET_SUB_ZIGZAG) &&
vCrvPaths[j]->GetTempProp( 0) == TEMP_PROP_BORDER_CURVE) ;
// se entrata a scivolo
if ( GetLeadInType() == POCKET_LI_GLIDE) {
// assegno il percorso
if ( ! vStepInfo[i].vPaths[j].pCrvPath.Set( vCrvPaths[j]))
return false ;
}
// definisco il nuovo punto di riferimento per il percorso successivo
// se caso a spirale, il punto di riferimento diventa il punto inziale
if ( int( vStepInfo[i].vPaths.size()) == 1 && vStepInfo[i].vPaths[0].bOptCirle)
vStepInfo[i].vPaths[0].pCrvPath->GetStartPoint( ptStartRef) ;
// se l'utensile ha un raggio sotto la tolleranza, allora è il punto finale del percorso attuale
else if ( m_TParams.m_dDiam / 2. < TOOL_RAD_PTSTART)
vStepInfo[i].vPaths.back().pCrvPath->GetEndPoint( ptStartRef) ;
// se l'utensile ha un raggio sopra la tolleranza, rimane fisso al punto iniziale del primo percorso
else {
if ( ! ptStartRef.IsValid())
vStepInfo[i].vPaths.front().pCrvPath->GetStartPoint( ptStartRef) ;
}
// aggiorno la progressBar
ExeProcessEvents( 50 + i * 50 / int( vStepInfo.size()), 0) ;
}
// controllo se la svuotatura è riferita ad un foro chiuso
bHolePocketing = true ;
for ( int i = 0 ; i < int( vStepInfo.size()) && bHolePocketing ; ++ i) {
bHolePocketing = ( int( vStepInfo[i].vPaths.size()) == 1 &&
vStepInfo[i].vPaths[0].bOptCirle &&
! vStepInfo[i].vPaths[0].bOutStart &&
! vStepInfo[i].vPaths[0].bOutEnd) ;
}
// calcolo di LeadIn/LeadOut a guida e curva di ritorno per svuotature di fori chiusi
for ( int i = 0 ; i < int( vStepInfo.size()) ; ++ i) {
for ( int j = 0 ; j < int( vStepInfo[i].vPaths.size()) ; ++ j) {
if ( GetLeadInType() == POCKET_LI_GLIDE || bHolePocketing) {
PtrOwner<ICurveComposite> pCrvGlideIn( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideIn) ||
! CalcLeadInOutGlide( vStepInfo[i].vPaths[j], vStepInfo[i], vCrvPaths[j], true, pCrvGlideIn)) {
! CalcLeadInOutGlide( vStepInfo[i].vPaths[j], vStepInfo[i], vStepInfo[i].vPaths[j].pCrvPath,
vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, true, pCrvGlideIn)) {
m_pMchMgr->SetLastError( 2415, "Error in PocketingNT : LeadIn not computable") ;
return false ;
}
@@ -3612,10 +3694,11 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
return false ;
}
// se uscita a scivolo
if ( GetLeadOutType() == POCKET_LO_GLIDE) {
if ( GetLeadOutType() == POCKET_LO_GLIDE || bHolePocketing) {
PtrOwner<ICurveComposite> pCrvGlideOut( CreateCurveComposite()) ;
if ( IsNull( pCrvGlideOut) ||
! CalcLeadInOutGlide( vStepInfo[i].vPaths[j], vStepInfo[i], vCrvPaths[j], false, pCrvGlideOut)) {
! CalcLeadInOutGlide( vStepInfo[i].vPaths[j], vStepInfo[i], vStepInfo[i].vPaths[j].pCrvPath,
vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, false, pCrvGlideOut)) {
m_pMchMgr->SetLastError( 2416, "Error in PocketingNT : LeadOut not computable") ;
return false ;
}
@@ -3623,12 +3706,7 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
if ( ! vStepInfo[i].vPaths[j].pCrvGlideOut.Set( Release( pCrvGlideOut)))
return false ;
}
// assegno il percorso
vStepInfo[i].vPaths[j].pCrvPath.Set( vCrvPaths[j]) ;
}
// aggiorno la progressBar
ExeProcessEvents( 50 + i * 50 / int( vStepInfo.size()), 0) ;
}
return true ;
@@ -3686,7 +3764,8 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
return true ;
// calcolo i percorsi di svuotatura per ogni Step/SubStep
if ( ! CalcPaths( vStepInfo))
bool bHolePocketing = false ;
if ( ! CalcPaths( vStepInfo, bHolePocketing))
return false ;
#if DEBUG_FEED
int nGrp = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
@@ -3847,10 +3926,16 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
PtrOwner<ICurveComposite> pCrvLink( CreateCurveComposite()) ;
if ( IsNull( pCrvLink))
return false ;
if ( ! bForceLinear) {
if ( ! CheckSafetyLink( ptEnd, vtEnd, ptDest, vtDest, currStep.pSfrLimit, vtTool,
bSmoothEnd, bSafeLimit, pCrvLink))
return false ;
if ( bHolePocketing && currPath.pCrvRet != nullptr && currPath.pCrvRet->IsValid()) {
pCrvLink->CopyFrom( currPath.pCrvRet) ;
bSafeLimit = true ;
}
else {
if ( ! bForceLinear) {
if ( ! CheckSafetyLink( ptEnd, vtEnd, ptDest, vtDest, currStep.pSfrLimit, vtTool,
bSmoothEnd, bSafeLimit, pCrvLink))
return false ;
}
}
// determino l'elevazione sul punto corrente e sul punto di destinazione
dCurrElev = 0. ;
@@ -5122,7 +5207,7 @@ PocketingNT::VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptS
//----------------------------------------------------------------------------
bool
PocketingNT::VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, const ICurveComposite* pCrvGlide)
PocketingNT::VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide)
{
// controllo validità dei parametri
if ( pSfr == nullptr || ! pSfr->IsValid())
@@ -5133,8 +5218,17 @@ PocketingNT::VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, const ICurveComp
return false ;
// controllo se la curva interseca la regione
CRVCVECTOR ccClass ;
return ( pSfrOffs->GetCurveClassification( *pCrvGlide, EPS_SMALL, ccClass) &&
int( ccClass.size()) == 1 && ccClass[0].nClass == CRVC_IN) ;
if ( ! pSfrOffs->GetCurveClassification( *pCrvGlide, EPS_SMALL, ccClass))
return false ;
if ( int( ccClass.size()) == 1 && ccClass[0].nClass == CRVC_IN)
return true ;
// recupero il primo tratto In e Limito la curva a tale tratto
if ( ccClass[0].nClass != CRVC_IN)
return false ;
PtrOwner<ICurve> pCrvGlideInside( pCrvGlide->CopyParamRange( ccClass[0].dParS, ccClass[0].dParE)) ;
if ( IsNull( pCrvGlideInside) || ! pCrvGlideInside->IsValid())
return false ;
return ( pCrvGlide->Clear() && pCrvGlide->AddCurve( Release( pCrvGlideInside))) ;
}
//----------------------------------------------------------------------------
+7 -4
View File
@@ -28,10 +28,12 @@ struct PathInfoPO {
bool bOutEnd ; // flag per uscita da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
} ;
// tipo percorso
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
@@ -112,6 +114,7 @@ class PocketingNT : public Machining
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) ;
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
bool ManageLeadInLeadOutGlideCrvs( STEPINFOPOVECTOR& vStepInfo) ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
@@ -124,9 +127,9 @@ class PocketingNT : public Machining
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
bool CalcLeadInOutGlide( const PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
bool bInVsOut, ICurveComposite* pCrvGlide) ;
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo, bool& bHolePocketing) ;
bool CalcLeadInOutGlide( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
@@ -163,7 +166,7 @@ class PocketingNT : public Machining
bool bSmoothEnd, bool& bSafeLimit, ICurveComposite* pCrvSafeLink) ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, const ICurveComposite* pCrvGlide) ;
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
// debug
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_NULL) ;