From 05f96209f79fce4bfc30cd0419beb10ee520bef6 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 1 Oct 2024 13:11:39 +0200 Subject: [PATCH 1/3] EgtMachKernel : - aggiunto controllo abilitazione lavorazioni avanzate in simulazione, stima e generazione. --- Estimator.cpp | 79 +++++++++++++++++++++++++++++++++++++++++-------- Generator.cpp | 31 +++++++++++++++---- SimulatorMP.cpp | 48 ++++++++++++++++++++++++++++++ SimulatorSP.cpp | 48 ++++++++++++++++++++++++++++++ 4 files changed, 188 insertions(+), 18 deletions(-) diff --git a/Estimator.cpp b/Estimator.cpp index 4e37319..0629fa5 100644 --- a/Estimator.cpp +++ b/Estimator.cpp @@ -15,9 +15,12 @@ #include "stdafx.h" #include "DllMain.h" #include "Estimator.h" -#include "Machine.h" +#include "MachMgr.h" #include "OutputConst.h" #include "/EgtDev/Include/EGnFileUtils.h" +#include "/EgtDev/Include/EGnGetKeyData.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" using namespace std ; @@ -45,23 +48,75 @@ Estimator::Init( MachMgr* pMchMgr) bool Estimator::Run( const string& sCncFile, const string& sInfo) { - // emetto info di log - { string sOut = "Estimator Run : " + sCncFile ; - LOG_INFO( GetEMkLogger(), sOut.c_str()) ; } + // Controllo della licenza + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( ! GetEMkNetHwKey()) + nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + + // Verifica della abilitazione + bool bMinTime = false ; + if ( nOptExpDays >= GetMinDay()) + bMinTime = true ; + bool bCurrTime = false ; + if ( nOptExpDays >= GetCurrDay()) + bCurrTime = true ; + bool bKey = false ; + if ( nRet == KEY_OK) + bKey = true ; + bool bAdvMach = false ; + if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + bAdvMach = true ; + + // Esecuzione + if ( bMinTime && bCurrTime && bKey) { + // se non previste lavorazioni avanzate, verifico la loro assenza + if ( ! bAdvMach) { + int nOpId = m_pMchMgr->GetFirstActiveOperation() ; + while ( nOpId != GDB_ID_NULL) { + int nType = m_pMchMgr->GetOperationType( nOpId) ; + if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) { + m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ; + std::string sErr = "Warning on Key (MKC/AMO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ; + } + } + + // emetto info di log + { string sOut = "Estimator Run : " + sCncFile ; + LOG_INFO( GetEMkLogger(), sOut.c_str()) ; } + + // cancello l'eventuale file di uscita (e anche il file errore) + EraseFile( sCncFile) ; + string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; + EraseFile( sErrFile) ; + + // lancio il processore + bool bOk = Processor::Run( sCncFile, sInfo) ; + + // in caso di errore rinomino il file di output + if ( ! bOk) + RenameFile( sCncFile, sErrFile) ; + + return bOk ; + } // cancello l'eventuale file di uscita (e anche il file errore) EraseFile( sCncFile) ; string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; EraseFile( sErrFile) ; - // lancio il processore - bool bOk = Processor::Run( sCncFile, sInfo) ; - - // in caso di errore rinomino il file di output - if ( ! bOk) - RenameFile( sCncFile, sErrFile) ; - - return bOk ; + // Generazione non abilitata + m_pMchMgr->SetLastError( 1000, "NC_OFF") ; + std::string sErr = "Warning on Key (MKC/KYO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; } //---------------------------------------------------------------------------- diff --git a/Generator.cpp b/Generator.cpp index 3dc0a58..85d4e4a 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -17,9 +17,10 @@ #include "Generator.h" #include "MachMgr.h" #include "OutputConst.h" -#include "/EgtDev/Include/EMkDllMain.h" #include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnGetKeyData.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" using namespace std ; @@ -66,12 +67,30 @@ Generator::Run( const string& sCncFile, const string& sInfo) bool bKey = false ; if ( nRet == KEY_OK) bKey = true ; - bool bOption = false ; - if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) - bOption = true ; + bool bNcOff = false ; + if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 1) + bNcOff = true ; + bool bAdvMach = false ; + if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + bAdvMach = true ; // Esecuzione - if ( bMinTime && bCurrTime && bKey && bOption) { + if ( bMinTime && bCurrTime && bKey && ! bNcOff) { + + // se non previste lavorazioni avanzate, verifico la loro assenza + if ( ! bAdvMach) { + int nOpId = m_pMchMgr->GetFirstActiveOperation() ; + while ( nOpId != GDB_ID_NULL) { + int nType = m_pMchMgr->GetOperationType( nOpId) ; + if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) { + m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ; + std::string sErr = "Warning on Key (MKC/AMO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ; + } + } // emetto info di log { string sOut = "Generator Run : " + sCncFile ; @@ -99,7 +118,7 @@ Generator::Run( const string& sCncFile, const string& sInfo) // Generazione non abilitata m_pMchMgr->SetLastError( 1000, "NC_OFF") ; - std::string sErr = "Warning on Key (MKC/NCO)" ; + std::string sErr = ( bNcOff ? "Warning on Key (MKC/NCO)" : "Warning on Key (MKC/KYO)") ; LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; return false ; } diff --git a/SimulatorMP.cpp b/SimulatorMP.cpp index 9b6170f..80bef6a 100644 --- a/SimulatorMP.cpp +++ b/SimulatorMP.cpp @@ -34,8 +34,11 @@ #include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EMkToolConst.h" #include "/EgtDev/Include/EMkOperationConst.h" +#include "/EgtDev/Include/EGnGetKeyData.h" #include "/EgtDev/Include/EgtPerfCounter.h" #include "/EgtDev/Include/EgtNumUtils.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" using namespace std ; @@ -145,6 +148,51 @@ SimulatorMP::Start( bool bFirst) m_pMchMgr->ResetLastError() ; m_pMchMgr->ResetWarnings() ; + // Se appena entrati, verifico abilitazioni + if ( m_nStatus == SIS_INITIALIZED) { + // Controllo della licenza + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( ! GetEMkNetHwKey()) + nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + + // Verifica della abilitazione + bool bMinTime = false ; + if ( nOptExpDays >= GetMinDay()) + bMinTime = true ; + bool bCurrTime = false ; + if ( nOptExpDays >= GetCurrDay()) + bCurrTime = true ; + bool bKey = false ; + if ( nRet == KEY_OK) + bKey = true ; + bool bAdvMach = false ; + if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + bAdvMach = true ; + if ( ! bMinTime || ! bCurrTime || ! bKey) { + m_pMchMgr->SetLastError( 1000, "NC_OFF") ; + std::string sErr = "Warning on Key (MKC/KYO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + if ( ! bAdvMach) { + int nOpId = m_pMchMgr->GetFirstActiveOperation() ; + while ( nOpId != GDB_ID_NULL) { + int nType = m_pMchMgr->GetOperationType( nOpId) ; + if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) { + m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ; + std::string sErr = "Warning on Key (MKC/AMO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ; + } + } + } + bool bOk = true ; // Se appena entrati in simulazione diff --git a/SimulatorSP.cpp b/SimulatorSP.cpp index a644e17..9030ea1 100644 --- a/SimulatorSP.cpp +++ b/SimulatorSP.cpp @@ -35,8 +35,11 @@ #include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EMkToolConst.h" #include "/EgtDev/Include/EMkOperationConst.h" +#include "/EgtDev/Include/EGnGetKeyData.h" #include "/EgtDev/Include/EgtPerfCounter.h" #include "/EgtDev/Include/EgtNumUtils.h" +#include "/EgtDev/Include/EgtKeyCodes.h" +#include "/EgtDev/Include/SELkKeyProc.h" using namespace std ; @@ -142,6 +145,51 @@ SimulatorSP::Start( bool bFirst) m_pMchMgr->ResetLastError() ; m_pMchMgr->ResetWarnings() ; + // Se appena entrati, verifico abilitazioni + if ( m_nStatus == SIS_INITIALIZED) { + // Controllo della licenza + unsigned int nOpt1, nOpt2 ; + int nOptExpDays ; + int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + if ( ! GetEMkNetHwKey()) + nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, + nOpt1, nOpt2, nOptExpDays) ; + + // Verifica della abilitazione + bool bMinTime = false ; + if ( nOptExpDays >= GetMinDay()) + bMinTime = true ; + bool bCurrTime = false ; + if ( nOptExpDays >= GetCurrDay()) + bCurrTime = true ; + bool bKey = false ; + if ( nRet == KEY_OK) + bKey = true ; + bool bAdvMach = false ; + if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + bAdvMach = true ; + if ( ! bMinTime || ! bCurrTime || ! bKey) { + m_pMchMgr->SetLastError( 1000, "NC_OFF") ; + std::string sErr = "Warning on Key (MKC/KYO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + if ( ! bAdvMach) { + int nOpId = m_pMchMgr->GetFirstActiveOperation() ; + while ( nOpId != GDB_ID_NULL) { + int nType = m_pMchMgr->GetOperationType( nOpId) ; + if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) { + m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ; + std::string sErr = "Warning on Key (MKC/AMO)" ; + LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; + return false ; + } + nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ; + } + } + } + bool bOk = true ; // Se appena entrati in simulazione From 93598217a42644d0d2be72e327848fea75a8bee2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 2 Oct 2024 09:00:54 +0200 Subject: [PATCH 2/3] =?UTF-8?q?EgtMachKernel=202.6j1=20:=20-=20foro=20con?= =?UTF-8?q?=20profondit=C3=A0=20non=20nulla=20ma=20con=20MaxElev=3D0;=20or?= =?UTF-8?q?a=20viene=20lavorato=20lo=20stesso.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drilling.cpp | 2 +- EgtMachKernel.rc | Bin 11774 -> 11782 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Drilling.cpp b/Drilling.cpp index 720ad98..0aaa5f0 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -1650,7 +1650,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) { dElev = dMaxElev ; hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ; - hole.dLen = dElev ; + hole.dLen = ( hole.dLen > 10 * EPS_SMALL ? max( dElev, 10 * EPS_SMALL) : dElev) ; } // limito lunghezza foro a massima lavorazione della punta double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 7c07ad05178f2203246f881c9d0b7e45fdbe76a4..f9f561e4a2946a2623092e00829b059a9e0834f8 100644 GIT binary patch delta 129 zcmewt-4?Uq8ymYJg8_pMgW=}iY}U-oSqz4gA4=+OPUGrfL6W)1H2H*J9zs?KMHWS$ T2jk{d(k{&SG=r2Vhj0M^?&c=# delta 121 zcmZpR`4_$68yl-7gARl7=D%##%*>e##*-a|bvI`TxiM~D$L+=pm%PX{`HWy5l7b!< PxEzK?X*?R0=5PZ5xbY+D From ae24d97c6ebd7ae561a0f809e9950637ea6781e1 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 2 Oct 2024 18:03:45 +0200 Subject: [PATCH 3/3] EgtMachKernel : - corretto controllo bit licenza per generazione CN e per lavorazioni avanzate. --- Estimator.cpp | 2 +- Generator.cpp | 4 ++-- SimulatorMP.cpp | 2 +- SimulatorSP.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Estimator.cpp b/Estimator.cpp index 0629fa5..4673c77 100644 --- a/Estimator.cpp +++ b/Estimator.cpp @@ -68,7 +68,7 @@ Estimator::Run( const string& sCncFile, const string& sInfo) if ( nRet == KEY_OK) bKey = true ; bool bAdvMach = false ; - if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0) bAdvMach = true ; // Esecuzione diff --git a/Generator.cpp b/Generator.cpp index 85d4e4a..0b648d9 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -68,10 +68,10 @@ Generator::Run( const string& sCncFile, const string& sInfo) if ( nRet == KEY_OK) bKey = true ; bool bNcOff = false ; - if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 1) + if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) != 0) bNcOff = true ; bool bAdvMach = false ; - if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0) bAdvMach = true ; // Esecuzione diff --git a/SimulatorMP.cpp b/SimulatorMP.cpp index 80bef6a..b8bc50a 100644 --- a/SimulatorMP.cpp +++ b/SimulatorMP.cpp @@ -170,7 +170,7 @@ SimulatorMP::Start( bool bFirst) if ( nRet == KEY_OK) bKey = true ; bool bAdvMach = false ; - if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0) bAdvMach = true ; if ( ! bMinTime || ! bCurrTime || ! bKey) { m_pMchMgr->SetLastError( 1000, "NC_OFF") ; diff --git a/SimulatorSP.cpp b/SimulatorSP.cpp index 9030ea1..81a63e1 100644 --- a/SimulatorSP.cpp +++ b/SimulatorSP.cpp @@ -167,7 +167,7 @@ SimulatorSP::Start( bool bFirst) if ( nRet == KEY_OK) bKey = true ; bool bAdvMach = false ; - if ( ( nOpt1 & KEYOPT_EMK_ADV) == 1) + if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0) bAdvMach = true ; if ( ! bMinTime || ! bCurrTime || ! bKey) { m_pMchMgr->SetLastError( 1000, "NC_OFF") ;