From 62e060dbc6a293c05f739a2ce88175bb6f23def7 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 4 Apr 2018 17:58:51 +0000 Subject: [PATCH] EgtMachKernel 1.9d1 : - aggiunto reset tavola e utensile/testa correnti alla creazione di nuovo gruppo di lavoro. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachMgrMachGroups.cpp | 6 ++++++ Machine.cpp | 4 +++- Machine.h | 3 +++ MachineCalc.cpp | 37 +++++++++++++++++++++++++++---------- MachineTables.cpp | 13 +++++++++++++ 6 files changed, 52 insertions(+), 11 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index f4cbc915fe10720d1f26ba2a865ffa7f39a436be..05340c64cd66c77e11c4fee236b2cf1bc8c1696d 100644 GIT binary patch delta 121 zcmewt{V#gMH#Sxi1|0^&&A-{KnVC}<3@1O7)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RU@pCXfIC delta 121 zcmewt{V#gMH#Syd1|0^o&A-{KnVFLr%qBmS)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RVGhCa?ei diff --git a/MachMgrMachGroups.cpp b/MachMgrMachGroups.cpp index 3235eca..8cb2113 100644 --- a/MachMgrMachGroups.cpp +++ b/MachMgrMachGroups.cpp @@ -165,6 +165,12 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName) m_pGeomDB->Erase( nNewId) ; return GDB_ID_NULL ; } + // reset tavola e utensile correnti + Machine* pMch = GetCurrMachine() ; + if ( pMch != nullptr) { + pMch->ResetCurrTable() ; + pMch->ResetCurrTool() ; + } // aggiorno attrezzaggio attivo UpdateSetup() ; // nascondo i pezzi rimasti sotto la radice diff --git a/Machine.cpp b/Machine.cpp index ac18d19..f82383b 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -842,8 +842,10 @@ Machine::SetLook( int nFlag) // recupero l'identificativo del gruppo di base della macchina int nMBaseId = m_pGeomDB->GetFirstInGroup( GetMachineId()) ; - // recupero la tavola corrente + // recupero la tavola corrente (se non definita, prendo la prima) int nTabId = GetCurrTable() ; + if ( nTabId == GDB_ID_NULL) + nTabId = GetFirstTable() ; if ( nTabId == GDB_ID_NULL) return false ; // nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola diff --git a/Machine.h b/Machine.h index 8e6850c..e4bd095 100644 --- a/Machine.h +++ b/Machine.h @@ -54,6 +54,7 @@ class Machine return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; } bool GetAllHeadsNames( STRVECTOR& vNames) const ; bool GetAllTablesNames( STRVECTOR& vNames) const ; + int GetFirstTable( void) const ; int GetHeadExitCount( const std::string& sHead) const ; int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ; int GetHeadSolCh( const std::string& sHead) const ; @@ -76,6 +77,7 @@ class Machine bool ResetAxisPos( const std::string& sAxis) ; bool ResetAllAxesPos( void) ; bool SetCurrTable( const std::string& sTable) ; + bool ResetCurrTable( void) ; int GetCurrTable( void) const ; bool GetCurrTable( std::string& sTable) const ; bool GetCurrTableRef1( Point3d& ptRef1) const ; @@ -83,6 +85,7 @@ class Machine bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ; bool GetCurrTableIsTilting( bool& bTilting) const ; bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ; + bool ResetCurrTool( void) ; int GetCurrTool( void) const ; bool GetCurrTool( std::string& sTool) const ; int GetCurrHead( void) const ; diff --git a/MachineCalc.cpp b/MachineCalc.cpp index 570f263..6440333 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -67,6 +67,13 @@ Machine::SetCurrTable( const string& sTable) else return true ; } +//---------------------------------------------------------------------------- +bool +Machine::ResetCurrTable( void) +{ + m_nCalcTabId = GDB_ID_NULL ; + return true ; +} //---------------------------------------------------------------------------- int @@ -171,19 +178,11 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const bool Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) { + // azzero tutto + ResetCurrTool() ; // controllo GeomDB if ( m_pGeomDB == nullptr) return false ; - // azzero tutto - m_nCalcHeadId = GDB_ID_NULL ; - m_nCalcExitId = GDB_ID_NULL ; - m_nCalcToolId = GDB_ID_NULL ; - m_dCalcRot1W = 1 ; - m_nCalcSolCh = MCH_SCC_NONE ; - m_dCalcTLen = 0 ; - m_dCalcTRad = 0 ; - m_dCalcTOvLen = 0 ; - m_dCalcTOvRad = 0 ; // recupero il gruppo della testa int nHeadId = GetGroup( sHead) ; // recupero i dati della testa @@ -275,6 +274,24 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) return CalculateKinematicChain() ; } +//---------------------------------------------------------------------------- +bool +Machine::ResetCurrTool( void) +{ + // azzero tutto + m_nCalcHeadId = GDB_ID_NULL ; + m_nCalcExitId = GDB_ID_NULL ; + m_nCalcToolId = GDB_ID_NULL ; + m_dCalcRot1W = 1 ; + m_nCalcSolCh = MCH_SCC_NONE ; + m_dCalcTLen = 0 ; + m_dCalcTRad = 0 ; + m_dCalcTOvLen = 0 ; + m_dCalcTOvRad = 0 ; + // ritorno + return true ; +} + //---------------------------------------------------------------------------- int Machine::GetCurrTool( void) const diff --git a/MachineTables.cpp b/MachineTables.cpp index 7dbb8c1..dad4126 100644 --- a/MachineTables.cpp +++ b/MachineTables.cpp @@ -38,3 +38,16 @@ Machine::GetAllTablesNames( STRVECTOR& vNames) const std::sort( vNames.begin(), vNames.end()) ; return true ; } + +//---------------------------------------------------------------------------- +int +Machine::GetFirstTable( void) const +{ + // ricerca della prima tavola + for each ( const auto& snGro in m_mapGroups) { + if ( IsTableGroup( snGro.second)) + return snGro.second ; + } + // non trovata alcuna tavola + return GDB_ID_NULL ; +}