From 17b01c849527ceb476100f3ca64263ba2130fffa Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 30 Oct 2019 07:16:19 +0000 Subject: [PATCH] EgtMachKernel : - quando si copia un utensile lo si disattiva - in lavorazione WJ i contorni chiusi interni hanno attacco/uscita sul lato abbastanza lungo a Xmin (per corse asse rotante C se inclinati) - migliorata interpretazione hint per angoli iniziali. --- Operation.cpp | 7 ++++--- ToolsMgr.cpp | 4 +++- WaterJetting.cpp | 42 ++++++++++++++++++++++++++---------------- WaterJetting.h | 2 ++ 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Operation.cpp b/Operation.cpp index 9468bdd..eb92d59 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1094,14 +1094,15 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) // se ci sono suggerimenti validi per gli assi rotanti, li applico if ( ! sHint.empty()) { STRVECTOR vsTok ; - Tokenize( sHint, ",", vsTok) ; + Tokenize( sHint, ",;", vsTok) ; for (const auto& sTok : vsTok) { string szKey, szVal ; Split( sTok, "=", true, szKey, szVal) ; + Trim( szKey) ; for ( int i = 0 ; i < nRotAxes ; ++ i) { string sAxToken ; - if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken(nLinAxes + i, sAxToken) && - szKey == sAxToken) { + if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) && + szKey == Trim( sAxToken)) { double dVal ; if ( FromString( szVal, dVal)) vAxRotPrec[i] = dVal ; diff --git a/ToolsMgr.cpp b/ToolsMgr.cpp index 22d490c..1a8ea54 100644 --- a/ToolsMgr.cpp +++ b/ToolsMgr.cpp @@ -390,7 +390,9 @@ ToolsMgr::CopyTool( const string& sSource, const string& sName) ToolData tData = *pTdata ; // modifico nome e UUID tData.m_sName = sName ; - CreateEgtUUID( tData.m_Uuid) ; + CreateEgtUUID( tData.m_Uuid) ; + // lo disattivo + tData.SetParam( TPA_ACTIVE, false) ; // salvo i dati del nuovo utensile if ( ! m_utData.emplace( tData.m_Uuid, tData).second || ! m_suData.emplace( tData.m_sName, tData.m_Uuid).second) diff --git a/WaterJetting.cpp b/WaterJetting.cpp index 5c3f56d..4c7957f 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -1345,27 +1345,35 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId) return false ; } - // se percorso chiuso con lavorazione all'interno, porto la partenza a metą del lato pił lungo + // se percorso chiuso con lavorazione all'interno, porto la partenza a metą del lato abbastanza lungo a Xmin if ( pCompo->IsClosed()) { double dArea ; if ( pCompo->GetAreaXY( dArea) && ( ( dArea < 0 && m_Params.m_nWorkSide == WJET_WS_RIGHT) || ( dArea > 0 && m_Params.m_nWorkSide == WJET_WS_LEFT))) { + const double DIST_SIC_WJ_LIO = 2 ; + double dMinLen = m_Params.m_dOverlap + 2 * DIST_SIC_WJ_LIO ; + if ( m_Params.m_nLeadInType != WJET_LI_NONE) + dMinLen += m_Params.m_dLiTang ; + if ( m_Params.m_nLeadOutType != WJET_LO_NONE) + dMinLen += ( m_Params.m_nLeadOutType == WJET_LO_AS_LI ? m_Params.m_dLiTang : m_Params.m_dLoTang) ; int i = 0 ; - int nMax = - 1 ; - double dLenMax = 0 ; + int nMin = - 1 ; + double dXmin = INFINITO ; const ICurve* pCrv = pCompo->GetFirstCurve() ; while ( pCrv != nullptr) { double dLen ; - if ( pCrv->GetLength( dLen) && dLen > dLenMax) { - dLenMax = dLen ; - nMax = i ; + Point3d ptMid ; + if ( pCrv->GetLength( dLen) && dLen > dMinLen && + pCrv->GetMidPoint( ptMid) && ptMid.x < dXmin) { + dXmin = ptMid.x ; + nMin = i ; } ++ i ; pCrv = pCompo->GetNextCurve() ; } - if ( nMax >= 0) - pCompo->ChangeStartPoint( nMax + 0.5) ; + if ( nMin >= 0) + pCompo->ChangeStartPoint( nMin + 0.5) ; } } @@ -1901,6 +1909,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo } // aggiungo attacco SetFeed( GetFeed()) ; + SetFlag( 0) ; SetIndex( 0 - nIdxSkip) ; if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, bSplitArcs)) { m_pMchMgr->SetLastError( 3208, "Error in WaterJetting : LeadIn not computable") ; @@ -1952,8 +1961,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo double dLen ; pCrvC->GetLength( dLen) ; // lunghezza di accelerazione double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ; - // Feed minima - double dMinFeed = m_Params.m_nCornerSlowPerc / 100. * GetFeed() ; + // Feed ridotta + double dMinFeed = GetReducedFeed() ; // ciclo sui punti di accelerazione for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; @@ -1971,8 +1980,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo double dLen ; pCrvC->GetLength( dLen) ; // lunghezza di accelerazione double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ; - // Feed minima - double dMinFeed = m_Params.m_nCornerSlowPerc / 100. * GetFeed() ; + // Feed ridotta + double dMinFeed = GetReducedFeed() ; // Direzioni utensile nell'angolo e finale Vector3d vtTp = CalcToolDir( pCompo, i) ; Vector3d vtTn = CalcToolDir( pCompo, i + 0.5) ; @@ -2013,8 +2022,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo double dLen ; pCrvC->GetLength( dLen) ; // lunghezza di accelerazione double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ; - // Feed minima - double dMinFeed = m_Params.m_nCornerSlowPerc / 100. * GetFeed() ; + // Feed ridotta + double dMinFeed = GetReducedFeed() ; // ciclo sui punti di decelerazione for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; @@ -2033,8 +2042,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo double dLen ; pCrvC->GetLength( dLen) ; // lunghezza di accelerazione double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ; - // Feed minima - double dMinFeed = m_Params.m_nCornerSlowPerc / 100. * GetFeed() ; + // Feed ridotta + double dMinFeed = GetReducedFeed() ; // Direzioni utensile iniziale e nell'angolo Vector3d vtTp = CalcToolDir( pCompo, i + 0.5) ; Vector3d vtTn = CalcToolDir( pCompo, i + 1) ; @@ -2101,6 +2110,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo return false ; } // aggiungo retrazione + SetFlag( 203) ; if ( ! AddRetract( ptP1, vtTool, dSafeZ)) { m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ; return false ; diff --git a/WaterJetting.h b/WaterJetting.h index 3ec67c8..74896d5 100644 --- a/WaterJetting.h +++ b/WaterJetting.h @@ -106,6 +106,8 @@ class WaterJetting : public Machining { return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; } double GetFeed() const { return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; } + double GetReducedFeed() const + { return ( 100. - m_Params.m_nCornerSlowPerc) / 100. * GetFeed() ; } double GetTipFeed() const { return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; } double GetOffsR() const