diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 5b68460..0a6da7e 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Head.cpp b/Head.cpp index 81fa5f6..e8448bf 100644 --- a/Head.cpp +++ b/Head.cpp @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2017 //---------------------------------------------------------------------------- -// File : Head.cpp Data : 25.05.15 Versione : 1.6e7 +// File : Head.cpp Data : 11.01.17 Versione : 1.6x6 // Contenuto : Oggetto testa per gruppo testa di macchina. // // // // Modifiche : 25.05.15 DS Creazione modulo. -// +// 11.01.17 DS Aggiunto contatore uscite. // //---------------------------------------------------------------------------- @@ -45,6 +45,7 @@ Head::Clone( void) const pHead->m_pGeomDB = nullptr ; pHead->m_sName = m_sName ; pHead->m_nType = m_nType ; + pHead->m_nExitCount = m_nExitCount ; pHead->m_vsHSet = m_vsHSet ; pHead->m_vtADir = m_vtADir ; pHead->m_dRot1W = m_dRot1W ; @@ -68,6 +69,7 @@ Head::Dump( string& sOut, bool bMM, const char* szNewLine) const sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ; sOut += "Name=" + m_sName + szNewLine ; sOut += "Type=" + ToString( m_nType) + szNewLine ; + sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ; sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ; sOut += "ADir=" + ToString( m_vtADir) + szNewLine ; return true ; @@ -99,7 +101,7 @@ Head::GetGeomDB( void) const //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- Head::Head( void) - : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), + : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0), m_dRot1W( 1), m_nSolCh( MCH_SCC_NONE) { m_Rot2Stroke.Min = - INFINITO ; @@ -108,11 +110,15 @@ Head::Head( void) //---------------------------------------------------------------------------- bool -Head::Set( const string& sName, int nType, const string& sHSet, const Vector3d& vtADir, +Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir, double dRot1W, const STROKE& Rot2Stroke, int nSolCh) { m_sName = sName ; m_nType = nType ; + if ( m_nType == MCH_HT_MULTI) + m_nExitCount = nExitCount ; + else + m_nExitCount = 1 ; m_vsHSet.clear() ; m_vsHSet.push_back( sHSet) ; m_vtADir = vtADir ; diff --git a/Head.h b/Head.h index ad4bf7c..8f4a075 100644 --- a/Head.h +++ b/Head.h @@ -30,13 +30,15 @@ class Head : public IUserObj public : Head( void) ; - bool Set( const std::string& sName, int nType, const std::string& sHSet, const Vector3d& vtADir, - double dRot1W, const STROKE& Rot2Stroke, int nSolCh) ; + bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, + const Vector3d& vtADir, double dRot1W, const STROKE& Rot2Stroke, int nSolCh) ; bool AddHeadToHSet( const std::string& sHead) ; const std::string& GetName( void) { return m_sName ; } int GetType( void) { return m_nType ; } + int GetExitCount( void) + { return m_nExitCount ; } const STRVECTOR& GetHSet(void) { return m_vsHSet ; } const Vector3d& GetADir( void) @@ -53,6 +55,7 @@ class Head : public IUserObj IGeomDB* m_pGeomDB ; std::string m_sName ; int m_nType ; + int m_nExitCount ; STRVECTOR m_vsHSet ; Vector3d m_vtADir ; double m_dRot1W ; diff --git a/MachMgr.h b/MachMgr.h index 2f33f60..23fe7e6 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -277,6 +277,7 @@ class MachMgr : public IMachMgr int GetTableId( const std::string& sTable) const override ; int GetAxisId( const std::string& sAxis) const override ; int GetHeadId( const std::string& sHead) const override ; + int GetHeadExitCount( const std::string& sHead) const override ; bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ; bool SetAxisPos( const std::string& sAxis, double dVal) override ; bool GetAxisPos( const std::string& sAxis, double& dVal) const override ; diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp index 89b8ff3..920fcf0 100644 --- a/MachMgrMachines.cpp +++ b/MachMgrMachines.cpp @@ -213,6 +213,15 @@ MachMgr::GetHeadId( const string& sHead) const return ( ( pMch != nullptr) ? pMch->GetHeadId( sHead) : GDB_ID_NULL) ; } +//---------------------------------------------------------------------------- +int +MachMgr::GetHeadExitCount( const string& sHead) const +{ + Machine* pMch = GetCurrMachine() ; + // recupero il numero di uscite della testa + return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ; +} + //---------------------------------------------------------------------------- bool MachMgr::GetAxisToken( const string& sAxis, string& sToken) const diff --git a/Machine.cpp b/Machine.cpp index b5808f4..0ab28e1 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -471,7 +471,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s Head* pHead = new(nothrow) Head ; if ( pHead == nullptr) return false ; - pHead->Set( sName, MCH_HT_STD, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; + pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; m_pGeomDB->SetUserObj( nLay, pHead) ; // aggiorno la testa capostipite if ( ! AddHeadToSet( sHSet, sName)) @@ -520,7 +520,7 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const Head* pHead = new(nothrow) Head ; if ( pHead == nullptr) return false ; - pHead->Set( sName, MCH_HT_MULTI, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; + pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; m_pGeomDB->SetUserObj( nLay, pHead) ; // aggiorno la testa capostipite if ( ! AddHeadToSet( sHSet, sName)) @@ -567,7 +567,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con Head* pHead = new(nothrow) Head ; if ( pHead == nullptr) return false ; - pHead->Set( sName, MCH_HT_SPECIAL, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; + pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh) ; m_pGeomDB->SetUserObj( nLay, pHead) ; // aggiorno la testa capostipite if ( ! AddHeadToSet( sHSet, sName)) diff --git a/Machine.h b/Machine.h index 47949fc..2a86826 100644 --- a/Machine.h +++ b/Machine.h @@ -53,6 +53,7 @@ class Machine { int nId = GetGroup( sHead) ; return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; } bool SetLook( int nFlag) ; + int GetHeadExitCount( const std::string& sHead) const ; bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ; bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ; bool UnloadTool( const string& sHead, int nExit) ; diff --git a/MachineHeads.cpp b/MachineHeads.cpp index c2f5dba..637898c 100644 --- a/MachineHeads.cpp +++ b/MachineHeads.cpp @@ -15,6 +15,7 @@ #include "stdafx.h" #include "MachMgr.h" #include "DllMain.h" +#include "Head.h" #include "Exit.h" #include "/EgtDev/Include/EMkToolConst.h" #include "/EgtDev/Include/EGnStringUtils.h" @@ -22,6 +23,14 @@ using namespace std ; +//---------------------------------------------------------------------------- +int +Machine::GetHeadExitCount( const string& sHead) const +{ + Head* pHead = GetHead( GetGroup( sHead)) ; + return ( ( pHead != nullptr) ? pHead->GetExitCount() : 0) ; +} + //---------------------------------------------------------------------------- bool Machine::LoadTool( const string& sHead, int nExit, const string& sTool)