Files
EgtExecutor/LUA_Nesting.cpp
T
Dario Sassi 93feb71bec EgtExecutor :
- aggiunte a Lua EgtGetLastPart, EgtGetPrevPart, EgtGetLastLayer e EgtGetPrevLayer
- aggiunto parametro opzionale (separatore) a EgtSplitString di Lua
- corrette (parametro di ritorno di tipo errato) EgtPackBox e EgtPackBoxCluster di Lua.
2016-06-06 06:34:18 +00:00

105 lines
3.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : LUA_Nesting.cpp Data : 08.09.15 Versione : 1.6i5
// Contenuto : Funzioni Nesting per LUA.
//
//
//
// Modifiche : 08.09.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaPackBox( lua_State* L)
{
// 7 parametri : Id, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp
int nId ;
LuaCheckParam( L, 1, nId)
double dXmin ;
LuaCheckParam( L, 2, dXmin)
double dYmin ;
LuaCheckParam( L, 3, dYmin)
double dXmax ;
LuaCheckParam( L, 4, dXmax)
double dYmax ;
LuaCheckParam( L, 5, dYmax)
double dOffs ;
LuaCheckParam( L, 6, dOffs)
bool bBottomUp ;
LuaCheckParam( L, 7, bBottomUp)
LuaClearStack( L) ;
// eseguo il nesting del pezzo
bool bOk = ExePackBox( nId, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaPackBoxCluster( lua_State* L)
{
// 7 parametri : Id/s, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
double dXmin ;
LuaCheckParam( L, 2, dXmin)
double dYmin ;
LuaCheckParam( L, 3, dYmin)
double dXmax ;
LuaCheckParam( L, 4, dXmax)
double dYmax ;
LuaCheckParam( L, 5, dYmax)
double dOffs ;
LuaCheckParam( L, 6, dOffs)
bool bBottomUp ;
LuaCheckParam( L, 7, bBottomUp)
LuaClearStack( L) ;
// eseguo il nesting dell'insieme di pezzi
bool bOk = ExePackBoxCluster( vIds, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVerifyMachining( lua_State* L)
{
// 1 parametro : OperId
int nOperId ;
LuaCheckParam( L, 1, nOperId)
LuaClearStack( L) ;
// eseguo la verifica di interferenza della lavorazione
int nFlag ;
bool bOk = ExeVerifyMachining( nOperId, nFlag) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nFlag) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallNesting( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBox", LuaPackBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBoxCluster", LuaPackBoxCluster) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyMachining", LuaVerifyMachining) ;
return bOk ;
}