From 086af445e50196db434b6d5c847ef56d18cced46 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 19 May 2016 07:07:52 +0000 Subject: [PATCH] EgtMachKernel 1.6r5 : - modifica per rimettere i grezzi unlinked da gruppi macchina e di fase 1 sempre all'inizio del loro gruppo. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes MachMgrRawParts.cpp | 16 +++++++++------- Machine.cpp | 12 ++++++++++-- Machine.h | 1 + 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 9d89ae6ad5eaaf48a2776a8957a544f58d6ad07a..d6167a964ee7d4c95fff44f68857fd6cfc207e28 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFy6^ItYwW=7M=j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQiUK= delta 97 zcmZpRX^YwLhmFx>^ItYwW=50Aj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQ1Kv2 diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index ea93d4e..af78fbb 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -619,14 +619,16 @@ MachMgr::RemoveRawPart( int nRawId) bool MachMgr::VerifyRawPart( int nRawId) const { - // recupero il gruppo dei grezzi nella macchinata corrente + // se il grezzo fa parte del gruppo dei grezzi, va bene int nRawGroupId = GetCurrRawGroupId() ; - if ( nRawGroupId == GDB_ID_NULL) - return false ; - // verifico che questo grezzo ne faccia parte - if ( m_pGeomDB->GetParentId( nRawId) != nRawGroupId) - return false ; - return true ; + if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId) + return true ; + // se il grezzo è linkato ad un gruppo della macchina corrente, va bene + Machine* pMch = GetCurrMachine() ; + if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId)) + return true ; + // altrimenti errore + return false ; } //---------------------------------------------------------------------------- diff --git a/Machine.cpp b/Machine.cpp index 8fc6ad1..490a781 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -894,6 +894,13 @@ Machine::LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) return true ; } +//---------------------------------------------------------------------------- +bool +Machine::IsLinkedRawPart( int nRawId) const +{ + return ( find( m_vLinkedRawParts.begin(), m_vLinkedRawParts.end(), nRawId) != m_vLinkedRawParts.end()) ; +} + //---------------------------------------------------------------------------- bool Machine::UnlinkRawPartFromGroup( int nRawPartId) @@ -909,8 +916,9 @@ Machine::UnlinkRawPartFromGroup( int nRawPartId) auto iIter = find( m_vLinkedRawParts.begin(), m_vLinkedRawParts.end(), nRawPartId) ; if ( iIter == m_vLinkedRawParts.end()) return false ; - // riporto il grezzo nel gruppo dei grezzi - if ( ! m_pGeomDB->RelocateGlob( nRawPartId, nRawGrpId)) + // riporto il grezzo nel gruppo dei grezzi (se appartiene alla prima fase in testa) + int nInsPos = ( m_pMchMgr->VerifyRawPartPhase( nRawPartId, 1) ? GDB_FIRST_SON : GDB_LAST_SON) ; + if ( ! m_pGeomDB->RelocateGlob( nRawPartId, nRawGrpId, nInsPos)) return false ; // tolgo il grezzo dall'elenco dei linkati m_vLinkedRawParts.erase( iIter) ; diff --git a/Machine.h b/Machine.h index a31767e..1691276 100644 --- a/Machine.h +++ b/Machine.h @@ -93,6 +93,7 @@ class Machine const std::string& GetOutstrokeInfo( void) const { return m_sOutstrokeInfo ; } bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ; + bool IsLinkedRawPart( int nRawId) const ; bool UnlinkRawPartFromGroup( int nRawPartId) ; bool UnlinkAllRawPartsFromGroups( void) ; bool LuaExistsFunction( const std::string& sFun) ;