diff --git a/PocketingNT.cpp b/PocketingNT.cpp index 645f949..6d3badd 100644 --- a/PocketingNT.cpp +++ b/PocketingNT.cpp @@ -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 @@ -280,6 +280,7 @@ PocketingNT::PocketingNT( void) m_bAggrBottom = false ; m_bOpenOutRaw = false ; m_dOpenMinSafe = 0 ; + m_bRunning = false ; } //---------------------------------------------------------------------------- @@ -602,7 +603,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 ; } @@ -634,6 +635,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 ; @@ -1214,7 +1230,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 ; @@ -1385,7 +1401,6 @@ PocketingNT::SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) for ( int& i : vOpen) pSfr->SetCurveTempProp( 0, nCount, i, TEMP_PROP_OPEN_EDGE, 0) ; } ; - return true ; } @@ -1399,7 +1414,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 ; } @@ -1493,7 +1508,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 ; } @@ -1890,7 +1905,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 ; diff --git a/PocketingNT.h b/PocketingNT.h index a9464d3..3649fd7 100644 --- a/PocketingNT.h +++ b/PocketingNT.h @@ -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 } ; \ No newline at end of file