//---------------------------------------------------------------------------- // EgalTech 2015-2018 //---------------------------------------------------------------------------- // File : Estimator.cpp Data : 28.05.18 Versione : 1.9e6 // Contenuto : Implementazione della classe Estimator. // // // // Modifiche : 28.10.15 DS Creazione modulo. // 26.02.16 DS Aggiunta gestione archi. // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "DllMain.h" #include "Estimator.h" #include "Machine.h" #include "OutputConst.h" #include "/EgtDev/Include/EGnFileUtils.h" using namespace std ; //---------------------------------------------------------------------------- static const string ERR_EXT = ".err" ; //---------------------------------------------------------------------------- Estimator::Estimator( void) { } //---------------------------------------------------------------------------- Estimator::~Estimator( void) { } //---------------------------------------------------------------------------- bool Estimator::Init( MachMgr* pMchMgr) { return Processor::Init( pMchMgr) ; } //---------------------------------------------------------------------------- bool Estimator::Run( const string& sCncFile, const string& sInfo) { // emetto info di log { string sOut = "Estimator Run : " + sCncFile ; LOG_INFO( GetEMkLogger(), sOut.c_str()) ; } // cancello l'eventuale file di uscita (e anche il file errore) EraseFile( sCncFile) ; string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; EraseFile( sErrFile) ; // lancio il processore bool bOk = Processor::Run( sCncFile, sInfo) ; // in caso di errore rinomino il file di output if ( ! bOk) RenameFile( sCncFile, sErrFile) ; return bOk ; } //---------------------------------------------------------------------------- bool Estimator::CallOnStart( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_START) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnEnd( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_END) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnProgramStart( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_PROGRAM_START) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnProgramEnd( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_PROGRAM_END) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnToolData( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TOOL_DATA)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_TOOL_DATA) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnDispositionStart( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_DISPOSITION_START) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnDispositionEnd( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_DISPOSITION_END) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnTableData( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TABLE_DATA)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnFixtureData( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_FIXTURE_DATA)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_FIXTURE_DATA) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnRawMoveData( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_RAWMOVE_DATA)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_RAWMOVE_DATA) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnToolSelect( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_TOOL_SELECT) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnToolDeselect( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_TOOL_DESELECT) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnMachiningStart( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_MACHINING_START) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnMachiningEnd( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_MACHINING_END) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnPathStart( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_PATH_START)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_PATH_START) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnPathEnd( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_PATH_END)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_PATH_END) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnPathStartAux( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_PATH_START_AUX)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_PATH_START_AUX) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnPathEndAux( void) { if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_PATH_END_AUX)) return true ; return m_pMachine->LuaCallFunction( ON_ESTIM_PATH_END_AUX) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnRapid( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_RAPID) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnLinear( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_LINEAR) ; } //---------------------------------------------------------------------------- bool Estimator::CallOnArc( void) { return m_pMachine->LuaCallFunction( ON_ESTIM_ARC) ; }