Files
EgtExecutor/LUA_GdbCreateVol.cpp
T
Dario Sassi 557b0a2e44 EgtExecutor 1.6x2 :
- modifiche per Zmap con tridexel.
2016-12-19 14:34:34 +00:00

115 lines
3.5 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)
{
// 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 ;
LuaCheckParam( L, 7, bTriDex)
int nRefType = RTY_DEFAULT ;
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)
{
// 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 ;
LuaCheckParam( 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)
{
// 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 ;
LuaCheckParam( 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 ;
}