63d85b005a
- aggiunta gestione import CSF - aggiunta ExeAddSubPiece.
135 lines
4.0 KiB
C++
135 lines
4.0 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : LUA_Exchange.cpp Data : 29.09.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni generali per LUA.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 29.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LUA.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
|
#include "/EgtDev/Include/EgnStringUtils.h"
|
|
|
|
using namespace std ;
|
|
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaImportDxf( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 1, sFilePath)
|
|
double dScaleFactor = 1.0 ;
|
|
LuaGetParam( L, 2, dScaleFactor) ;
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeImportDxf( sFilePath, dScaleFactor) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaImportStl( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 1, sFilePath)
|
|
double dScaleFactor = 1.0 ;
|
|
LuaGetParam( L, 2, dScaleFactor) ;
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeImportStl( sFilePath, dScaleFactor) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaImportCnc( lua_State* L)
|
|
{
|
|
// 1 parametro : path del file da importare
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 1, sFilePath)
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeImportCnc( sFilePath) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaImportCsf( lua_State* L)
|
|
{
|
|
// 1 parametro : path del file da importare
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 1, sFilePath)
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeImportCsf( sFilePath) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExportDxf( lua_State* L)
|
|
{
|
|
// 2 parametri, GroupId e path del file da esportare
|
|
int nGroupId ;
|
|
LuaCheckParam( L, 1, nGroupId)
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 2, sFilePath)
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeExportDxf( nGroupId, sFilePath) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExportStl( lua_State* L)
|
|
{
|
|
// 2 parametri, GroupId e path del file da esportare
|
|
int nGroupId ;
|
|
LuaCheckParam( L, 1, nGroupId)
|
|
string sFilePath ;
|
|
LuaCheckParam( L, 2, sFilePath)
|
|
LuaClearStack( L) ;
|
|
// apro il file
|
|
bool bOk = ExeExportStl( nGroupId, sFilePath) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallExchange( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCnc", LuaImportCnc) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCsf", LuaImportCsf) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
|
|
return bOk ;
|
|
}
|