From 1179ad7e84b5d7bca253c3219b8ba01e10082a08 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 2 Feb 2024 16:20:05 +0100 Subject: [PATCH] EgtMachKernel 2.6b1 : - migliorato controlli su testa e suo attrezzaggio per MultipleDrill. --- Drilling.cpp | 60 ++++++++++++++++++++++++++++++++++------------- Drilling.h | 3 ++- EgtMachKernel.rc | Bin 11774 -> 11774 bytes 3 files changed, 46 insertions(+), 17 deletions(-) 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 aff92b1f42c439a4a4d2613dcfdb7a494a407061..e6d808f32b4e5a9ae0da2cba593609e7503fab83 100644 GIT binary patch delta 121 zcmewt{V#gMH#Sxy1|0^&&A-{KnVFLq3@1O7)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RU$`CV&6{ delta 121 zcmewt{V#gMH#Sy71|0^Y&A-{KnVAzAj3z&n)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RU$uCV&6{