517a36a009
- aggiornamento a VS2013 - alle curve si assegna in automatico estrusione come Z di griglia - aggiunta gestione direttorio per librerie Lua - aggiunta gestione frame di griglia (CPlane) in GeomDB - aggiunta gestione visualizzazione riferimento globale - aggiunto comando Lua EgtOffsetCurve - aggiunti comandi Lua EgtExecTsc, EgtOutLog, EgtEraseFile, EgtEmptyDirectory, EgtTextFileCompare, EgtBinaryFileCompare, EgtGetVersion - aggiunti comandi Lua EgtSetGridFrame, EgtGetGridFrame, EgtGetGridVersZ.
111 lines
3.7 KiB
C++
111 lines
3.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : API_TscExec.cpp Data : 01.09.14 Versione : 1.5i1
|
|
// Contenuto : Funzioni esecuzione TSC per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 01.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "API.h"
|
|
#include "API_Macro.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
#include "/EgtDev/Include/EGkGdbExecutor.h"
|
|
#include "/EgtDev/Include/EExExcExecutor.h"
|
|
#include "/EgtDev/Include/EGrSceExecutor.h"
|
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
#include "/EgtDev/Include/EGnStringConverter.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
#include <string>
|
|
|
|
using namespace std ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtInitTscExec( void)
|
|
{
|
|
GseContext* pGseCtx = GetCurrGseContext() ;
|
|
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
|
|
|
|
// eventuale pulizia esecutore e suoi oggetti
|
|
if ( pGseCtx->m_pTscExec != nullptr) {
|
|
delete pGseCtx->m_pTscExec ;
|
|
pGseCtx->m_pTscExec = nullptr ;
|
|
}
|
|
|
|
// creo esecutore
|
|
PtrOwner<ICmdParser> pCmdParser( CreateCmdParser()) ;
|
|
VERIFY_NULL( Get( pCmdParser), "Error in CreateCmdParser", FALSE)
|
|
|
|
// creo oggetto per esecuzione funzioni di GeomKernel
|
|
PtrOwner<IGdbExecutor> pGdbExec( CreateGdbExecutor()) ;
|
|
VERIFY_NULL( Get( pGdbExec), "Error in CreateGdbExecutor", FALSE)
|
|
pGdbExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
|
pCmdParser->SetExecutor( Release( pGdbExec)) ;
|
|
|
|
// creazione oggetto per esecuzione funzioni di Exchange
|
|
PtrOwner<IExcExecutor> pExcExec( CreateExcExecutor()) ;
|
|
VERIFY_NULL( Get( pExcExec), "Error in CreateExcExecutor", FALSE)
|
|
pExcExec->SetGeomDB( pGseCtx->m_pGeomDB) ;
|
|
pCmdParser->AddExecutor( Release( pExcExec)) ;
|
|
|
|
// eventuale creazione oggetto per esecuzione funzioni di Scene
|
|
if ( pGseCtx->m_pScene != nullptr) {
|
|
PtrOwner<ISceExecutor> pSceExec( CreateSceExecutor()) ;
|
|
VERIFY_NULL( Get( pSceExec), "Error in CreateSceExecutor", FALSE)
|
|
pSceExec->SetScene( pGseCtx->m_pScene) ;
|
|
pCmdParser->AddExecutor( Release( pSceExec)) ;
|
|
}
|
|
|
|
// completo inizializzazioni
|
|
pCmdParser->Init() ;
|
|
pGseCtx->m_pTscExec = Release( pCmdParser) ;
|
|
|
|
return TRUE ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtTscExecFile( const wchar_t* wsFilePath)
|
|
{
|
|
// converto nome file
|
|
string sFilePath = wstrztoA( wsFilePath) ;
|
|
// emetto info
|
|
string sInfo = "Exec File = " + sFilePath ;
|
|
LOG_INFO( GetLogger(), sInfo.c_str())
|
|
// eseguo
|
|
return ( EgtTscExecFile( sFilePath) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
__stdcall EgtTscExecFile( const string& sFilePath)
|
|
{
|
|
ICmdParser* pTscExec = GetCurrTscExecutor() ;
|
|
VERIFY_TSCEXEC( pTscExec, FALSE)
|
|
|
|
// imposto il direttorio dello script
|
|
string sFileDir, sFileName ;
|
|
SplitLast( sFilePath, "\\", sFileDir, sFileName) ;
|
|
pTscExec->SetDirReplace( "<TSCDIR>", sFileDir) ;
|
|
|
|
// esecuzione script
|
|
return pTscExec->Run( sFilePath) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtTscExecLine( const wchar_t* wsLine)
|
|
{
|
|
ICmdParser* pTscExec = GetCurrTscExecutor() ;
|
|
VERIFY_TSCEXEC( pTscExec, FALSE)
|
|
// eseguo il comando
|
|
return ( pTscExec->ExecLine( wstrztoA( wsLine)) ? TRUE : FALSE) ;
|
|
}
|