Merge commit '77bd37f9f7b28be9ad29558503b1a4a00b945f29'

This commit is contained in:
Dario Sassi
2025-05-05 12:26:35 +02:00
2 changed files with 37 additions and 15 deletions
+35 -15
View File
@@ -106,7 +106,7 @@ const string UN_OPENEXTENSION = "OpenExtension" ;
// _debug
#define DEBUG_OPEN_EDGE_EXTENSION 0
#define DEBUG_FLATREGIONS 0
#if DEBUG_OPEN_EDGE_EXTENSION || DEBUG_FLATREGIONS
#if DEBUG_OPEN_EDGE_EXTENSION || DEBUG_FLATREGIONS
#include "EgtDev/Include/EGkGeoPoint3d.h"
#include "EgtDev/Include/EGkFrame3d.h"
#endif
@@ -278,6 +278,7 @@ PocketingNT::PocketingNT( void)
m_bAggrBottom = false ;
m_bOpenOutRaw = false ;
m_dOpenMinSafe = 0 ;
m_bRunning = false ;
}
//----------------------------------------------------------------------------
@@ -600,7 +601,7 @@ PocketingNT::Preview( bool bRecalc)
m_pGeomDB->GetInfo( nToolId, TTH_DIAM, m_dTHoldDiam) ;
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2421, "Error in PocketingNT : Chaining failed") ;
return false ;
}
@@ -632,6 +633,21 @@ PocketingNT::Preview( bool bRecalc)
//----------------------------------------------------------------------------
bool
PocketingNT::Apply( bool bRecalc, bool bPostApply)
{
// se calcoli già in corso, esco
if ( m_bRunning) {
LOG_DBG_INFO( GetEMkLogger(), "PocketingNT::Apply already running") ;
return true ;
}
m_bRunning = true ;
bool bOk = MyApply( bRecalc, bPostApply) ;
m_bRunning = false ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
PocketingNT::MyApply( bool bRecalc, bool bPostApply)
{
// reset numero percorsi di svuotatura generati
int nCurrPockets = m_nPockets ;
@@ -1212,7 +1228,7 @@ PocketingNT::GetCurves( SelData Id, ICURVEPLIST& lstPC)
}
// se altrimenti superficie
else if ( pGObj->GetType() == SRF_TRIMESH) {
// recupero la trimesh
// recupero la trimesh
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
return false ;
@@ -1383,7 +1399,6 @@ PocketingNT::SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr)
for ( int& i : vOpen)
pSfr->SetCurveTempProp( 0, nCount, i, TEMP_PROP_OPEN_EDGE, 0) ;
} ;
return true ;
}
@@ -1397,7 +1412,7 @@ PocketingNT::ResetCurveAllTempProp( ICurve* pCurve)
ICurveComposite* pCC = GetCurveComposite( pCurve) ;
if ( pCC != nullptr) {
for ( int i = 0 ; i < pCC->GetCurveCount() ; ++ i)
pCC->SetCurveTempProp( i, 0) ;
pCC->SetCurveTempProp( i, TEMP_PROP_CLOSE_EDGE) ;
}
return true ;
}
@@ -1491,7 +1506,7 @@ PocketingNT::Chain( int nGrpDestId)
if ( pCrvCompo->GetCurveCount() == 0)
continue ;
// se la curva non è chiusa, errore
if ( ! pCrvCompo->IsClosed()) {
if ( ! pCrvCompo->IsClosed()) {
m_pMchMgr->SetLastError( 2402, "Error in PocketingNT : Open Contour") ;
return false ;
}
@@ -1888,7 +1903,7 @@ PocketingNT::ExtendOpenEdgesToRaw( ICurveComposite* pCompo, const Vector3d& vtEx
m_pGeomDB->SetMaterial( a, Color( 0.2, 0.2, 0.8, .65)) ;
#endif
// recupero il Box del grezzo definito dal frame implito dal piano
// recupero il Box del grezzo definito dal frame implicito dal piano
Frame3d frCut ;
if ( ! frCut.Set( ptC, vtExtr))
return false ;
@@ -2791,8 +2806,8 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
if ( vCrvPaths.empty())
continue ;
// sistemo gli archi per massimo angolo al centro
for ( int i = 0 ; i < int( vCrvPaths.size()) ; ++ i)
VerifyArcs( vCrvPaths[i]) ;
for ( int j = 0 ; j < int( vCrvPaths.size()) ; ++ j)
VerifyArcs( vCrvPaths[j]) ;
// recupero il punto finale del percorso per lo step successivo
vCrvPaths.back()->GetEndPoint( ptEndLastPath) ;
// inserisco i percorsi nel vettore dei Paths
@@ -2939,14 +2954,16 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
else if ( ! currPath.bOutStart)
ptP1 += vtTool * ( - currStep.dRelativeDepth + dMyLIO_ELEV_TOL) ;
}
// approccio al punto iniziale
// approccio al punto iniziale ( se punti non allineati lungo vtTool)
double dMySafeZ = ( bAbsFirst ? dSafeZ : 0.) ;
Point3d ptMyPos ; GetCurrPos( ptMyPos) ;
double dMyElev = ( bAbsFirst ? dCurrElev : ( ptMyPos - ptP1) * vtTool) ;
double dMyAppr = ( bAbsFirst ? dAppr : 0.) ;
if ( ! AddApproach( ptP1, vtTool, dMySafeZ, dSafeAggrBottZ, dMyElev, dMyAppr, bSplitArcs, currPath.bOutStart)) {
m_pMchMgr->SetLastError( 3011, "Error in PocketingNT : Approach not computable") ;
return false ;
if ( bAbsFirst || ! OrthoCompo( ptMyPos - ptP1, vtTool).IsSmall()) {
if ( ! AddApproach( ptP1, vtTool, dMySafeZ, dSafeAggrBottZ, dMyElev, dMyAppr, bSplitArcs, currPath.bOutStart)) {
m_pMchMgr->SetLastError( 3011, "Error in PocketingNT : Approach not computable") ;
return false ;
}
}
// aggiungo attacco
SetFeed( GetStartFeed()) ;
@@ -3049,9 +3066,12 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
}
// tratto lineare sopra al punto corrente
SetFeed( GetEndFeed()) ;
AddLinearMove( ptEnd + vtTool * dCurrElev, bSplitArcs) ;
Point3d ptCheck ;
if ( GetCurrPos( ptCheck) && ! AreSamePointApprox( ptCheck, ptEnd + vtTool * dCurrElev))
AddLinearMove( ptEnd + vtTool * dCurrElev, bSplitArcs) ;
// tratto lineare sopra a ptDest
AddLinearMove( ptDest + vtTool * dNextElev, bSplitArcs) ;
if ( GetCurrPos( ptCheck) && ! AreSamePointApprox( ptCheck, ptDest + vtTool * dNextElev))
AddLinearMove( ptDest + vtTool * dNextElev, bSplitArcs) ;
// aggiorno le elevazioni
dCurrElev = dNextElev ;
}
+2
View File
@@ -93,6 +93,7 @@ class PocketingNT : public Machining
PocketingNT( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
@@ -200,4 +201,5 @@ class PocketingNT : public Machining
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
double m_dOpenExtension ; // estensione dei tratti aperti dentro al grezzo
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
bool m_bRunning ; // flag di calcoli in corso
} ;