Files
EgtMachKernel/Head.cpp
T
Dario Sassi 3bef4560fd EgtMachKernel 1.6w5 :
- in generazione corretta creazione elenco utensili (ora si usa TUUID)
- in Head corretta Clone
- per SCC (criterio scelta soluzione) ora NONE è equivalente a STANDARD
- si esegue Apply sulle operazioni solo se attive
- aggiunta gestione da script OnSpecialMoveUp per movimenti speciali a Z alta.
2016-11-29 08:14:44 +00:00

139 lines
4.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : Head.cpp Data : 25.05.15 Versione : 1.6e7
// Contenuto : Oggetto testa per gruppo testa di macchina.
//
//
//
// Modifiche : 25.05.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Head.h"
#include "MachConst.h"
#include "/EgtDev/Include/EMkSimuGenConst.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( "EMkHead", Head) ;
//----------------------------------------------------------------------------
const string&
Head::GetClassName( void) const
{
return USEROBJ_GETNAME( Head) ;
}
//----------------------------------------------------------------------------
Head*
Head::Clone( void) const
{
// alloco oggetto
Head* pHead = new(nothrow) Head ;
// 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_nType = m_nType ;
pHead->m_vsHSet = m_vsHSet ;
pHead->m_vtADir = m_vtADir ;
pHead->m_dRot1W = m_dRot1W ;
pHead->m_Rot2Stroke = m_Rot2Stroke ;
pHead->m_nSolCh = m_nSolCh ;
}
catch( ...) {
delete pHead ;
return nullptr ;
}
}
// ritorno l'oggetto
return pHead ;
}
//----------------------------------------------------------------------------
bool
Head::Dump( string& sOut, bool bMM, 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 += "HSet=" + ToString( m_vsHSet) + szNewLine ;
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
return true ;
}
//----------------------------------------------------------------------------
bool
Head::SetOwner( int nId, IGeomDB* pGDB)
{
m_nOwnerId = nId ;
m_pGeomDB = pGDB ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
}
//----------------------------------------------------------------------------
int
Head::GetOwner( void) const
{
return m_nOwnerId ;
}
//----------------------------------------------------------------------------
IGeomDB*
Head::GetGeomDB( void) const
{
return m_pGeomDB ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Head::Head( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE),
m_dRot1W( 1), m_nSolCh( MCH_SCC_NONE)
{
m_Rot2Stroke.Min = - INFINITO ;
m_Rot2Stroke.Max = INFINITO ;
}
//----------------------------------------------------------------------------
bool
Head::Set( const string& sName, int nType, const string& sHSet, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh)
{
m_sName = sName ;
m_nType = nType ;
m_vsHSet.clear() ;
m_vsHSet.push_back( sHSet) ;
m_vtADir = vtADir ;
m_dRot1W = dRot1W ;
m_Rot2Stroke = Rot2Stroke ;
if ( IsValidHeadScc( nSolCh))
m_nSolCh = nSolCh ;
else
m_nSolCh = MCH_SCC_NONE ;
return true ;
}
//----------------------------------------------------------------------------
bool
Head::AddHeadToHSet( const string& sHead)
{
// se già presente non devo fare alcunchè, altrimenti lo aggiungo
if ( find( m_vsHSet.begin(), m_vsHSet.end(), sHead) != m_vsHSet.end())
return true ;
m_vsHSet.emplace_back( sHead) ;
return true ;
}