From 7f1e0ac8d83dfb0074143e7206298e805ebc93df Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 7 Nov 2022 16:37:34 +0100 Subject: [PATCH] EgtMachKernel 2.4k2 : - migliorati log in Apply e Update di disposizioni e lavorazioni - aggiunta funzione GetName a Operation. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes MachMgrOperations.cpp | 12 ++++++++ Operation.cpp | 65 ++++++++++++++++++++++++++++++++++++++++-- Operation.h | 1 + 4 files changed, 75 insertions(+), 3 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 83282655b39fb51e018ff33a2e914f8507ace147..d782996e4f7bbfd3fe0be593ea8350bff83c4fd3 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx_^ItYwW=5mQj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHP01iS delta 97 zcmZpRX^YwLhmFy2^ItYwW=6xwj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHOf?`f diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index e193f1e..2407be2 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -642,6 +642,9 @@ MachMgr::DispositionSpecialApply( int nId, bool bRecalc) Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ; if ( pDisp == nullptr) return false ; + // Eventuale log + string sOut = "DispositionSpecialApply start --> " + pDisp->GetName() ; + LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; // lancio l'azione return pDisp->SpecialApply( bRecalc) ; } @@ -662,6 +665,9 @@ MachMgr::DispositionSpecialUpdate( int nId) Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ; if ( pDisp == nullptr) return false ; + // Eventuale log + string sOut = "DispositionSpecialUpdate start --> " + pDisp->GetName() ; + LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; // lancio l'azione return pDisp->SpecialUpdate() ; } @@ -1041,6 +1047,9 @@ MachMgr::MachiningApply( bool bRecalc, bool bPostApply) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // Log + string sOut = "MachiningApply start --> " + pMch->GetName() ; + LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; // imposto fase della lavorazione come temporaneamente corrente SetTempPhase TmpPhase( this, pMch->GetPhase()) ; // imposto visualizzazione completa della macchina come temporaneamente corrente @@ -1069,6 +1078,9 @@ MachMgr::MachiningUpdate( bool bPostApply) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // Log + string sOut = "MachiningUpdate start --> " + pMch->GetName() ; + LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; // imposto fase della lavorazione come temporaneamente corrente SetTempPhase TmpPhase( this, pMch->GetPhase()) ; // imposto visualizzazione completa della macchina come temporaneamente corrente diff --git a/Operation.cpp b/Operation.cpp index 2ccfe49..7e6ebc8 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -32,6 +32,7 @@ #include "/EgtDev/Include/EGkGeomDB.h" #include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h" +#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtPointerOwner.h" @@ -153,6 +154,16 @@ Operation::UpdateFollowingOperationsStatus(int nModif) return true ; } +//---------------------------------------------------------------------------- +string +Operation::GetName( void) const +{ + string sName ; + if ( m_pGeomDB == nullptr || ! m_pGeomDB->GetName( m_nOwnerId, sName)) + sName = "___" ; + return sName ; +} + //---------------------------------------------------------------------------- bool Operation::GetElevation( int nPhase, const Point3d& ptP, @@ -3025,10 +3036,20 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn for ( int i = 0 ; i < COLL_STEP && ! bCollide ; ++ i) { // Imposto la posizione double dCoeff = double( i) / COLL_STEP ; - for ( size_t j = 0 ; j < vAxStart.size() ; ++ j) { + for ( int j = 0 ; j < int( vAxName.size()) ; ++ j) { double dPos = ( 1 - dCoeff) * vAxStart[j] + dCoeff * vAxEnd[j] ; pMch->SetAxisPos( vAxName[j], dPos) ; } + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + string sAxes = "Test Collision at " ; + for ( int j = 0 ; j < int( vAxName.size()) ; ++ j) { + double dPos ; + pMch->GetAxisPos( vAxName[j], dPos) ; + sAxes += vAxName[j] + "=" + ToString( dPos, 1) + " " ; + } + LOG_DBG_INFO( GetEMkLogger(), sAxes.c_str()) ; + } // Determino sottobox e box della testa e degli altri oggetti da considerare per la collisione BOXIVECTOR vbiSH ; BBox3d b3Head ; @@ -3044,13 +3065,32 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn } nHId = m_pGeomDB->GetNext( nHId) ; } + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + string sHead ; + if ( ! m_pGeomDB->GetName( nCId, sHead)) + sHead = "---" ; + string sOut = " " + sHead + " : " + ToString( b3Head, 1) ; + LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; + } } // Li confronto con i grezzi for ( const auto nRawId : vRawId) { // verifico i box BBox3d b3Raw ; int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; - if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) && b3Head.Overlaps( b3Raw)) { + m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ; + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + string sBox = " Raw : " + ( b3Raw.IsEmpty() ? string( "Empty Box") : ToString( b3Raw, 1)) ; + LOG_DBG_INFO( GetEMkLogger(), sBox.c_str()) ; + } + // se i box interferiscono + if ( ! b3Raw.IsEmpty() && b3Head.Overlaps( b3Raw)) { + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + LOG_DBG_INFO( GetEMkLogger(), " Can collide -->") ; + } // solido del grezzo const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nRawSolidId)) ; // riferimento del grezzo @@ -3101,13 +3141,28 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn break ; } } + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + LOG_DBG_INFO( GetEMkLogger(), ( bCollide ? " COLLIDE" : " avoid")) ; + } // Se non trovata collisione, li confronto con i bloccaggi if ( ! bCollide) { for ( const auto nFxtId : vFxtId) { // verifico i box BBox3d b3Fxt ; int nFlag = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ; - if ( m_pGeomDB->GetGlobalBBox( nFxtId, b3Fxt, nFlag) && b3Head.Overlaps( b3Fxt)) { + m_pGeomDB->GetGlobalBBox( nFxtId, b3Fxt, nFlag) ; + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + string sBox = " Fxt : " + ( b3Fxt.IsEmpty() ? string( "Empty Box") : ToString( b3Fxt, 1)) ; + LOG_DBG_INFO( GetEMkLogger(), sBox.c_str()) ; + } + // se i box interferiscono + if ( ! b3Fxt.IsEmpty() && b3Head.Overlaps( b3Fxt)) { + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + LOG_DBG_INFO( GetEMkLogger(), " Can collide -->") ; + } // verifico i sottobox for ( const auto& biSH : vbiSH) { if ( biSH.first.Overlaps( b3Fxt)) { @@ -3119,6 +3174,10 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn break ; } } + // eventuale emissione Log + if ( ExeGetDebugLevel() >= 5) { + LOG_DBG_INFO( GetEMkLogger(), ( bCollide ? " COLLIDE" : " avoid")) ; + } } } // Riporto la macchina in home diff --git a/Operation.h b/Operation.h index 980a146..7fd7d90 100644 --- a/Operation.h +++ b/Operation.h @@ -43,6 +43,7 @@ class Operation : public IUserObj virtual int GetPhase( void) const { return m_nPhase ; } virtual bool RemoveHome( void) ; + std::string GetName( void) const ; public : virtual int GetType( void) const = 0 ;