From 6065c07c98aa7a22d7f655d8cc4a24c178617438 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 2 Jul 2016 15:02:23 +0000 Subject: [PATCH] EgtMachKernel 1.6s2 : - aggiunta funzione TdbGetToolFromUUID per avere nome utensile da UUID - aggiunta funzione GetTable per avere nome tavola corrente. --- EgtMachKernel.rc | Bin 11798 -> 11782 bytes MachMgr.h | 2 ++ MachMgrDBTools.cpp | 21 +++++++++++++++++++++ MachMgrFixtures.cpp | 12 ++++++++++++ 4 files changed, 35 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 06a3dd4762e40b598bc7ba9548874e3689861331..245372000a47b90c478509089247e142fdfd55a7 100644 GIT binary patch delta 126 zcmbOh(-yPg2OFy;gARkyW=8&tOp`BgW-%8t7)^E*(cPTG)yD#tvu8#UcVpbVL)e2E WE{UPhgK_g7X*YxdblnG(!?*yGd?9E6 delta 137 zcmZpRnHIC*2OGNugARisgW=}CY}U-IMIh#6M`7K~Swe1%o7ZuBFe53r$TazkU>=I1 RJ{BZ-ECxsuFhFSzHvkrCB{Bd2 diff --git a/MachMgr.h b/MachMgr.h index 0dd535c..9ccd806 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -117,6 +117,7 @@ class MachMgr : public IMachMgr bool RotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) override ; // Tables and Fixtures bool SetTable( const std::string& sTable) override ; + bool GetTable( std::string& sTable) override ; bool GetTableRef( int nInd, Point3d& ptPos) override ; bool GetTableArea( int nInd, BBox3d& b3Area) override ; int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg) override ; @@ -130,6 +131,7 @@ class MachMgr : public IMachMgr bool TdbRemoveTool( const std::string& sName) override ; bool TdbGetFirstTool( int nFamily, std::string& sName, int& nType) const override ; bool TdbGetNextTool( int nFamily, std::string& sName, int& nType) const override ; + bool TdbGetToolFromUUID( const std::string& sTuuid, std::string& sName) const override ; bool TdbSetCurrTool( const std::string& sName) override ; bool TdbSaveCurrTool( void) override ; bool TdbIsCurrToolModified( void) const override ; diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp index 109eb58..0dbd6cc 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -90,6 +90,27 @@ MachMgr::TdbGetNextTool( int nFamily, string& sName, int& nType) const return pTsMgr->GetNextTool( nFamily, sName, nType) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::TdbGetToolFromUUID( const string& sTuuid, string& sName) const +{ + // pulisco il parametro di ritorno + sName.clear() ; + // recupero il gestore di utensili della macchina corrente + ToolsMgr* pTsMgr = GetCurrToolsMgr() ; + if ( pTsMgr == nullptr) + return false ; + // cerco l'utensile con l'UUID, se trovato ne restituisco il nome + EgtUUID Tuuid ; + if ( ! FromString( sTuuid, Tuuid)) + return false ; + const ToolData* pTdata = pTsMgr->GetTool( Tuuid) ; + if ( pTdata == nullptr) + return false ; + sName = pTdata->m_sName ; + return true ; +} + //---------------------------------------------------------------------------- bool MachMgr::TdbSetCurrTool( const string& sName) diff --git a/MachMgrFixtures.cpp b/MachMgrFixtures.cpp index 00ac2ea..409bcca 100644 --- a/MachMgrFixtures.cpp +++ b/MachMgrFixtures.cpp @@ -32,6 +32,18 @@ MachMgr::SetTable( const string& sTable) return ( pDisp != nullptr && pDisp->SetTable( sTable)) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::GetTable( string& sTable) +{ + // recupero la prima operazione, deve essere la prima disposizione + Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetFirstOperation())) ; + if ( pDisp == nullptr) + return false ; + // recupero la tavola + return pDisp->GetTable( sTable) ; +} + //---------------------------------------------------------------------------- bool MachMgr::GetTableRef( int nInd, Point3d& ptPos)