d9c080c6d6
- ora OnSpecialApplyDisposition gestisce anche TcPos - aggiunta possibilità di richiamo OnPostApplyMachining al termine ricalcolo lavorazione - aggiunta funzione Lua EmtGetAxesPos - piccole migliorie a simulazione.
115 lines
3.7 KiB
C++
115 lines
3.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : Machining.cpp Data : 10.06.15 Versione : 1.6f2
|
|
// Contenuto : Implementazione gestione base lavorazioni.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 10.06.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "DllMain.h"
|
|
#include "MachMgr.h"
|
|
#include "Machining.h"
|
|
#include "MachiningConst.h"
|
|
#include "CamData.h"
|
|
#include "/EgtDev/Include/EGkAngle.h"
|
|
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
|
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
|
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
|
#include "/EgtDev/Include/EgkIntersCurves.h"
|
|
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
|
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
Machining::Machining( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
Machining::GetToolName( void) const
|
|
{
|
|
return GetToolData().m_sName ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
Machining::GetHeadName( void) const
|
|
{
|
|
return GetToolData().m_sHead ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
Machining::GetExitNbr( void) const
|
|
{
|
|
return GetToolData().m_nExit ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
Machining::GetToolTcPos( void) const
|
|
{
|
|
return GetToolData().m_sTcPos ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Machining:: NeedPrevHome( void) const
|
|
{
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Machining::PostApply( void)
|
|
{
|
|
// recupero la macchina corrente
|
|
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
|
if ( pMch == nullptr)
|
|
return false ;
|
|
// costanti
|
|
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
|
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
|
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
|
|
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
|
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
|
|
|
|
// eseguo l'azione
|
|
if ( pMch->LuaExistsFunction( ON_POST_APPLY)) {
|
|
bool bOk = true ;
|
|
int nErr = 99 ;
|
|
// imposto valori parametri
|
|
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
|
|
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
|
|
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
|
|
// eseguo
|
|
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY) ;
|
|
// recupero valori parametri obbligatori
|
|
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
|
|
// recupero valori parametri opzionali
|
|
// ...
|
|
// reset
|
|
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
|
// segnalo errori
|
|
if ( nErr != 0) {
|
|
bOk = false ;
|
|
string sOut = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
|
|
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
|
}
|
|
return bOk ;
|
|
}
|
|
else
|
|
return true ;
|
|
} |