diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 4f67fb5..22cc518 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp index e3b74c7..9949d03 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -651,6 +651,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC pTdata->GetParam( TPA_TIPFEED, dTipFeed) ; string sUserNotes ; pTdata->GetParam( TPA_USERNOTES, sUserNotes) ; + string sSysNotes ; + pTdata->GetParam( TPA_SYSNOTES, sSysNotes) ; // Recupero la path dell'eventuale portautensile string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ; // Carico generatore disegno utensile @@ -668,6 +670,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ; bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ; + bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.SYSNOTES", sSysNotes) ; switch ( nType) { case TT_DRILL_STD : case TT_DRILL_LONG : diff --git a/SurfRoughing.cpp b/SurfRoughing.cpp index c110fbc..43f81c1 100644 --- a/SurfRoughing.cpp +++ b/SurfRoughing.cpp @@ -1389,8 +1389,9 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) // assegno il versore fresa Vector3d vtTool = vtExtr ; - // calcolo l'elevazione al di sopra di tale regione + // calcolo l'elevazione al di sopra di tale regione e l'affondamento al di sotto double dSfrMaxElev = 0. ; + double dSfrMaxDepth = 0. ; for ( int nC = 0 ; nC < pSfrSgro->GetChunkCount() ; ++ nC) { for ( int nL = 0 ; nL < pSfrSgro->GetLoopCount( nC) ; ++ nL) { // recupero la curva @@ -1406,8 +1407,17 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) m_pMchMgr->SetLastError( 3033, "Error in SurfRoughing : Calc Region elevation failed") ; return false ; } - // l'elevazione finale รจ la massima trovata + // aggiorno l'elevazione massima dSfrMaxElev = max( dSfrElev, dSfrMaxElev) ; + // determino l'affondamento + pCrvLoop->Invert() ; + double dSfrDepth = 0. ; + if ( ! CalcRegionElevation( pCrvLoop, vtTool, 0., 0.5 * m_TParams.m_dDiam, m_TParams.m_dLen, dSfrDepth)) { + m_pMchMgr->SetLastError( 3033, "Error in SurfRoughing : Calc Region elevation failed") ; + return false ; + } + // aggiorno l'affondamento massimo + dSfrMaxDepth = max( dSfrDepth, dSfrMaxDepth) ; } } // se la regione interseca il grezzo @@ -1420,7 +1430,11 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) pSfrSgro->Translate( dSfrMaxElev * vtTool) ; // la Depth viene incrementata del valore di traslazione dDepth += dSfrMaxElev ; + dSfrMaxDepth += dSfrMaxElev ; } + // aggiustiamo l'affondamento se eccesivo + const double MAX_DEPTH_EXTRA = 3 ; + dDepth = min( dDepth, dSfrMaxDepth + MAX_DEPTH_EXTRA) ; // controllo se richiesto PlaneZDetection bool bPlaneZDetection = false ; @@ -1606,6 +1620,14 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) // aggiorno step per progressBar ++ nProgressBarStep ; + // affondamento per calcolo regioni (limito poco sotto il grezzo) + double dSfrDepth = it->dDepth ; + double dSfrDeltaDepth = 0 ; + if ( dSfrDepth < -dSfrMaxDepth) { + dSfrDeltaDepth = dSfrDepth + dSfrMaxDepth ; + dSfrDepth = -dSfrMaxDepth ; + } + /* ******************** Regione estesa di lavoro ******************** */ // regione di lavoro allo step corrente ( definita dalla curva di lavoro ) PtrOwner pSfr( CloneSurfFlatRegion( pSfrSgro)) ; @@ -1613,12 +1635,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ; return false ; } - pSfr->Translate( ( it->dDepth + GetOffsL()) * vtTool) ; + pSfr->Translate( ( dSfrDepth + GetOffsL()) * vtTool) ; /* ******************** Regione adattata al grezzo ******************** */ // questa regione bisogna ridurla basandosi sulla geometria del grezzo, in modo da non lavorare // parti in eccesso ; taglio il grezzo sul piano corrente e interseco con questa regione - PtrOwner pSfrRaw( GetSfrByStmIntersection( IPPStm, it->dDepth + GetOffsL(), 0)) ; + PtrOwner pSfrRaw( GetSfrByStmIntersection( IPPStm, dSfrDepth + GetOffsL(), 0)) ; if ( IsNull( pSfrRaw)) { m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ; return false ; @@ -1638,7 +1660,7 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) if ( IsNull( pSfrOutCompo)) return false ; if ( pStmLimit->IsValid() && pStmLimit->GetTriangleCount() > 0) { - pSfrOutCompo.Set( GetSfrByStmIntersection( IPPStm1, it->dDepth + GetOffsL(), 0)) ; + pSfrOutCompo.Set( GetSfrByStmIntersection( IPPStm1, dSfrDepth + GetOffsL(), 0)) ; if ( IsNull( pSfrRaw)) { m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ; return false ; @@ -1647,7 +1669,7 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) /* *************************** Silhouette **************************** */ // determino la regione da non lavorare e la sottraggo - double dSilDepth = it->dDepth - ( it->bPlaneZStep ? SIL_DEPTH_TOL : 0.) ; + double dSilDepth = dSfrDepth - ( it->bPlaneZStep ? SIL_DEPTH_TOL : 0.) ; bool bOkSil = false ; PtrOwner pSfrSil_Hypothetical( CreateSurfFlatRegion()) ; if ( IsNull( pSfrSil_Hypothetical)) @@ -1834,6 +1856,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId) DrawLoopsSurf( pSfr, false, Color( .0, 1., 0., .5), it->bSubStep, ToString( it->dDepth)) ; #endif + // eventuale traslazione per ultima passata appena sotto il grezzo + if ( dSfrDeltaDepth < -EPS_SMALL) + pSfr->Translate( dSfrDeltaDepth * vtTool) ; + // la salvo nel gruppo temporaneo int nNew_SfrPock_Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nTempId, Release( pSfr)) ; if ( nNew_SfrPock_Id == GDB_ID_NULL) {