From 577143d176cfdbabd2d6147b3b18173ec54eae4d Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 18 May 2023 18:34:34 +0200 Subject: [PATCH 1/5] EgtMachKernel 2.5e2 : - correzione a Disposizione per gestire correttamente errori in casi senza testa equivalente. --- Disposition.cpp | 3 ++- EgtMachKernel.rc | Bin 11774 -> 11774 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Disposition.cpp b/Disposition.cpp index 0984588..ed8e763 100644 --- a/Disposition.cpp +++ b/Disposition.cpp @@ -1353,7 +1353,8 @@ Disposition::SpecialApply( bool bRecalc) bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ; // segnalo errori ed esco if ( ! bOk || nErr > 0) { - m_nShifts = -2 ; + if ( m_nShifts != -1) + m_nShifts = -2 ; string sOut = sMsg ; if ( IsEmptyOrSpaces( sOut)) sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index a6bbd633828b6f5d28b036fd956482c3f066b1b9..10f317c94ae1e98603c6faf3fd3ae68b35807fb6 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 delta 97 zcmewt{V#gMFE&QQ&A-`fnHdcyKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU3rBY*$^ From 90dbb068a937a0954c027a174238bc9c76f26cbc Mon Sep 17 00:00:00 2001 From: DarioS Date: Sat, 20 May 2023 12:04:46 +0200 Subject: [PATCH 2/5] EgtMachKernel 2.5e3 : - correzzioni a svuotature ottimizzate per attacchi e sucite sui lati aperti (distanze). --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Pocketing.cpp | 25 +++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 10f317c94ae1e98603c6faf3fd3ae68b35807fb6..65d26402cbc840a08dc648810ac6238d836c5f20 100644 GIT binary patch delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 diff --git a/Pocketing.cpp b/Pocketing.cpp index fc31696..3f76a8d 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -4562,14 +4562,22 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC } } - // se il lato opposto a quello di riferimento è chiuso ha senso aggiungere solo se il punto è sotto la linea di svuotatura + // se il lato opposto a quello di riferimento è chiuso bisogna distinguere i casi else { if ( ptP2.y < dYCoord) { pCompo->AddPoint( ptP2) ; - Point3d ptCrv ; - pMCrv->GetStartPoint( ptCrv) ; - pCompo->AddLine( ptCrv) ; } + else { + Vector3d vtDir ; + pLine->GetStartDir( vtDir) ; + if ( bStart) + vtDir.Invert() ; + Point3d ptP2N = ptP2 - m_TParams.m_dDiam / 2 * abs( vtDir.x / vtDir.y) * vtDir ; + pCompo->AddPoint( ptP2N) ; + } + Point3d ptCrv ; + pMCrv->GetStartPoint( ptCrv) ; + pCompo->AddLine( ptCrv) ; } // setto temp prop per ricordare che è curva aggiuntiva per pulire angoli @@ -4743,13 +4751,18 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V Vector3d vtNorm ; if ( ! CalcDistanceFromRawSurface( m_nPhase, ptP, vtDirP, dDist, vtNorm)) return false ; + if ( abs( dDist) < EPS_SMALL) { + ptP -= vtDirP ; + if ( ! CalcDistanceFromRawSurface( m_nPhase, ptP, vtDirP, dDist, vtNorm)) + return false ; + } - // calcolo eventuali fattori correttivi + // calcolo eventuali fattori correttivi (se uscita approx. con fianco utensile) double dCorr = 1 ; double dDistRef = dDist ; double dDistMin ; Vector3d vtNormMin ; - if ( CalcDistanceFromRawSurface( m_nPhase, ptP, vtNorm, dDistMin, vtNormMin)) { + if ( abs( vtTool * vtNorm) < 0.5 && CalcDistanceFromRawSurface( m_nPhase, ptP, vtNorm, dDistMin, vtNormMin)) { if ( abs( dDistMin) < abs( dDist) && abs( dDistMin) > EPS_SMALL) { dDistRef = dDistMin ; dCorr = dDist / dDistMin ; From 8f7fdc3a807dac511dd782c5e4eff8d0fa79281a Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 26 May 2023 08:43:48 +0200 Subject: [PATCH 3/5] EgtMachKernel 2.5e4 : - negli angoli macchina suggeriti ora si tiene conto di Invert e di Offset (quindi per l'utente sono i valori che vede in simulazione e sul CN). --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Machine.h | 2 ++ MachineCalc.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Operation.cpp | 11 ++++++++++- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 65d26402cbc840a08dc648810ac6238d836c5f20..d48143ef5f4177eb263885932e978ab7cebcf4e8 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P#&A-`fnHfzcKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUI`BbWdH delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 diff --git a/Machine.h b/Machine.h index 116cbba..2a19ccd 100644 --- a/Machine.h +++ b/Machine.h @@ -125,6 +125,8 @@ class Machine bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ; bool GetCurrAxisMin( int nInd, double& dMin) const ; bool GetCurrAxisMax( int nInd, double& dMax) const ; + bool GetCurrAxisOffset( int nInd, double& dOffset) const ; + bool GetCurrAxisInvert( int nInd, bool& bInvert) const ; bool GetCurrAxisHomePos( int nInd, double& dHome) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; const Frame3d& GetCurrLinAxesFrame( void) const diff --git a/MachineCalc.cpp b/MachineCalc.cpp index ff32903..6f6b963 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1827,6 +1827,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const return false ; } +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisOffset( int nInd, double& dOffset) const +{ + int nLinAxes = int( m_vCalcLinAx.size()) ; + int nRotAxes = int( m_vCalcRotAx.size()) ; + if ( nInd >= 0 && nInd < nLinAxes) { + Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ; + if ( pAx == nullptr) + return false ; + dOffset = pAx->GetOffset() ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + dOffset = pAx->GetOffset() ; + return true ; + } + return false ; +} + +//---------------------------------------------------------------------------- +bool +Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const +{ + int nLinAxes = int( m_vCalcLinAx.size()) ; + int nRotAxes = int( m_vCalcRotAx.size()) ; + if ( nInd >= 0 && nInd < nLinAxes) { + Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ; + if ( pAx == nullptr) + return false ; + bInvert = pAx->GetInvert() ; + return true ; + } + else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) { + Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ; + if ( pAx == nullptr) + return false ; + bInvert = pAx->GetInvert() ; + return true ; + } + return false ; +} + //---------------------------------------------------------------------------- bool Machine::GetCurrAxisHomePos( int nInd, double& dHome) const diff --git a/Operation.cpp b/Operation.cpp index fbe724b..b43de94 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1632,8 +1632,17 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) && szKey == Trim( sAxToken)) { double dVal ; - if ( FromString( szVal, dVal)) + if ( FromString( szVal, dVal)) { + double dOffset = 0 ; + m_pMchMgr->GetCurrMachine()->GetCurrAxisOffset( nLinAxes + i, dOffset) ; + if ( abs( dOffset) > EPS_ANG_SMALL) + dVal -= dOffset ; + bool bInvert = false ; + m_pMchMgr->GetCurrMachine()->GetCurrAxisInvert( nLinAxes + i, bInvert) ; + if ( bInvert) + dVal = -dVal ; vAxRotPrec[i] = dVal ; + } break ; } } From 05a6f56cfe3a2c7f027e6e54110a652a71481339 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 29 May 2023 15:53:50 +0200 Subject: [PATCH 4/5] EgtMachKernel 2.5e5 : - in fresatura modifiche a retrazione di frese NoTip e lame per allontanarsi quanto necessario dal pezzo in tutti i casi. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Milling.cpp | 20 +++++++++++++++----- Milling.h | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index d48143ef5f4177eb263885932e978ab7cebcf4e8..a683cea58ef91fdc734591995610349dd386a01a 100644 GIT binary patch delta 97 zcmewt{V#gMFE&Qg&A-`fnHfzdKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUO4BcK2P delta 97 zcmewt{V#gMFE&P#&A-`fnHfzcKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUI`BbWdH diff --git a/Milling.cpp b/Milling.cpp index e76cdcb..a03406a 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -2569,7 +2569,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo bOk = false ; } // aggiungo opportuna retrazione - if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) { + if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) { m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ; return false ; } @@ -2915,7 +2915,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool bOk = false ; } // aggiungo opportuna retrazione - if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) { + if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) { m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ; return false ; } @@ -3377,7 +3377,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool bOk = false ; } // aggiungo opportuna retrazione - if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) { + if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) { m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ; return false ; } @@ -4196,7 +4196,8 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, //---------------------------------------------------------------------------- bool -Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) +Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool, + double dSafeZ, double dEndElev, double dAppr) { // per retrazione orizzontale vtAppr deve essere già stato sistemato dal chiamante // se sopra uscita c'è spazio per sicurezza o approccio @@ -4217,7 +4218,16 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, dou return false ; } // 4b -> movimento di risalita sopra il punto finale - Point3d ptP4b = ptP4a + vtRetr * ( dSafeZ - dAppr) ; + Vector3d vtMove = vtRetr ; + double dMove = dSafeZ - dAppr ; + if ( ! m_bTiltingTab && vtRetr.z < sin( -ANG_RIGHT / 2)) { + vtMove = Vector3d( vtTool.x, vtTool.y, 0) ; + if ( vtMove.Normalize()) + dMove = dSafeZ ; + else + vtMove = vtRetr ; + } + Point3d ptP4b = ptP4a + vtMove * dMove ; if ( AddRapidMove( ptP4b) == GDB_ID_NULL) return false ; } diff --git a/Milling.h b/Milling.h index 6494654..686c233 100644 --- a/Milling.h +++ b/Milling.h @@ -102,7 +102,8 @@ class Milling : public Machining bool AddDirectApproach( const Point3d& ptP) ; bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, double dElev, double dAppr, bool bAboveEnd) ; - bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ; + bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool, + double dSafeZ, double dEndElev, double dAppr) ; bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ; bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, From df86ffdee340b33c359d7e6b57598a70c1a1c006 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 30 May 2023 10:29:13 +0200 Subject: [PATCH 5/5] EgtMachKernel : - migliorato controllo gestione chiave di rete. --- Generator.cpp | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/Generator.cpp b/Generator.cpp index 8457ed1..264d683 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -19,6 +19,7 @@ #include "OutputConst.h" #include "/EgtDev/Include/EMkDllMain.h" #include "/EgtDev/Include/EGnFileUtils.h" +#include "/EgtDev/Include/EGnGetKeyData.h" using namespace std ; @@ -46,19 +47,31 @@ Generator::Init( MachMgr* pMchMgr) bool Generator::Run( const string& sCncFile, const string& sInfo) { - // verifico sia abilitato dalla licenza - bool bEnabled = false ; - if ( GetEMkNetHwKey()) { - bEnabled = true ; - } - else { - unsigned int nOpt1, nOpt2 ; - int nOptExpDays ; + // 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()) int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, nOpt1, nOpt2, nOptExpDays) ; - bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ; - } - if ( bEnabled) { + + // 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 bOption = false ; + if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) + bOption = true ; + + // Esecuzione + if ( bMinTime && bCurrTime && bKey && bOption) { // emetto info di log { string sOut = "Generator Run : " + sCncFile ; @@ -79,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo) return bOk ; } + // cancello l'eventuale file di uscita (e anche il file errore) + EraseFile( sCncFile) ; + string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; + EraseFile( sErrFile) ; + // Generazione non abilitata m_pMchMgr->SetLastError( 1000, "NC_OFF") ; std::string sErr = "Warning on Key (MKC/NCO)" ;