From a79d9c9fe8f9530ced284feec66b176496dd830d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 26 Feb 2024 18:06:22 +0100 Subject: [PATCH 1/3] EgtMachKernel : - piccola correzione a fresature con attacco/uscita a scivolo. --- Milling.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Milling.cpp b/Milling.cpp index 072cc7e..e5108e1 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -4524,6 +4524,8 @@ Milling::GetLeadInType( void) const if ( abs( m_Params.m_dLiTang) < min( 0.1 * m_TParams.m_dDiam, 0.1) && abs( m_Params.m_dLiPerp) < min( 0.1 * m_TParams.m_dDiam, 0.1)) return MILL_LI_NONE ; + if ( m_Params.m_nLeadInType == MILL_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL) + return MILL_LI_NONE ; if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) && ( m_Params.m_dLiTang < min( 0.1 * m_TParams.m_dDiam, 1.0) || m_Params.m_dLiElev < 10 * EPS_SMALL)) return MILL_LI_NONE ; @@ -4900,6 +4902,8 @@ Milling::GetLeadOutType( void) const abs( m_Params.m_dLoPerp) < min( 0.1 * m_TParams.m_dDiam, 0.1) && m_Params.m_nLeadOutType != MILL_LO_AS_LI) return MILL_LO_NONE ; + if ( m_Params.m_nLeadOutType == MILL_LO_GLIDE && m_Params.m_dLoElev < 10 * EPS_SMALL) + return MILL_LO_NONE ; return m_Params.m_nLeadOutType ; } From c3729befbbaccf4e4bb32ae72207ac1de124e66d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 27 Feb 2024 10:36:52 +0100 Subject: [PATCH 2/3] EgtMachKernel : - modifiche e correzioni per flag di fine passata (301) in fresatura con lama a ZigZag e OneWay. --- Milling.cpp | 11 ++++++++--- Operation.cpp | 2 +- Operation.h | 15 +++------------ OperationCL.cpp | 36 ++++++++++++++++++++++-------------- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Milling.cpp b/Milling.cpp index e5108e1..a1e0176 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -4019,12 +4019,14 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT // aggiungo uscita Point3d ptP1 ; Vector3d vtDir1 ; - SetFlag( 301, false) ; SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pMyCompo, bSplitArcs, ptP1, vtDir1)) { m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ; return false ; } + // imposto flag fine passata sull'ultima entitā emessa + if ( ! SetFlagOnLastMove( 301)) + return false ; // per lame retrazione non č necessaria } } @@ -4212,12 +4214,15 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT Point3d ptP1 ; Vector3d vtDir1 ; SetFeed( GetEndFeed()) ; - if ( ! bReturn) - SetFlag( 301, false) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bReturn, pMyCompo, bSplitArcs, ptP1, vtDir1)) { m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ; return false ; } + // se non č return, imposto flag fine passata sull'ultima entitā emessa + if ( ! bReturn) { + if ( ! SetFlagOnLastMove( 301)) + return false ; + } // per lame retrazione non č necessaria } } diff --git a/Operation.cpp b/Operation.cpp index ee880ef..ec25565 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -134,7 +134,7 @@ Operation::Init( MachMgr* pMchMgr) Operation::Operation( void) : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_pMchMgr( nullptr), m_nPhase( 1), m_nPathId( GDB_ID_NULL), m_bCurr( false), m_ptCurr(), m_vtTool(), m_vtCorr(), m_vtAux(), - m_dFeed( 0), m_nFlag( 0), m_bFlagModal( true), m_nFlag2( 0), m_bFlag2Modal( true), m_nIndex( 0) + m_dFeed( 0), m_nFlag( 0), m_nFlag2( 0), m_nIndex( 0) { } diff --git a/Operation.h b/Operation.h index 3c8a940..6d4ce72 100644 --- a/Operation.h +++ b/Operation.h @@ -182,8 +182,9 @@ class Operation : public IUserObj bool SetAuxDir( const Vector3d& vtDir) ; bool SetCorrAuxDir( const Vector3d& vtDir) ; bool SetFeed( double dFeed) ; - bool SetFlag( int nFlag, bool bModal = true) ; - bool SetFlag2( int nFlag2, bool bModal = true) ; + bool SetFlag( int nFlag) ; + bool SetFlagOnLastMove( int nFlag) ; + bool SetFlag2( int nFlag2) ; bool SetIndex( int nIndex) ; bool GetCurrPos( Point3d& ptCurr) const { if ( ! m_bCurr) return false ; ptCurr = m_ptCurr ; return true ; } @@ -214,18 +215,8 @@ class Operation : public IUserObj Vector3d m_vtAux ; // direzione ausiliaria corrente double m_dFeed ; // feed corrente int m_nFlag ; // flag corrente - bool m_bFlagModal ; // valore persistente del flag int m_nFlag2 ; // secondo flag corrente - bool m_bFlag2Modal ; // valore persistente del flag2 int m_nIndex ; // indice corrente - - private : - int UseFlag( void) - { if ( m_bFlagModal) return m_nFlag ; - int nTemp = m_nFlag ; m_nFlag = 0 ; m_bFlagModal = true ; return nTemp ; } - int UseFlag2( void) - { if ( m_bFlag2Modal) return m_nFlag2 ; - int nTemp = m_nFlag2 ; m_nFlag2 = 0 ; m_bFlag2Modal = true ; return nTemp ; } } ; //---------------------------------------------------------------------------- diff --git a/OperationCL.cpp b/OperationCL.cpp index d56f78b..f1fa3a3 100644 --- a/OperationCL.cpp +++ b/OperationCL.cpp @@ -76,19 +76,29 @@ Operation::SetFeed( double dFeed) //---------------------------------------------------------------------------- bool -Operation::SetFlag( int nFlag, bool bModal) +Operation::SetFlag( int nFlag) { m_nFlag = nFlag ; - m_bFlagModal = bModal ; return true ; } //---------------------------------------------------------------------------- bool -Operation::SetFlag2( int nFlag2, bool bModal) +Operation::SetFlagOnLastMove( int nFlag) +{ + int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ; + CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ; + if ( pCamData == nullptr) + return false ; + pCamData->SetFlag( nFlag) ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +Operation::SetFlag2( int nFlag2) { m_nFlag2 = nFlag2 ; - m_bFlag2Modal = bModal ; return true ; } @@ -130,8 +140,8 @@ Operation::AddRapidStart( const Point3d& ptP) pCam->SetAuxDir( m_vtAux) ; pCam->SetEndPoint( ptP) ; pCam->SetFeed( 0) ; - pCam->SetFlag( UseFlag()) ; - pCam->SetFlag2( UseFlag2()) ; + pCam->SetFlag( m_nFlag) ; + pCam->SetFlag2( m_nFlag2) ; pCam->SetIndex( m_nIndex) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; @@ -182,8 +192,8 @@ Operation::AddRapidMove( const Point3d& ptP) pCam->SetAuxDir( m_vtAux) ; pCam->SetEndPoint( ptP) ; pCam->SetFeed( 0) ; - pCam->SetFlag( UseFlag()) ; - pCam->SetFlag2( UseFlag2()) ; + pCam->SetFlag( m_nFlag) ; + pCam->SetFlag2( m_nFlag2) ; pCam->SetIndex( m_nIndex) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; @@ -240,8 +250,8 @@ Operation::AddLinearMove( const Point3d& ptP) pCam->SetAuxDir( m_vtAux) ; pCam->SetEndPoint( ptP) ; pCam->SetFeed( m_dFeed) ; - pCam->SetFlag( UseFlag()) ; - pCam->SetFlag2( UseFlag2()) ; + pCam->SetFlag( m_nFlag) ; + pCam->SetFlag2( m_nFlag2) ; pCam->SetIndex( m_nIndex) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; @@ -314,8 +324,8 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, pCam->SetDeltaN( dDeltaZ) ; pCam->SetNormDir( vtMyN) ; pCam->SetFeed( m_dFeed) ; - pCam->SetFlag( UseFlag()) ; - pCam->SetFlag2( UseFlag2()) ; + pCam->SetFlag( m_nFlag) ; + pCam->SetFlag2( m_nFlag2) ; pCam->SetIndex( m_nIndex) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; @@ -426,9 +436,7 @@ Operation::ResetMoveData( void) m_vtAux = V_NULL ; m_dFeed = 0 ; m_nFlag = 0 ; - m_bFlagModal = true ; m_nFlag2 = 0 ; - m_bFlag2Modal = true ; m_nIndex = 0 ; return true ; } From 839639fcc85a0ff8799a6e2fc8e8778ad8772066 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 27 Feb 2024 18:36:32 +0100 Subject: [PATCH 3/3] EgtMachKernel : - eliminate alcune variabili non usate. --- Operation.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Operation.cpp b/Operation.cpp index ec25565..418bc23 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -2077,7 +2077,6 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, if ( ! bFirst && pCamData->IsLine() && m_pMchMgr->ExistProtectedAreas()) { // verifico i limiti di corsa dei punti lungo la linea const int NUM_VERIF_STEP = 16 ; - Vector3d vtN = pCamData->GetAxesNormDir() ; Point3d ptPrec( dXprec, dYprec, dZprec) ; Point3d ptP( dX, dY, dZ) ; for ( int i = 1 ; i < NUM_VERIF_STEP ; ++ i) { @@ -2197,7 +2196,6 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, } // altrimenti linea else { - ICurveLine* pLine = GetCurveLine( pCurve) ; // lo considero un arco di raggio infinito pCamData->SetAxesCen( ORIG) ; pCamData->SetAxesRad( 0) ; @@ -2229,8 +2227,6 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRot { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; - // massima variazione assi rotanti per continuità - double dMaxDeltaR = 30 ; // eventuale direzione Aux preferenziale bool bUseRefAux = true ; Vector3d vtRefAux = Y_AX ; @@ -2906,7 +2902,6 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* const Vector3d& vtDirEnd = pCamDataPrev->GetToolDir() ; const Vector3d& vtAuxEnd = pCamDataPrev->GetAuxDir() ; // recupero dati posizione iniziale lavorazione corrente - const CamData* CdStart = GetInitialCamData( false) ; // vAxCurr già recuperati sopra const Point3d& ptPStart = pCamData->GetEndPoint() ; const Vector3d& vtDirStart = pCamData->GetToolDir() ;