diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc
index a1b1c5b..cc85d10 100644
Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ
diff --git a/EgtMachKernel.vcxproj b/EgtMachKernel.vcxproj
index b9a776d..1f509dc 100644
--- a/EgtMachKernel.vcxproj
+++ b/EgtMachKernel.vcxproj
@@ -286,6 +286,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
@@ -430,6 +431,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtMachKernel.vcxproj.filters b/EgtMachKernel.vcxproj.filters
index 68c5969..2c3f52e 100644
--- a/EgtMachKernel.vcxproj.filters
+++ b/EgtMachKernel.vcxproj.filters
@@ -231,6 +231,9 @@
Source Files\MachMgr
+
+ Source Files\Machine
+
@@ -659,6 +662,9 @@
Header Files
+
+ Header Files
+
diff --git a/MachMgr.h b/MachMgr.h
index d5a1612..c339841 100644
--- a/MachMgr.h
+++ b/MachMgr.h
@@ -192,6 +192,7 @@ class MachMgr : public IMachMgr
bool ImportSetup( const std::string& sName) override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) override ;
+ bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ;
// Machinings DataBase
@@ -331,6 +332,7 @@ class MachMgr : public IMachMgr
int GetAxisId( const std::string& sAxis) const override ;
int GetHeadId( const std::string& sHead) const override ;
int GetHeadExitCount( const std::string& sHead) const override ;
+ int GetTcPosId( const std::string& sTcPos) const override ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
@@ -339,8 +341,9 @@ class MachMgr : public IMachMgr
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const override ;
bool ResetAxisPos( const std::string& sAxis) override ;
bool ResetAllAxesPos( void) override ;
- bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
bool GetAllTablesNames( STRVECTOR& vNames) const override ;
+ bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
+ bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const override ;
bool UnloadTool( const std::string& sHead, int nExit) override ;
diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp
index 658caad..4416cac 100644
--- a/MachMgrDBTools.cpp
+++ b/MachMgrDBTools.cpp
@@ -568,7 +568,7 @@ MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const
}
// Salvo il disegno
ExeSetCurrentContext( nToolCtx) ;
- bOk = bOk && ExeSaveFile( sDrawPath, GDB_SV_CMPTXT) ;
+ bOk = bOk && ExeSaveFile( sDrawPath, GDB_SV_BIN) ;
// Ripristino il contesto originale
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp
index f6c5d7c..d8b1589 100644
--- a/MachMgrMachines.cpp
+++ b/MachMgrMachines.cpp
@@ -233,6 +233,15 @@ MachMgr::GetHeadExitCount( const string& sHead) const
return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ;
}
+//----------------------------------------------------------------------------
+int
+MachMgr::GetTcPosId( const string& sTcPos) const
+{
+ Machine* pMch = GetCurrMachine() ;
+ // restituisco identificativo della posizione cambio utensile indicata nella macchina corrente
+ return ( ( pMch != nullptr) ? pMch->GetTcPosId( sTcPos) : GDB_ID_NULL) ;
+}
+
//----------------------------------------------------------------------------
bool
MachMgr::GetHeadAbove( const string& sHead) const
@@ -470,6 +479,20 @@ MachMgr::GetCalcRot1W( void) const
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : false) ;
}
+//----------------------------------------------------------------------------
+bool
+MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
+{
+ // pulisco il vettore
+ vNames.clear() ;
+ // recupero la macchina corrente
+ Machine* pMch = GetCurrMachine() ;
+ if ( pMch == nullptr)
+ return false ;
+ // richiedo elenco tavole alla macchina
+ return pMch->GetAllTablesNames( vNames) ;
+}
+
//----------------------------------------------------------------------------
bool
MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
@@ -486,7 +509,7 @@ MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
//----------------------------------------------------------------------------
bool
-MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
+MachMgr::GetAllTcPosNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
@@ -494,8 +517,8 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
- // richiedo elenco tavole alla macchina
- return pMch->GetAllTablesNames( vNames) ;
+ // richiedo elenco posizioni cambio utensile alla macchina
+ return pMch->GetAllTcPosNames( vNames) ;
}
//----------------------------------------------------------------------------
diff --git a/MachMgrSetup.cpp b/MachMgrSetup.cpp
index 90d4d7f..2d4e0c5 100644
--- a/MachMgrSetup.cpp
+++ b/MachMgrSetup.cpp
@@ -119,6 +119,13 @@ MachMgr::FindToolInCurrSetup( const string& sTool)
return m_stuMgr.FindTool( sTool) ;
}
+//----------------------------------------------------------------------------
+bool
+MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
+{
+ return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ;
+}
+
//----------------------------------------------------------------------------
bool
MachMgr::UpdateCurrSetup( void)
diff --git a/Machine.cpp b/Machine.cpp
index 64979dc..4e5f901 100644
--- a/Machine.cpp
+++ b/Machine.cpp
@@ -18,6 +18,7 @@
#include "Table.h"
#include "Axis.h"
#include "Head.h"
+#include "TcPos.h"
#include "Exit.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
@@ -633,6 +634,50 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
return m_mapGroups.emplace( sName, nLay).second ;
}
+//----------------------------------------------------------------------------
+bool
+Machine::LoadMachineTcPos( const string& sName, const string& sParent,
+ const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
+ const string& sGeo, const STRVECTOR& vsAux)
+{
+ // recupero pezzo e layer della geometria originale della posizione nel cambio utensile
+ string sPart, sLay ;
+ Split( sGeo, "/", true, sPart, sLay) ;
+ // cerco il gruppo nella geometria originale
+ int nPart = m_pGeomDB->GetFirstNameInGroup( m_nTempGroupId, sPart) ;
+ int nLay = m_pGeomDB->GetFirstNameInGroup( nPart, sLay) ;
+ if ( nLay == GDB_ID_NULL)
+ return false ;
+ // cerco il gruppo padre per spostarvelo
+ int nParentId = GetGroup( sParent) ;
+ if ( nParentId == GDB_ID_NULL ||
+ ! m_pGeomDB->RelocateGlob( nLay, nParentId, GDB_LAST_SON))
+ return false ;
+ // sistemo lo stato di visualizzazione
+ m_pGeomDB->SetStatus( nLay, GDB_ST_ON) ;
+ // gli assegno il nome
+ m_pGeomDB->SetName( nLay, sName) ;
+ // sistemo la geometria ausiliaria
+ if ( ! AdjustAuxGeometry( vsAux, nLay))
+ return false ;
+ // installo e inizializzo il gestore della posizione nel cambio utensile
+ TcPos* pTcPos = new(nothrow) TcPos ;
+ if ( pTcPos == nullptr)
+ return false ;
+ pTcPos->Set( sName, vtADir) ;
+ m_pGeomDB->SetUserObj( nLay, pTcPos) ;
+ // sistemo il riferimento dell'uscita rispetto alla direzione ausiliaria
+ MUEXITVECTOR vMuExit ;
+ vMuExit.emplace_back( ptPos, vtTDir) ;
+ if ( ! AdjustExitFrames( nLay, vMuExit, vtADir))
+ return false ;
+ // trasformazione del riferimento di uscita in gruppo di uscita
+ if ( ! CreateExitGroups( nLay, vMuExit))
+ return false ;
+ // lo inserisco nel dizionario dei gruppi della macchina
+ return m_mapGroups.emplace( sName, nLay).second ;
+}
+
//----------------------------------------------------------------------------
int
Machine::GetGroup( const string& sGroup) const
@@ -688,6 +733,13 @@ Machine::GetHead( int nGroup) const
return ( dynamic_cast( m_pGeomDB->GetUserObj( nGroup))) ;
}
+//----------------------------------------------------------------------------
+TcPos*
+Machine::GetTcPos( int nGroup) const
+{
+ return ( dynamic_cast( m_pGeomDB->GetUserObj( nGroup))) ;
+}
+
//----------------------------------------------------------------------------
Exit*
Machine::GetExit( int nGroup) const
diff --git a/Machine.h b/Machine.h
index b767fd3..097e6e5 100644
--- a/Machine.h
+++ b/Machine.h
@@ -25,6 +25,7 @@ class MachMgr ;
class Axis ;
class Table ;
class Head ;
+class TcPos ;
class Exit ;
//----------------------------------------------------------------------------
@@ -52,8 +53,12 @@ class Machine
int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
- bool GetAllHeadsNames( STRVECTOR& vNames) const ;
+ int GetTcPosId( const std::string& sTcPos) const
+ { int nId = GetGroup( sTcPos) ;
+ return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
bool GetAllTablesNames( STRVECTOR& vNames) const ;
+ bool GetAllHeadsNames( STRVECTOR& vNames) const ;
+ bool GetAllTcPosNames( STRVECTOR& vNames) const ;
int GetFirstTable( void) const ;
int GetHeadExitCount( const std::string& sHead) const ;
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
@@ -194,6 +199,9 @@ class Machine
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
+ bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
+ const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
+ const std::string& sGeo, const STRVECTOR& vsAux) ;
int GetGroup( const std::string& sGroup) const ;
bool IsBaseGroup( int nGroup) const ;
Axis* GetAxis( int nGroup) const ;
@@ -207,6 +215,9 @@ class Machine
Head* GetHead( int nGroup) const ;
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
+ TcPos* GetTcPos( int nGroup) const ;
+ bool IsTcPosGroup( int nGroup) const
+ { return ( GetTcPos( nGroup) != nullptr) ; }
Exit* GetExit( int nGroup) const ;
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
@@ -288,6 +299,7 @@ class Machine
static int LuaEmtStdHead( lua_State* L) ;
static int LuaEmtMultiHead( lua_State* L) ;
static int LuaEmtSpecialHead( lua_State* L) ;
+ static int LuaEmtTcPos( lua_State* L) ;
static int LuaEmtModifyAxisPosition( lua_State* L) ;
static int LuaEmtModifyAxisDirection( lua_State* L) ;
static int LuaEmtModifyAxisStroke( lua_State* L) ;
diff --git a/MachineHeads.cpp b/MachineHeads.cpp
index 5e6392b..5059b15 100644
--- a/MachineHeads.cpp
+++ b/MachineHeads.cpp
@@ -39,6 +39,22 @@ Machine::GetAllHeadsNames( STRVECTOR& vNames) const
return true ;
}
+//----------------------------------------------------------------------------
+bool
+Machine::GetAllTcPosNames( STRVECTOR& vNames) const
+{
+ // reset lista nomi
+ vNames.clear() ;
+ // ricerca delle posizioni di cambio utensile
+ for ( const auto& snGro : m_mapGroups) {
+ if ( IsTcPosGroup( snGro.second))
+ vNames.push_back( snGro.first) ;
+ }
+ // ordino alfabeticamente
+ sort( vNames.begin(), vNames.end()) ;
+ return true ;
+}
+
//----------------------------------------------------------------------------
int
Machine::GetHeadExitCount( const string& sHead) const
@@ -89,21 +105,38 @@ Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
- // recupero il gruppo della testa
+ // recupero il gruppo dell' oggetto
int nHdGrp = GetGroup( sHead) ;
- if ( ! IsHeadGroup( nHdGrp))
+ // se testa
+ if ( IsHeadGroup( nHdGrp)) {
+ // cerco il gruppo dell'uscita in quello della testa
+ string sExit = MCH_EXIT + ToString( nExit) ;
+ int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
+ Exit* pExit = GetExit( nExGrp) ;
+ if ( pExit == nullptr)
+ return false ;
+ // inserisco l'utensile nell'uscita
+ if ( ! LoadTool( pExit, sTool))
+ return false ;
+ // abilito la testa
+ return EnableHeadInSet( sHead) ;
+ }
+ // se posizione cambio utensile
+ else if ( IsTcPosGroup( nHdGrp)) {
+ // cerco il gruppo dell'uscita in quello della posizione cambio utensile
+ string sExit = MCH_EXIT + ToString( nExit) ;
+ int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
+ Exit* pExit = GetExit( nExGrp) ;
+ if ( pExit == nullptr)
+ return false ;
+ // inserisco l'utensile nell'uscita
+ if ( ! LoadTool( pExit, sTool))
+ return false ;
+ // abilito la posizione cambio utensile
+ return m_pGeomDB->SetStatus( nHdGrp, GDB_ST_ON) ;
+ }
+ // altrimenti errore
return false ;
- // cerco il gruppo dell'uscita in quello della testa
- string sExit = MCH_EXIT + ToString( nExit) ;
- int nExGrp = m_pGeomDB->GetFirstNameInGroup( nHdGrp, sExit) ;
- Exit* pExit = GetExit( nExGrp) ;
- if ( pExit == nullptr)
- return false ;
- // inserisco l'utensile nell'uscita
- if ( ! LoadTool( pExit, sTool))
- return false ;
- // abilito la testa
- return EnableHeadInSet( sHead) ;
}
//----------------------------------------------------------------------------
@@ -192,9 +225,9 @@ Machine::UnloadTool( const string& sHead, int nExit)
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
- // recupero il gruppo della testa
+ // recupero il gruppo della testa o della posizione nel cambio utensili
int nHdGrp = GetGroup( sHead) ;
- if ( ! IsHeadGroup( nHdGrp))
+ if ( ! IsHeadGroup( nHdGrp) && ! IsTcPosGroup( nHdGrp))
return false ;
// cerco il gruppo dell'uscita in quello della testa
string sExit = MCH_EXIT + ToString( nExit) ;
diff --git a/MachineLua.cpp b/MachineLua.cpp
index 9db3f3b..dcddb30 100644
--- a/MachineLua.cpp
+++ b/MachineLua.cpp
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
-// EgalTech 2015-2015
+// EgalTech 2015-2020
//----------------------------------------------------------------------------
-// File : MachineLua.cpp Data : 06.05.15 Versione : 1.6e3
+// File : MachineLua.cpp Data : 26.04.20 Versione : 2.2d4
// Contenuto : Implementazione gestione macchina : funzioni Lua.
//
//
//
// Modifiche : 06.05.15 DS Creazione modulo.
-//
+// 26.04.20 DS Aggiunta gestione TcPos.
//
//----------------------------------------------------------------------------
@@ -87,6 +87,7 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtTable", Machine::LuaEmtTable) ;
m_LuaMgr.RegisterFunction( "EmtAxis", Machine::LuaEmtAxis) ;
m_LuaMgr.RegisterFunction( "EmtHead", Machine::LuaEmtHead) ;
+ m_LuaMgr.RegisterFunction( "EmtTcPos", Machine::LuaEmtTcPos) ;
// registro le funzioni di modifica macchina per lua
m_LuaMgr.RegisterFunction( "EmtModifyAxisPosition", Machine::LuaEmtModifyAxisPosition) ;
m_LuaMgr.RegisterFunction( "EmtModifyAxisDirection", Machine::LuaEmtModifyAxisDirection) ;
@@ -763,6 +764,57 @@ Machine::LuaEmtSpecialHead( lua_State* L)
return 1 ;
}
+//----------------------------------------------------------------------------
+int
+Machine::LuaEmtTcPos( lua_State* L)
+{
+ // Il parametro 1 deve essere una tabella
+ if ( ! lua_istable( L, 1))
+ return luaL_error( L, " Invalid Parameter, required a table") ;
+ // lettura campo 'Name' dalla tabella
+ string sName ;
+ LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
+ // lettura campo 'Parent' dalla tabella
+ string sParent ;
+ LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
+ // lettura campo 'Pos' dalla tabella
+ Point3d ptPos ;
+ LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
+ // lettura campo 'TDir' dalla tabella
+ Vector3d vtTDir ;
+ LuaCheckTabFieldParam( L, 1, FLD_TDIR, vtTDir)
+ // lettura eventuale campo 'ADir' dalla tabella
+ Vector3d vtADir ;
+ LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
+ // lettura campo 'Geo' dalla tabella
+ string sGeo ;
+ LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
+ // lettura eventuale campo 'Aux' dalla tabella
+ STRVECTOR vsAux ;
+ LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
+ LuaClearStack( L) ;
+
+ // info
+ string sOut = "LuaEmtTcPos : " + sName ;
+ LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
+
+ // verifico ci sia una macchina attiva
+ if ( m_pMchLua == nullptr)
+ return luaL_error( L, " Unknown Machine") ;
+
+ // carico i dati della posizione cambio utensile
+ if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
+ return luaL_error( L, " Load Machine Standard Head failed") ;
+
+ // restituisco l'indice della posizione cambio utensile
+ int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
+ if ( nTcPosId != GDB_ID_NULL)
+ LuaSetParam( L, nTcPosId) ;
+ else
+ LuaSetParam( L) ;
+ return 1 ;
+}
+
//----------------------------------------------------------------------------
int
Machine::LuaEmtModifyAxisPosition( lua_State* L)
diff --git a/SetupMgr.cpp b/SetupMgr.cpp
index 22df4ef..5747235 100644
--- a/SetupMgr.cpp
+++ b/SetupMgr.cpp
@@ -313,3 +313,17 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
sName.clear() ;
return false ;
}
+
+//----------------------------------------------------------------------------
+bool
+SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
+{
+ vsTools.clear() ;
+ // eseguo ricerca
+ for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
+ if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
+ vsTools.emplace_back( m_vStuData[i].m_sName) ;
+ }
+ }
+ return true ;
+}
diff --git a/SetupMgr.h b/SetupMgr.h
index e8620cd..bc164e8 100644
--- a/SetupMgr.h
+++ b/SetupMgr.h
@@ -13,8 +13,7 @@
#pragma once
-#include
-#include
+#include "/EgtDev/Include/EgtStringBase.h"
class MachMgr ;
class IGeomDB ;
@@ -51,6 +50,7 @@ class SetupMgr
bool GetPosData( int nPos, std::string& sTcPos, std::string& sHead, int& nExit, std::string& sName) const ;
bool GetToolData( const std::string& sName, std::string& sTcPos, std::string& sHead, int& nExit, int* pnPos = nullptr) const ;
bool GetToolName( const std::string& sHead, int nExit, std::string& sName) const ;
+ bool GetToolsInSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const ;
private :
typedef std::vector< SetupData> STUDVECTOR ;
diff --git a/TcPos.cpp b/TcPos.cpp
new file mode 100644
index 0000000..fc49908
--- /dev/null
+++ b/TcPos.cpp
@@ -0,0 +1,106 @@
+//----------------------------------------------------------------------------
+// EgalTech 2020-2020
+//----------------------------------------------------------------------------
+// File : TcPos.cpp Data : 26.04.20 Versione : 2.2d4
+// Contenuto : Oggetto testa per gruppo posizione cambio utensile di macchina.
+//
+//
+//
+// Modifiche : 26.04.20 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "TcPos.h"
+#include "MachConst.h"
+#include "/EgtDev/Include/EMkMachiningConst.h"
+#include "/EgtDev/Include/EGkGdbConst.h"
+#include "/EgtDev/Include/EGkUserObjFactory.h"
+#include "/EgtDev/Include/EGkStringUtils3d.h"
+#include "/EgtDev/Include/EGkUiUnits.h"
+
+using namespace std ;
+
+//----------------------------------------------------------------------------
+USEROBJ_REGISTER( "EMkTcPos", TcPos) ;
+
+//----------------------------------------------------------------------------
+const string&
+TcPos::GetClassName( void) const
+{
+ return USEROBJ_GETNAME( TcPos) ;
+}
+
+//----------------------------------------------------------------------------
+TcPos*
+TcPos::Clone( void) const
+{
+ // alloco oggetto
+ TcPos* pHead = new(nothrow) TcPos ;
+ // eseguo copia dei dati
+ if ( pHead != nullptr) {
+ try { pHead->m_nOwnerId = GDB_ID_NULL ;
+ pHead->m_pGeomDB = nullptr ;
+ pHead->m_sName = m_sName ;
+ pHead->m_vtADir = m_vtADir ;
+ }
+ catch( ...) {
+ delete pHead ;
+ return nullptr ;
+ }
+ }
+ // ritorno l'oggetto
+ return pHead ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TcPos::Dump( string& sOut, bool bMM, const char* szNewLine) const
+{
+ sOut += GetClassName() + szNewLine ;
+ sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
+ sOut += "Name=" + m_sName + szNewLine ;
+ sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TcPos::SetOwner( int nId, IGeomDB* pGDB)
+{
+ m_nOwnerId = nId ;
+ m_pGeomDB = pGDB ;
+ return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
+}
+
+//----------------------------------------------------------------------------
+int
+TcPos::GetOwner( void) const
+{
+ return m_nOwnerId ;
+}
+
+//----------------------------------------------------------------------------
+IGeomDB*
+TcPos::GetGeomDB( void) const
+{
+ return m_pGeomDB ;
+}
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+TcPos::TcPos( void)
+ : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr)
+{
+}
+
+//----------------------------------------------------------------------------
+bool
+TcPos::Set( const string& sName, const Vector3d& vtADir)
+{
+ m_sName = sName ;
+ m_vtADir = vtADir ;
+ return true ;
+}
diff --git a/TcPos.h b/TcPos.h
new file mode 100644
index 0000000..d222142
--- /dev/null
+++ b/TcPos.h
@@ -0,0 +1,44 @@
+//----------------------------------------------------------------------------
+// EgalTech 2020-2020
+//----------------------------------------------------------------------------
+// File : TcPos.h Data : 26.04.20 Versione : 2.2d4
+// Contenuto : Dichiarazione della classe TcPos.
+//
+//
+//
+// Modifiche : 26.04.20 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+#pragma once
+
+#include "Machine.h"
+#include "/EgtDev/Include/EGkUserObj.h"
+#include "/EgtDev/Include/EGkPoint3d.h"
+
+//----------------------------------------------------------------------------
+class TcPos : public IUserObj
+{
+ public : // IUserObj
+ TcPos* Clone( void) const override ;
+ const std::string& GetClassName( void) const override ;
+ bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
+ bool SetOwner( int nId, IGeomDB* pGDB) override ;
+ int GetOwner( void) const override ;
+ IGeomDB* GetGeomDB( void) const override ;
+
+ public :
+ TcPos( void) ;
+ bool Set( const std::string& sName, const Vector3d& vtADir) ;
+ const std::string& GetName( void) const
+ { return m_sName ; }
+ const Vector3d& GetADir( void) const
+ { return m_vtADir ; }
+
+ private :
+ int m_nOwnerId ;
+ IGeomDB* m_pGeomDB ;
+ std::string m_sName ;
+ Vector3d m_vtADir ;
+} ;
\ No newline at end of file