diff --git a/Drilling.cpp b/Drilling.cpp index ce48a15..f4ca07f 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -718,22 +718,50 @@ Drilling::Update( bool bPostApply) return true ; } +//---------------------------------------------------------------------------- +bool +Drilling::VerifyMultiParallelFixedDrills( void) +{ + // se aggregato da sotto, sicuramente con una sola punta + bool bAggrBottom = IsAggrBottom( m_TParams.m_sHead) ; + if ( bAggrBottom) + return false ; + // se una sola uscita, inutile continuare + int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( m_TParams.m_sHead) ; + if ( nExitCnt == 1) + return false ; + // verifico che le uscite siano fisse + int nSelectType = m_pMchMgr->GetCurrMachine()->GetHeadSelectType( m_TParams.m_sHead) ; + if ( nSelectType != MCH_SLT_FIXEDEXITS) + return false ; + // recupero la direzione dell'utensile principale + Point3d ptMainExit ; Vector3d vtMainTool, vtMainAux ; + m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( m_TParams.m_sHead, m_TParams.m_nExit, ptMainExit, vtMainTool, vtMainAux) ; + // verifico ci sia almeno un'altra uscita attrezzata parallela a quella principale + for ( int nT = 0 ; nT < nExitCnt ; ++ nT) { + if ( nT + 1 == m_TParams.m_nExit) + continue ; + string sToolName ; + if ( m_pMchMgr->GetLoadedTool( m_TParams.m_sHead, nT + 1, sToolName) && ! sToolName.empty()) { + Point3d ptExit ; Vector3d vtTool, vtAux ; + if ( m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) && + AreSameVectorApprox( vtTool, vtMainTool)) + return true ; + } + } + // non è stato trovato niente + return false ; +} + //---------------------------------------------------------------------------- bool Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId) { - // controllo se ho più uscite - string sCurrHead ; - if ( ! m_pMchMgr->GetCurrMachine()->GetCurrHead( sCurrHead)) - return false ; - int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ; - int nSelectType = m_pMchMgr->GetCurrMachine()->GetHeadSelectType( sCurrHead) ; - bool bAggrBottom = IsAggrBottom( sCurrHead) ; - // se ho più uscite fisse e non è aggregato da sotto ... - if ( nExitCnt > 1 && nSelectType == MCH_SLT_FIXEDEXITS && ! bAggrBottom) { + // se ho almeno un'altra punta fissa parallela alla principale ... + if ( VerifyMultiParallelFixedDrills()) { TABMHDRILL tabDrills ; double dMHOff = 0 ; - if ( ! MultiHeadDrilling( nExitCnt, m_vId, nClId, tabDrills, dMHOff)) + if ( ! MultiHeadDrilling( m_vId, nClId, tabDrills, dMHOff)) return false ; if ( tabDrills.empty()) return true ; @@ -777,29 +805,29 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId) //---------------------------------------------------------------------------- bool -Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd) +Drilling::MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd) { // controllo parametri tabDrills.clear() ; if ( vId.empty()) return true ; - - // recupero il nome della testa - string sHead ; - m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ; // gestore degli utensili ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; if ( pTMgr == nullptr) return false ; + // recupero il nome della testa e il numero di uscite + string sHead ; + m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ; + int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sHead) ; + // Recupero i dati degli utensili montati sulla testa int nMainToolInd = -1 ; VECTORTOOL vTools ; vTools.reserve( nExitCnt) ; // ricavo gli utensili presenti sulle uscite for ( int nT = 0 ; nT < nExitCnt ; ++ nT) { string sToolName ; - ToolInfo TInf ; if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) { // non c'è utensile vTools.emplace_back( nullptr) ; diff --git a/Drilling.h b/Drilling.h index 8296d5e..e0421c6 100644 --- a/Drilling.h +++ b/Drilling.h @@ -86,11 +86,12 @@ class Drilling : public Machining bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ; bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ; bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ; - bool MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ; + bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ; bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ; bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ; bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ; + bool VerifyMultiParallelFixedDrills( void) ; private : double GetSpeed() const diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index aff92b1..e6d808f 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ