From f62660c67ffa560e237c05789669bd9c3f8e7104 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 11 Oct 2016 06:50:46 +0000 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=20:=20-=20in=20generazione=20e=20?= =?UTF-8?q?simulazione=20recupero=20nome=20utensile=20della=20lavorazione?= =?UTF-8?q?=20tramite=20TUUID=20-=20in=20fresatura=20corretto=20calcolo=20?= =?UTF-8?q?espressione=20affondamento=20-=20nella=20scelta=20angoli=20iniz?= =?UTF-8?q?iali=20continuit=C3=A0=20anche=20tra=20diverse=20uscite=20di=20?= =?UTF-8?q?medesima=20testa=20-=20migliorata=20segnalazione=20errori=20in?= =?UTF-8?q?=20calcolo=20assi=20macchina=20-=20in=20verifica=20collisione?= =?UTF-8?q?=20si=20risale=20su=20testa=20con=20info=20ZMAXONROT=3D1=20e=20?= =?UTF-8?q?rotazione.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Generator.cpp | 5 +++-- Milling.cpp | 23 ++++++++++++++--------- Operation.cpp | 19 ++++++++++++------- Simulator.cpp | 5 +++-- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Generator.cpp b/Generator.cpp index 514dfbd..4e93a2e 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -259,8 +259,9 @@ Generator::ProcessMachining( int nOpId, int nOpInd) return true ; // Recupero l'utensile della lavorazione corrente - string sTool ; - if ( ! m_pMchMgr->GetMachiningParam( MPA_TOOL, sTool)) + string sTuuid, sTool ; + if ( ! m_pMchMgr->GetMachiningParam( MPA_TUUID, sTuuid) || + ! m_pMchMgr->TdbGetToolFromUUID( sTuuid, sTool)) return false ; // Se utensile cambierà diff --git a/Milling.cpp b/Milling.cpp index 7608030..927b27b 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1008,13 +1008,16 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) } // valuto l'espressione dell'affondamento - ExeLuaSetGlobNumVar( "TH", ( dThick >= 0 ? 0 : -dThick)) ; + ExeLuaSetGlobNumVar( "TH", abs( dThick)) ; ExeLuaSetGlobNumVar( "RB", dRbDist) ; double dDepth ; if ( ! ExeLuaEvalNumExpr( m_Params.m_sDepth, &dDepth)) { LOG_INFO( GetEMkLogger(), "Error in Milling : Depth not computable") ; return false ; } + // se spessore positivo, lo sottraggo dal risultato + if ( dThick > 0) + dDepth -= dThick ; // sottraggo eventuale offset longitudinale dDepth -= GetOffsL() ; @@ -1070,14 +1073,16 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) else return false ; - // verifico di non superare il massimo materiale - const double MAXMAT_TOL = EPS_SMALL ; - if ( ( m_Params.m_dStep < EPS_SMALL && dElev > m_TParams.m_dMaxMat + MAXMAT_TOL) || - ( m_Params.m_dStep > EPS_SMALL && m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL)) { - string sInfo = "Error in Milling : machining depth (" + ToString( dElev, 1) + - ") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ; - LOG_INFO( GetEMkLogger(), sInfo.c_str()) ; - return false ; + // per frese normali, verifico di non superare il massimo materiale + if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { + const double MAXMAT_TOL = EPS_SMALL ; + if ( ( m_Params.m_dStep < EPS_SMALL && dElev > m_TParams.m_dMaxMat + MAXMAT_TOL) || + ( m_Params.m_dStep > EPS_SMALL && m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL)) { + string sInfo = "Error in Milling : machining depth (" + ToString( dElev, 1) + + ") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ; + LOG_INFO( GetEMkLogger(), sInfo.c_str()) ; + return false ; + } } // se richiesta anteprima diff --git a/Operation.cpp b/Operation.cpp index fd88239..74b424c 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -507,7 +507,9 @@ Operation::CalculateAxesValues( const string& sHint) DBLVECTOR vAxRotPrec( nRotAxes, 0.) ; DBLVECTOR vAxVal ; // se utensile non cambiato, uso gli angoli finali della lavorazione precedente - if ( ! sPrevTool.empty() && GetToolName() == sPrevTool && + // ! ToolChangeNeeded( *pPrevOp, *this) + // GetToolName() == sPrevTool + if ( ! sPrevTool.empty() && ! ToolChangeNeeded( *pPrevOp, *this) && pPrevOp->GetFinalAxesValues( vAxVal)) { for ( int i = 0 ; i < nRotAxes ; ++ i) vAxRotPrec[i] = vAxVal[nLinAxes + i] ; @@ -610,9 +612,9 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, DBLVECTOR vAng1, vAng2 ; bool bROk = m_pMchMgr->GetCalcAngles( pCamData->GetToolDir(), pCamData->GetAuxDir(), nRStat, vAng1, vAng2) ; if ( ! bROk || nRStat == 0) { - bOk = false ; pCamData->SetAxes( CamData::AS_DIR_ERR, vAxVal) ; - continue ; + LOG_INFO( GetEMkLogger(), "Error : tool direction unreachable") + return false ; } if ( abs( nRStat) == 1) { // se primo movimento @@ -781,6 +783,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, PtrOwner pArc( CreateCurveArc()) ; if ( IsNull( pArc) || ! pArc->Set3P( ptP1M, ptP2M, ptP3M, false)) { bOk = false ; + LOG_INFO( GetEMkLogger(), "Error : arc on machine not calculable") continue ; } // verifico il piano @@ -1332,10 +1335,12 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn int nHeadId = pMch->GetCurrHead() ; int nVal = 0 ; if ( m_pGeomDB->GetInfo( nHeadId, "ZMAXONROT", nVal) && nVal != 0) { - if ( vAxName.size() > 3 && abs( vAxEnd[3] - vAxStart[3]) > 100 * EPS_ANG_SMALL) - return false ; - if ( vAxName.size() > 4 && abs( vAxEnd[4] - vAxStart[4]) > 100 * EPS_ANG_SMALL) - return false ; + int nLinAxes = m_pMchMgr->GetCurrLinAxes() ; + int nRotAxes = m_pMchMgr->GetCurrRotAxes() ; + for ( int i = nLinAxes ; i < nLinAxes + nRotAxes ; ++ i) { + if ( int( vAxName.size()) > i && abs( vAxEnd[i] - vAxStart[i]) > 100 * EPS_ANG_SMALL) + return false ; + } } // Porto la macchina in home pMch->ResetAllAxesPos() ; diff --git a/Simulator.cpp b/Simulator.cpp index e8c1851..7d44046 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -495,8 +495,9 @@ Simulator::UpdateTool( bool bForced) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) ; if ( pMch != nullptr) { // recupero nome e dati nuovo utensile - string sTool ; - if ( ! pMch->GetParam( MPA_TOOL, sTool)) + string sTuuid, sTool ; + if ( ! pMch->GetParam( MPA_TUUID, sTuuid) || + ! m_pMchMgr->TdbGetToolFromUUID( sTuuid, sTool)) return false ; if ( ! m_pMchMgr->TdbSetCurrTool( sTool)) return false ;