From 61948d3409b35195e4b49af58f2b261a6b1893f2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 17 Aug 2020 15:56:14 +0000 Subject: [PATCH] EgtMachKernel 2.2h2 : - aggiunte in interfaccia MachMgr le funzioni GetAxisMin e GetAxisMax - in Generazione e Simulazione ai dati utensili attrezzati aggiunto flag per indicare se utilizzato nel programma di lavoro. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachMgr.h | 7 +++++-- MachMgrMachines.cpp | 16 ++++++++++++++++ Machine.h | 2 ++ MachineAxes.cpp | 32 ++++++++++++++++++++++++++++++++ OutputConst.h | 1 + Processor.cpp | 14 +++++++++++--- 7 files changed, 67 insertions(+), 5 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 2d45c5082583919fb2bc41f84a9b0891670dbd5c..0af146ef161273ca5318852aa5c63246a3b7ba73 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*$^ diff --git a/MachMgr.h b/MachMgr.h index c339841..4f14980 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -1,13 +1,14 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2019 +// EgalTech 2015-2020 //---------------------------------------------------------------------------- -// File : MachMgr.h Data : 16.05.19 Versione : 2.1e3 +// File : MachMgr.h Data : 17.08.20 Versione : 2.2h2 // Contenuto : Dichiarazione della classe MachMgr. // // // // Modifiche : 23.03.15 DS Creazione modulo. // 16.05.19 DS Aggiunto parametro sToolMakersDir a Init. +// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax. // //---------------------------------------------------------------------------- @@ -338,6 +339,8 @@ class MachMgr : public IMachMgr bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ; bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ; bool GetAxisPos( const std::string& sAxis, double& dVal) const override ; + bool GetAxisMin( const std::string& sAxis, double& dMin) const override ; + bool GetAxisMax( const std::string& sAxis, double& dMaxn) const override ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const override ; bool ResetAxisPos( const std::string& sAxis) override ; bool ResetAllAxesPos( void) override ; diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp index 6c5c9f8..9ef0f5b 100644 --- a/MachMgrMachines.cpp +++ b/MachMgrMachines.cpp @@ -303,6 +303,22 @@ MachMgr::GetAxisPos( const string& sAxis, double& dVal) const return ( ( pMch != nullptr) ? pMch->GetAxisPos( sAxis, dVal) : false) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::GetAxisMin( const string& sAxis, double& dMin) const +{ + Machine* pMch = GetCurrMachine() ; + return ( ( pMch != nullptr) ? pMch->GetAxisHomePos( sAxis, dMin) : false) ; +} + +//---------------------------------------------------------------------------- +bool +MachMgr::GetAxisMax( const string& sAxis, double& dMax) const +{ + Machine* pMch = GetCurrMachine() ; + return ( ( pMch != nullptr) ? pMch->GetAxisHomePos( sAxis, dMax) : false) ; +} + //---------------------------------------------------------------------------- bool MachMgr::GetAxisHomePos( const string& sAxis, double& dHomeVal) const diff --git a/Machine.h b/Machine.h index 097e6e5..38528c4 100644 --- a/Machine.h +++ b/Machine.h @@ -78,6 +78,8 @@ class Machine bool GetAxisType( const std::string& sAxis, bool& bLinear) const ; bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ; bool GetAxisPos( const std::string& sAxis, double& dVal) const ; + bool GetAxisMin( const std::string& sAxis, double& dMin) const ; + bool GetAxisMax( const std::string& sAxis, double& dMax) const ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ; bool ResetAxisPos( const std::string& sAxis) ; bool ResetAllAxesPos( void) ; diff --git a/MachineAxes.cpp b/MachineAxes.cpp index d81e5e9..2272e3c 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -130,6 +130,38 @@ Machine::GetAxisPos( const string& sAxis, double& dVal) const return true ; } +//---------------------------------------------------------------------------- +bool +Machine::GetAxisMin( const string& sAxis, double& dMin) const +{ + // controllo GeomDB + if ( m_pGeomDB == nullptr) + return false ; + // recupero il gestore dell'asse + Axis* pAx = GetAxis( GetGroup( sAxis)) ; + if ( pAx == nullptr) + return false ; + // recupero il minimo + dMin = pAx->GetStroke().Min ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +Machine::GetAxisMax( const string& sAxis, double& dMax) const +{ + // controllo GeomDB + if ( m_pGeomDB == nullptr) + return false ; + // recupero il gestore dell'asse + Axis* pAx = GetAxis( GetGroup( sAxis)) ; + if ( pAx == nullptr) + return false ; + // recupero il massimo + dMax = pAx->GetStroke().Max ; + return true ; +} + //---------------------------------------------------------------------------- bool Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const diff --git a/OutputConst.h b/OutputConst.h index f241181..26dc4a7 100644 --- a/OutputConst.h +++ b/OutputConst.h @@ -65,6 +65,7 @@ static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro u static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile +static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile diff --git a/Processor.cpp b/Processor.cpp index 9c2d04b..99ea2b6 100644 --- a/Processor.cpp +++ b/Processor.cpp @@ -643,9 +643,9 @@ Processor::ProcessToolData( void) // se definito attrezzaggio if ( m_pMchMgr->GetCurrSetupMgr().Exists()) { // verifico che tutti gli utensili siano attrezzati - for ( size_t i = 0 ; i < vTdata.size() ; ++ i) { - if ( ! m_pMchMgr->GetCurrSetupMgr().FindTool( vTdata[i].sName)) { - string sErr = "Error : " + vTdata[i].sName + " missing in setup " ; + for ( const auto& tData : vTdata) { + if ( ! m_pMchMgr->GetCurrSetupMgr().FindTool( tData.sName)) { + string sErr = "Error : " + tData.sName + " missing in setup " ; LOG_ERROR( GetEMkLogger(), sErr.c_str()) bOk = false ; } @@ -676,6 +676,14 @@ Processor::ProcessToolData( void) bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, dTLen) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, dMaxSpeed) ; } + bool bUsed = false ; + for ( const auto& tData : vTdata) { + if ( EqualNoCase( sTool, tData.sName)) { + bUsed = true ; + break ; + } + } + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TUSED, bUsed) ; // chiamo la funzione di emissione dati utensile bOk = bOk && CallOnToolData() ; }