diff --git a/Milling.cpp b/Milling.cpp index 072cc7e..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 } } @@ -4524,6 +4529,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 +4907,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 ; } diff --git a/Operation.cpp b/Operation.cpp index d0812db..ae0e8d1 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -136,7 +136,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) { } @@ -2361,7 +2361,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) { @@ -2481,7 +2480,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) ; @@ -2513,8 +2511,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 ; @@ -3190,7 +3186,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() ; diff --git a/Operation.h b/Operation.h index 2f7e827..3d3fbbd 100644 --- a/Operation.h +++ b/Operation.h @@ -186,8 +186,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 ; } @@ -218,18 +219,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 ; }