Files
EgtExecutor/LUA_GdbCreateVol.cpp
Dario Sassi de83a284ae EgtExecutor 1.8h3 :
- nelle funzioni lua di creazioni solidi Zmap il parametro booleano per Tridexel può essere tralasciato con default true.
2017-08-10 17:15:30 +00:00

117 lines
3.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : LUA_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6vt
// Contenuto : Funzioni di creazione solidi per LUA.
//
//
//
// Modifiche : 27.10.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapBox( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmap( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
{
// 4 o 5 parametri : ParentId, SfrId, dDimZ, dPrec [, bTriDex]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSfrId ;
LuaCheckParam( L, 2, nSfrId)
double dDimZ ;
LuaCheckParam( L, 3, dDimZ)
double dPrec ;
LuaCheckParam( L, 4, dPrec)
bool bTriDex = true ;
LuaGetParam( L, 5, bTriDex) ;
LuaClearStack( L) ;
// creo VZM per estrusione di flat region
int nId = ExeCreateVolZmapByRegionExtrusion( nParentId, nSfrId, dDimZ, dPrec, bTriDex) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapFromSurfTm( lua_State* L)
{
// 3 o 4 parametri : ParentId, StmId, dPrec [, bTriDex]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nStmId ;
LuaCheckParam( L, 2, nStmId)
double dPrec ;
LuaCheckParam( L, 3, dPrec)
bool bTriDex = true ;
LuaGetParam( L, 4, bTriDex) ;
LuaClearStack( L) ;
// creo VZM da superficie trimesh
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ;
}