3076dccb4b
- introdotto uso ObjUser per gruppi di macchina - prima versione prototipo delle forature - migliorie al calolo angoli e posizioni macchina.
113 lines
3.3 KiB
C++
113 lines
3.3 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : Axis.cpp Data : 24.05.15 Versione : 1.6e7
|
|
// Contenuto : Oggetto asse per gruppo asse di macchina.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 24.05.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "Axis.h"
|
|
#include "MachConst.h"
|
|
#include "/EgtDev/Include/EGkGdbConst.h"
|
|
#include "/EgtDev/Include/EGkObjUserFactory.h"
|
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
OBJUSER_REGISTER( "EMkAxis", Axis) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
Axis::GetClassName( void) const
|
|
{
|
|
return OBJUSER_GETNAME( Axis) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
Axis*
|
|
Axis::Clone( void) const
|
|
{
|
|
// alloco oggetto
|
|
Axis* pAx = new(nothrow) Axis ;
|
|
// eseguo copia dei dati
|
|
if ( pAx != nullptr) {
|
|
try { pAx->m_nOwnerId = GDB_ID_NULL ;
|
|
pAx->m_sName = m_sName ;
|
|
pAx->m_nType = m_nType ;
|
|
pAx->m_ptPos = m_ptPos ;
|
|
pAx->m_vtDir = m_vtDir ;
|
|
pAx->m_Stroke = m_Stroke ;
|
|
pAx->m_dHomeVal = m_dHomeVal ;
|
|
pAx->m_dCurrVal = m_dCurrVal ;
|
|
}
|
|
catch( ...) {
|
|
delete pAx ;
|
|
return nullptr ;
|
|
}
|
|
}
|
|
// ritorno l'oggetto
|
|
return pAx ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Axis::Dump( string& sOut, const char* szNewLine) const
|
|
{
|
|
sOut += GetClassName() + szNewLine ;
|
|
sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
|
|
sOut += "Name=" + m_sName + szNewLine ;
|
|
sOut += "Type=" + ToString( m_nType) + szNewLine ;
|
|
sOut += "Pos=" + ToString( m_ptPos) + szNewLine ;
|
|
sOut += "Dir=" + ToString( m_vtDir) + szNewLine ;
|
|
sOut += "Stroke=" + ToString( m_Stroke.v) + szNewLine ;
|
|
sOut += "HVal=" + ToString( m_dHomeVal) + szNewLine ;
|
|
sOut += "Val=" + ToString( m_dCurrVal) + szNewLine ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Axis::SetOwner( int nId)
|
|
{
|
|
m_nOwnerId = nId ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
Axis::GetOwner( void) const
|
|
{
|
|
return m_nOwnerId ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
Axis::Axis( void)
|
|
: m_nOwnerId( GDB_ID_NULL), m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Axis::Set( const string& sName, int nType,
|
|
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dVal)
|
|
{
|
|
m_sName = sName ;
|
|
m_nType = nType ;
|
|
m_ptPos = ptPos ;
|
|
m_vtDir = vtDir ;
|
|
m_Stroke = Stroke ;
|
|
m_dHomeVal = dVal ;
|
|
m_dCurrVal = dVal ;
|
|
return m_vtDir.Normalize() ;
|
|
}
|
|
|