20f3f5755f
- aggiunta a Exe e Lua funzione CreateVolZmapByRegionExtrusion.
86 lines
2.6 KiB
C++
86 lines
2.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)
|
|
{
|
|
// 5 o 6 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, 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)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 7, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// creo VZM parallelepipedo
|
|
int nId = ExeCreateVolZmap( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, nRefType) ;
|
|
// restituisco il risultato
|
|
if ( nId != GDB_ID_NULL)
|
|
LuaSetParam( L, nId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
|
|
{
|
|
// 4 parametri : ParentId, SfrId dDimZ, dPrec
|
|
int nParentId ;
|
|
LuaCheckParam( L, 1, nParentId)
|
|
int nSfrId ;
|
|
LuaCheckParam( L, 2, nSfrId)
|
|
double dDimZ ;
|
|
LuaCheckParam( L, 3, dDimZ)
|
|
double dPrec ;
|
|
LuaCheckParam( L, 4, dPrec)
|
|
LuaClearStack( L) ;
|
|
// creo VZM per estrusione di flat region
|
|
int nId = ExeCreateVolZmapByRegionExtrusion( nParentId, nSfrId, dDimZ, dPrec) ;
|
|
// 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) ;
|
|
return bOk ;
|
|
}
|