diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 690a2e1..60d8756 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/MachMgr.h b/MachMgr.h index f84545f..a6d1384 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -171,6 +171,7 @@ class MachMgr : public IMachMgr bool TdbGetCurrToolParam( int nType, double& dVal) const override ; bool TdbGetCurrToolParam( int nType, std::string& sVal) const override ; bool TdbGetCurrToolMaxDepth( double& dMaxDepth) const override ; + bool TdbGetCurrToolThDiam( double& dThDiam) 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 68b26fa..58c89a7 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -263,6 +263,18 @@ MachMgr::TdbGetCurrToolMaxDepth( double& dMaxDepth) const return pTsMgr->GetCurrToolMaxDepth( dSafe, dMaxDepth) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::TdbGetCurrToolThDiam( double& dThDiam) const +{ + // recupero il gestore di utensili della macchina corrente + ToolsMgr* pTsMgr = GetCurrToolsMgr() ; + if ( pTsMgr == nullptr) + return false ; + // recupero il diametro del portautensili + return pTsMgr->GetCurrToolThDiam( dThDiam) ; +} + //---------------------------------------------------------------------------- int MachMgr::TdbCurrToolDraw( int nGenCtx, int nToolCtx) const diff --git a/ToolsMgr.cpp b/ToolsMgr.cpp index e77e998..22d490c 100644 --- a/ToolsMgr.cpp +++ b/ToolsMgr.cpp @@ -714,3 +714,39 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const return false ; } + +//---------------------------------------------------------------------------- +bool +ToolsMgr::GetCurrToolThDiam( double& dThDiam) 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) ; + } + dThDiam = dTHoldDiam ; + 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) { + dThDiam = 0 ; + return true ; + } + + return false ; +} diff --git a/ToolsMgr.h b/ToolsMgr.h index 95b03cd..3541715 100644 --- a/ToolsMgr.h +++ b/ToolsMgr.h @@ -52,6 +52,7 @@ class ToolsMgr bool GetCurrToolParam( int nType, double& dVal) const ; bool GetCurrToolParam( int nType, std::string& sVal) const ; bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ; + bool GetCurrToolThDiam( double& dThDiam) const ; const ToolData* GetCurrTool( void) const { if ( m_bCurrTool) return &m_tdCurrTool ;