diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 901bcd5..f4ba8c2 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ 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) ; }