From af4f4633e063d62b494f3022cec117b67e7682fc Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 15 Feb 2016 07:44:15 +0000 Subject: [PATCH] EgtExecutor 1.6n4 : - correzione a ChainCurves - aggiunte RemoveLastPhase, VerifyRawPartPhase, SplitFlatRawPartWithMachinings, GetOperationPhase, RemoveAllPhaseOperations, ChangeOperationPhase, GetPhaseDisposition - estesa VerifyCutAsSplitting - aggiunti nei messaggi gestione "???" per traduzioni da fare. --- EXE_GdbModifyCurve.cpp | 20 +++--- EXE_MachMgr.cpp | 90 +++++++++++++++++++++++++-- EXE_Messages.cpp | 3 +- EXE_NstCreateFlatParts.cpp | 15 ++++- EXE_NstMachining.cpp | 58 +++++++++++------ EgtExecutor.rc | Bin 11694 -> 11694 bytes LUA_MachMgr.cpp | 124 ++++++++++++++++++++++++++++++++++++- 7 files changed, 274 insertions(+), 36 deletions(-) diff --git a/EXE_GdbModifyCurve.cpp b/EXE_GdbModifyCurve.cpp index c83e8e1..7ef2f7f 100644 --- a/EXE_GdbModifyCurve.cpp +++ b/EXE_GdbModifyCurve.cpp @@ -1134,16 +1134,16 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in while ( nId != GDB_ID_NULL) { // recupero la curva ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ; - if ( pCrv == nullptr) - continue ; - // recupero i dati della curva necessari al concatenamento e li assegno - Point3d ptStart, ptEnd ; - Vector3d vtStart, vtEnd ; - if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) || - ! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd)) - return false ; - if ( ! chainC.AddCurve( nId, ptStart, vtStart, ptEnd, vtEnd)) - return false ; + if ( pCrv != nullptr) { + // recupero i dati della curva necessari al concatenamento e li assegno + Point3d ptStart, ptEnd ; + Vector3d vtStart, vtEnd ; + if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetStartDir( vtStart) || + ! pCrv->GetEndPoint( ptEnd) || ! pCrv->GetEndDir( vtEnd)) + return false ; + if ( ! chainC.AddCurve( nId, ptStart, vtStart, ptEnd, vtEnd)) + return false ; + } // passo al successivo nId = pGeomDB->GetNext( nId) ; } diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index 4baba81..74a110e 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -260,6 +260,16 @@ ExeGetCurrPhase( void) return pMachMgr->GetCurrPhase() ; } +//----------------------------------------------------------------------------- +bool +ExeRemoveLastPhase( void) +{ + IMachMgr* pMachMgr = GetCurrMachMgr() ; + VERIFY_MACHMGR( pMachMgr, false) + // elimina l'ultima fase di lavorazione dalla macchinata corrente + return pMachMgr->RemoveLastPhase() ; +} + //----------------------------------------------------------------------------- int ExeGetPhaseCount( void) @@ -421,6 +431,18 @@ ExeKeepRawPart( int nRawId) return bOk ; } +//----------------------------------------------------------------------------- +bool +ExeVerifyRawPartPhase( int nRawId, int nPhase) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // verifico che il grezzo sia valido ed appartenga alla fase di lavorazione indicata + bool bOk = pGseCtx->m_pMachMgr->VerifyRawPartPhase( nRawId, nPhase) ; + // restituisco il risultato + return bOk ; +} + //----------------------------------------------------------------------------- bool ExeRemoveRawPart( int nRawId) @@ -523,6 +545,26 @@ ExeMoveRawPart( int nRawId, const Vector3d& vtMove) return bOk ; } +//----------------------------------------------------------------------------- +int +ExeSplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // divido il grezzo in nuove parti in base alle lavorazioni + int nId = pGseCtx->m_pMachMgr->SplitFlatRawPartWithMachinings( nRawId, vMchId) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtSplitFlatRawPartWithMachinings(" + ToString( nRawId) + ",{" + + IdListToString( vMchId) + "})" + + " -- FirstId=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco il risultato + return nId ; +} + //----------------------------------------------------------------------------- int ExeGetPartInRawPartCount( int nRawId) @@ -1128,10 +1170,20 @@ ExeGetOperationType( int nId) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) - // recupero il tipo di operazione della macchinata corrente + // recupero il tipo della operazione della macchinata corrente return pGseCtx->m_pMachMgr->GetOperationType( nId) ; } +//----------------------------------------------------------------------------- +int +ExeGetOperationPhase( int nId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero la fase di appartenenza della operazione della macchinata corrente + return pGseCtx->m_pMachMgr->GetOperationPhase( nId) ; +} + //----------------------------------------------------------------------------- bool ExeRemoveOperation( int nId) @@ -1142,14 +1194,24 @@ ExeRemoveOperation( int nId) return pGseCtx->m_pMachMgr->RemoveOperation( nId) ; } +//----------------------------------------------------------------------------- +bool +ExeRemoveAllPhaseOperations( int nPhase) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // elimino tutte le operazioni (tranne la disposizione) della fase indicata della macchinata corrente + return pGseCtx->m_pMachMgr->RemoveAllPhaseOperations( nPhase) ; +} + //----------------------------------------------------------------------------- bool ExeRemoveAllOperations( void) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) - // elimino tutte le operazioni della macchinata corrente tranne il primo posizionamento - return pGseCtx->m_pMachMgr->RemoveAllOperations( true) ; + // elimino tutte le operazioni e le fasi della macchinata corrente tranne la prima disposizione + return pGseCtx->m_pMachMgr->RemoveAllOperations() ; } //----------------------------------------------------------------------------- @@ -1212,6 +1274,26 @@ ExeSetAllOperationsStatus( bool bShow) return pGseCtx->m_pMachMgr->SetAllOperationsStatus( true, bShow) ; } +//----------------------------------------------------------------------------- +bool +ExeChangeOperationPhase( int nId, int nNewPhase) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // cambio la fase dell'operazione e la sposto in fondo alle lavorazioni della stessa fase + return pGseCtx->m_pMachMgr->ChangeOperationPhase( nId, nNewPhase) ; +} + +//----------------------------------------------------------------------------- +int +ExeGetPhaseDisposition( int nPhase) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero la disposizione della fase indicata + return pGseCtx->m_pMachMgr->GetPhaseDisposition( nPhase) ; +} + //----------------------------------------------------------------------------- // Lavorazioni //----------------------------------------------------------------------------- @@ -1361,7 +1443,7 @@ ExeIsMachiningEmpty( void) GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // restituisco lo stato della lavorazione corrente - return pGseCtx->m_pMachMgr->IsEmpty() ; + return pGseCtx->m_pMachMgr->IsMachiningEmpty() ; } //----------------------------------------------------------------------------- diff --git a/EXE_Messages.cpp b/EXE_Messages.cpp index 8f3b8a9..8f0b35e 100644 --- a/EXE_Messages.cpp +++ b/EXE_Messages.cpp @@ -71,7 +71,8 @@ ExeLoadMessages( const string& sMsgFilePath) } nCurrNum = nNum ; // converto i caratteri speciali - ReplaceString( sMsg, "
", "\n") ; + ReplaceString( sMsg, "
", "\n") ; // a capo + ReplaceString( sMsg, "???", "") ; // da tradurre // inserisco il messaggio in tabella if ( ! s_IdStringMap.emplace( nNum, sMsg).second) return false ; diff --git a/EXE_NstCreateFlatParts.cpp b/EXE_NstCreateFlatParts.cpp index 09d8030..27dfd3c 100644 --- a/EXE_NstCreateFlatParts.cpp +++ b/EXE_NstCreateFlatParts.cpp @@ -605,8 +605,19 @@ ExeAdjustFlatPartLayer( int nLayerId) // Disabilito registrazione comandi CmdLogOff cmdLogOff ; bool bOk = true ; - // Compatto e poi esplodo le curve composite + // Elimino dal gruppo gli oggetti che non sono curve int nId = pGeomDB->GetFirstInGroup( nLayerId) ; + while ( nId != GDB_ID_NULL && bOk) { + // Recupero successiva + int nNextId = pGeomDB->GetNext( nId) ; + // Se non è una curva, la cancello + if ( ( pGeomDB->GetGeoType( nId) & GEO_CURVE) == 0) + pGeomDB->Erase( nId) ; + // Passo all'entità successiva + nId = nNextId ; + } + // Compatto e poi esplodo le curve composite + nId = pGeomDB->GetFirstInGroup( nLayerId) ; while ( nId != GDB_ID_NULL && bOk) { // Recupero successiva int nNextId = pGeomDB->GetNext( nId) ; @@ -635,7 +646,7 @@ ExeAdjustFlatPartLayer( int nLayerId) // Inserisco in ogni curva info su angoli con precedente e successiva int nFirstId = pGeomDB->GetFirstInGroup( nLayerId) ; nId = nFirstId ; - while ( nId != GDB_ID_NULL) { + while ( bOk && nId != GDB_ID_NULL) { // Recupero successiva int nNextId = pGeomDB->GetNext( nId) ; // Successiva geometrica (si considera il layer formato da curve contigue che si chiudono) diff --git a/EXE_NstMachining.cpp b/EXE_NstMachining.cpp index 066988d..9f0bf67 100644 --- a/EXE_NstMachining.cpp +++ b/EXE_NstMachining.cpp @@ -45,7 +45,7 @@ ExeVerifyMachining( int nMchId, int& nResult) return false ; // se vuoto, cerco il rimando al preview nel pezzo if ( pGeomDB->GetGroupObjs( nPVGrp) == 0 && - ! pGeomDB->GetInfo( nPVGrp, "PvId", nPVGrp)) + ! pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp)) return false ; // ciclo sui percorsi utensile (CL) int nClId = pGeomDB->GetFirstGroupInGroup( nPVGrp) ; @@ -141,7 +141,7 @@ ExeVerifyMachining( int nMchId, int& nResult) } //---------------------------------------------------------------------------- -bool +int ExeVerifyCutAsSplitting( int nMchId) { GseContext* pGseCtx = GetCurrGseContext() ; @@ -155,32 +155,54 @@ ExeVerifyCutAsSplitting( int nMchId) int nCurrMch = pGseCtx->m_pMachMgr->GetCurrMachining() ; // imposto la nuova lavorazione corrente pGseCtx->m_pMachMgr->SetCurrMachining( nMchId) ; + // risultato + int nResult = CAR_INTERF ; // recupero attacco e uscita correnti della lavorazione int nLiType ; pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADINTYPE, nLiType) ; int nLoType ; pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADOUTTYPE, nLoType) ; - // se diversi da attacco/uscita al bordo grezzo, li cambio - bool bToModif = ( ( nLiType != SAW_LI_EXT_CENT && nLiType != SAW_LI_EXT_OUT) || nLoType != SAW_LO_EXT) ; - if ( bToModif) { + // verifico se posso portare attacco al bordo grezzo + bool bLiToModif = ( nLiType != SAW_LI_EXT_CENT && nLiType != SAW_LI_EXT_OUT) ; + if ( bLiToModif) { + // cambio attacco pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, SAW_LI_EXT_CENT) ; - pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT) ; - } - // aggiorno preview - pGseCtx->m_pMachMgr->MachiningPreview( true) ; - // verifico interferenza - bool bOk ; - int nResult ; - bOk = ( ExeVerifyMachining( nMchId, nResult) && nResult == FMI_NONE) ; - // se attacco/uscita modificati, li ripristino e riaggiorno preview - if ( bToModif) { - pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ; - pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ; + // aggiorno preview pGseCtx->m_pMachMgr->MachiningPreview( true) ; + // verifico interferenza + int nRes ; + if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) + nResult += CAR_LI_OK ; + // ripristino attacco originale + pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ; + } + // verifico se posso portare uscita al bordo grezzo + bool bLoToModif = ( nLoType != SAW_LO_EXT) ; + if ( bLoToModif) { + pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT) ; + // aggiorno preview + pGseCtx->m_pMachMgr->MachiningPreview( true) ; + // verifico interferenza + int nRes ; + if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) + nResult += CAR_LO_OK ; + // ripristino uscita originale + pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ; + } + // aggiorno preview con attacco/uscita originali + pGseCtx->m_pMachMgr->MachiningPreview( true) ; + // se già al bordo grezzo, faccio verifica + if ( ! bLiToModif && ! bLoToModif) { + // aggiorno preview + pGseCtx->m_pMachMgr->MachiningPreview( true) ; + // verifico interferenza + int nRes ; + if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) + nResult = CAR_LI_LO_OK ; } // ripristino lavorazione corrente pGseCtx->m_pMachMgr->SetCurrMachining( nCurrMch) ; // restituisco il risultato - return bOk ; + return nResult ; } diff --git a/EgtExecutor.rc b/EgtExecutor.rc index a15b5c8bd68cf68846e97ad78f0834dce169eeba..59ae7e767d78d233d74bf7f56aed0f90c4f798dc 100644 GIT binary patch delta 97 zcmZ1%y)JsgA2vpl%@@V4Gflq2na5}{Ignd-a{*Tk3sCf++-0W82LxfF21;&>n->Y| cF@rU@0x76sKgP|Iq`|@mn->Y| cF@rU@0x76sKgP|Iq`|@m