From 01f404b5e2ce3b9eac5c191be0170e27b564b146 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 15 Oct 2020 07:44:28 +0000 Subject: [PATCH] EgtMachKernel 2.2j2 : - aggiunta funzione TdbGetCurrToolThLength in MachMgr. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes MachMgr.h | 1 + MachMgrDBTools.cpp | 12 ++++++++++++ ToolsMgr.cpp | 36 ++++++++++++++++++++++++++++++++++++ ToolsMgr.h | 1 + 5 files changed, 50 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 901bcd576b71197c2c49abd024a6e14eea31fe3c..f4ba8c2454fce87386db3474ae8488218f5bcf92 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx_^ItYwW=5mQj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHP01iS delta 97 zcmZpRX^YwLhmFy2^ItYwW=6xwj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHOf?`f diff --git a/MachMgr.h b/MachMgr.h index 70e492b..9839507 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -182,6 +182,7 @@ class MachMgr : public IMachMgr bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, std::string& sVal) const override ; bool TdbGetCurrToolMaxDepth( double& dMaxDepth) const override ; bool TdbGetCurrToolThDiam( double& dThDiam) const override ; + bool TdbGetCurrToolThLength( double& dThLen) const override ; int TdbCurrToolDraw( int nGenCtx, int nToolCtx) const override ; bool TdbReload( void) override ; bool TdbSave( void) const override ; diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp index 97adf52..488c6dc 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -383,6 +383,18 @@ MachMgr::TdbGetCurrToolThDiam( double& dThDiam) const return pTsMgr->GetCurrToolThDiam( dThDiam) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::TdbGetCurrToolThLength( double& dThLen) const +{ + // recupero il gestore di utensili della macchina corrente + ToolsMgr* pTsMgr = GetCurrToolsMgr() ; + if ( pTsMgr == nullptr) + return false ; + // recupero la lunghezza del portautensili + return pTsMgr->GetCurrToolThLength( dThLen) ; +} + //---------------------------------------------------------------------------- int MachMgr::TdbCurrToolDraw( int nGenCtx, int nToolCtx) const diff --git a/ToolsMgr.cpp b/ToolsMgr.cpp index a2d2eb4..cde8266 100644 --- a/ToolsMgr.cpp +++ b/ToolsMgr.cpp @@ -750,3 +750,39 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const return false ; } + +//---------------------------------------------------------------------------- +bool +ToolsMgr::GetCurrToolThLength( double& dThLen) const +{ + // verifico esistenza utensile corrente + if ( ! m_bCurrTool) + return false ; + + // se punta a forare, lama, fresa o scalpello + if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 || + ( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 || + ( m_tdCurrTool.m_nType & TF_MILL) != 0 || + ( m_tdCurrTool.m_nType & TF_CHISEL) != 0) { + // recupero le dimensioni del porta utensili + double dTHoldLen = 0 ; + double dTHoldDiam = 0 ; + if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) || + ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) { + (const_cast(this))->SaveCurrTool() ; + Save() ; + GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ; + GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ; + } + dThLen = dTHoldLen ; + return true ; + } + // se mortasatrice/sega a catena o waterjet + else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 || + ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) { + dThLen = 0 ; + return true ; + } + + return false ; +} diff --git a/ToolsMgr.h b/ToolsMgr.h index de5e300..b8aa1e6 100644 --- a/ToolsMgr.h +++ b/ToolsMgr.h @@ -58,6 +58,7 @@ class ToolsMgr template bool GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const ; bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ; bool GetCurrToolThDiam( double& dThDiam) const ; + bool GetCurrToolThLength( double& dThLen) const ; const ToolData* GetCurrTool(void) const { return (m_bCurrTool ? &m_tdCurrTool : nullptr) ; }