EgtMachKernel 2.4k2 :

- migliorati log in Apply e Update di disposizioni e lavorazioni
- aggiunta funzione GetName a Operation.
This commit is contained in:
DarioS
2022-11-07 16:37:34 +01:00
parent 4f22c9c578
commit 7f1e0ac8d8
4 changed files with 75 additions and 3 deletions
+62 -3
View File
@@ -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