From c3729befbbaccf4e4bb32ae72207ac1de124e66d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 27 Feb 2024 10:36:52 +0100 Subject: [PATCH] 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 ; }