677a8466dd
- aggiunta gestione flag MaxDeltaR2OnFirst su testa per disabilitare controllo massimo delta su secondo asse rotante all'inizio di una lavorazione.
157 lines
4.9 KiB
C++
157 lines
4.9 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2021
|
|
//----------------------------------------------------------------------------
|
|
// File : Head.cpp Data : 14.10.21 Versione : 2.3j5
|
|
// Contenuto : Oggetto testa per gruppo testa di macchina.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 25.05.15 DS Creazione modulo.
|
|
// 11.01.17 DS Aggiunto contatore uscite.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "Head.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( "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_nExitCount = m_nExitCount ;
|
|
pHead->m_vsHSet = m_vsHSet ;
|
|
pHead->m_vtADir = m_vtADir ;
|
|
pHead->m_dRot1W = m_dRot1W ;
|
|
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
|
|
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 += "ExitCount=" + ToString( m_nExitCount) + 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_nExitCount( 0),
|
|
m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
|
{
|
|
m_Rot2Stroke.Min = - INFINITO ;
|
|
m_Rot2Stroke.Max = INFINITO ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
|
|
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
|
|
{
|
|
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 ;
|
|
m_vtADir.Normalize() ;
|
|
m_dRot1W = dRot1W ;
|
|
m_bMaxDeltaR2On1 = bMaxDeltaR2On1 ;
|
|
m_Rot2Stroke = Rot2Stroke ;
|
|
if ( IsValidHeadScc( nSolCh))
|
|
m_nSolCh = nSolCh ;
|
|
else
|
|
m_nSolCh = MCH_SCC_NONE ;
|
|
m_vsOtherColl = vsOthColl ;
|
|
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 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::ModifyHeadAuxDirection( const Vector3d& vtADir)
|
|
{
|
|
m_vtADir = vtADir ;
|
|
m_vtADir.Normalize() ;
|
|
return true ;
|
|
}
|