diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index 0f0e2c6..0530b9f 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -1331,10 +1331,30 @@ ExeSetCurrMachining( int nId) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) - // imposto la lavorazione di identificativo Id come corrnte + // imposto la lavorazione di identificativo Id come corrente return pGseCtx->m_pMachMgr->SetCurrMachining( nId) ; } +//----------------------------------------------------------------------------- +bool +ExeResetCurrMachining( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // reset della lavorazione corrente + return pGseCtx->m_pMachMgr->ResetCurrMachining() ; +} + +//----------------------------------------------------------------------------- +int +ExeGetCurrMachining( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // restituisco l'identificativo della lavorazione corrente + return pGseCtx->m_pMachMgr->GetCurrMachining() ; +} + //----------------------------------------------------------------------------- bool ExeSetMachiningParam( int nType, bool bVal) diff --git a/EXE_NstMachining.cpp b/EXE_NstMachining.cpp index e7af9b6..2c5c652 100644 --- a/EXE_NstMachining.cpp +++ b/EXE_NstMachining.cpp @@ -34,7 +34,8 @@ ExeVerifyMachining( int nMchId, int& nResult) VERIFY_GEOMDB( pGeomDB, false) // Flag per calcolo box - const int BBF_MY_FLAG = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ; + const int BBF_MCH_MY_FLAG = BBF_STANDARD ; + const int BBF_PART_MY_FLAG = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ; // Recupero il box e le regioni della lavorazione BBox3d b3Mch ; @@ -54,7 +55,7 @@ ExeVerifyMachining( int nMchId, int& nResult) int nCrId = pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RRCUT) ; while ( nCrId != GDB_ID_NULL) { BBox3d b3Reg ; - if ( ! pGeomDB->GetGlobalBBox( nCrId, b3Reg, BBF_MY_FLAG)) + if ( ! pGeomDB->GetGlobalBBox( nCrId, b3Reg, BBF_MCH_MY_FLAG)) return false ; b3Mch.Add( b3Reg) ; vMchRReg.emplace_back( nCrId) ; @@ -64,7 +65,7 @@ ExeVerifyMachining( int nMchId, int& nResult) int nLiId = pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RLICUT) ; while ( nLiId != GDB_ID_NULL) { BBox3d b3Reg ; - if ( ! pGeomDB->GetGlobalBBox( nLiId, b3Reg, BBF_MY_FLAG)) + if ( ! pGeomDB->GetGlobalBBox( nLiId, b3Reg, BBF_MCH_MY_FLAG)) return false ; b3Mch.Add( b3Reg) ; vMchLiReg.emplace_back( nLiId) ; @@ -74,7 +75,7 @@ ExeVerifyMachining( int nMchId, int& nResult) int nLoId = pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RLOCUT) ; while ( nLoId != GDB_ID_NULL) { BBox3d b3Reg ; - if ( ! pGeomDB->GetGlobalBBox( nLoId, b3Reg, BBF_MY_FLAG)) + if ( ! pGeomDB->GetGlobalBBox( nLoId, b3Reg, BBF_MCH_MY_FLAG)) return false ; b3Mch.Add( b3Reg) ; vMchLoReg.emplace_back( nLoId) ; @@ -90,25 +91,32 @@ ExeVerifyMachining( int nMchId, int& nResult) if ( ExeSetCurrMachining( nMchId) && ExeGetMachiningGeometry( vIds) && ! vIds.empty()) nMchPartId = pGeomDB->GetParentId( pGeomDB->GetParentId( vIds[0].nId)) ; + // Recupero la fase di appartenenza della lavorazione + int nPhase = ExeGetOperationPhase( nMchId) ; + // Determino le regioni di tutti gli altri pezzi compresi nella regione della lavorazione INTVECTOR vOthReg ; int nRawId = ExeGetFirstRawPart() ; - while ( nRawId != GDB_ID_NULL) { - int nId = ExeGetFirstGroupInGroup( nRawId) ; - while ( nId != GDB_ID_NULL) { - if ( nId != nMchPartId) { - BBox3d b3Part ; - if ( pGeomDB->GetGlobalBBox( nId, b3Part, BBF_MY_FLAG) && - b3Mch.OverlapsXY( b3Part)) { - // recupero regione del pezzo - int nRegId = GetFlatPartRegion( pGeomDB, nId) ; - if ( nRegId != GDB_ID_NULL) - vOthReg.emplace_back( nRegId) ; - else - return false ; + while ( nRawId != GDB_ID_NULL) { + // se il grezzo appartiene alla fase di lavorazione + if ( ExeVerifyRawPartPhase( nRawId, nPhase)) { + // ciclo sui pezzi presenti nel grezzo + int nId = ExeGetFirstPartInRawPart( nRawId) ; + while ( nId != GDB_ID_NULL) { + if ( nId != nMchPartId) { + BBox3d b3Part ; + if ( pGeomDB->GetGlobalBBox( nId, b3Part, BBF_PART_MY_FLAG) && + b3Mch.OverlapsXY( b3Part)) { + // recupero regione del pezzo + int nRegId = GetFlatPartRegion( pGeomDB, nId) ; + if ( nRegId != GDB_ID_NULL) + vOthReg.emplace_back( nRegId) ; + else + return false ; + } } + nId = ExeGetNextPartInRawPart( nId) ; } - nId = ExeGetNextGroup( nId) ; } nRawId = ExeGetNextRawPart( nRawId) ; }