d63fa552c6
- in selezione tutto si considerano solo i pezzi (non le parti per le lavorazioni) - aggiunte EgtIsPart e EgtIsLayer a API e LUA - migliorati controlli per riconoscimento pezzi e layer - corretto errore in VerifySameFrame per GeoTransforms - ImportDxf e Stl ora accettano anche fattore di scala API e LUA.
121 lines
3.5 KiB
C++
121 lines
3.5 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 "API.h"
|
|
#include "LUA.h"
|
|
#include "LUA_Base.h"
|
|
#include "/EgtDev/Include/EInAPI.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 = EgtImportDxf( 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 = EgtImportStl( 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 = EgtImportCnc( 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 = EgtExportDxf( 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 = EgtExportStl( nGroupId, sFilePath) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallExchange( void)
|
|
{
|
|
bool bOk = true ;
|
|
bOk = bOk && LuaRegisterFunction( "EgtImportDxf", LuaImportDxf) ;
|
|
bOk = bOk && LuaRegisterFunction( "EgtImportStl", LuaImportStl) ;
|
|
bOk = bOk && LuaRegisterFunction( "EgtImportCnc", LuaImportCnc) ;
|
|
bOk = bOk && LuaRegisterFunction( "EgtExportDxf", LuaExportDxf) ;
|
|
bOk = bOk && LuaRegisterFunction( "EgtExportStl", LuaExportStl) ;
|
|
return bOk ;
|
|
}
|