Files
EgtMachKernel/TcPos.cpp
Dario Sassi f31aacdc14 EgtMachKernel 2.2d4 :
- aggiunta gestione TcPos (posizioni di cambio utensile) da configurazione macchina
- aggiunte funzioni GetToolsInCurrSetupPos, GetTcPosId e GetAllTcPosNames.
2020-04-27 07:27:23 +00:00

107 lines
3.0 KiB
C++

//----------------------------------------------------------------------------
// 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 ;
}