Files
EgtExecutor/LUA_GdbGetPocketing.cpp
T
Dario Sassi cce5e6ae76 EgtExecutor 2.6b1 :
- modifiche a ExePocketing per accettare percorso piano e chiuso oltre che regione piana.
2024-02-05 19:56:31 +01:00

90 lines
2.8 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : LUA_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
// Contenuto : Funzioni di creazione percorsi di svuotatura o infill per LUA.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaPocketing( lua_State* L) {
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId) ;
double dRad ;
LuaCheckParam( L, 2, dRad) ;
double dStep ;
LuaCheckParam( L, 3, dStep) ;
double dAngle ;
LuaCheckParam( L, 4, dAngle) ;
int nType ;
LuaCheckParam( L, 5, nType) ;
bool bSmooth ;
LuaCheckParam( L, 6, bSmooth) ;
int nDestGrpId ;
LuaCheckParam( L, 7, nDestGrpId) ;
LuaClearStack( L) ;
// calcolo delle curve elementari di svuotatura
int nFirstId = GDB_ID_NULL ;
int nCrvCount = 0 ;
bool bOk = ExePocketing( nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId, nFirstId, nCrvCount) ;
if ( ! bOk)
LuaSetParam( L) ;
else
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCrvCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bSmooth, bRemoveOverlapLink
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bSmooth ;
LuaCheckParam( L, 5, bSmooth) ;
bool bRemoveOverlapLink ;
LuaCheckParam( L, 6, bRemoveOverlapLink) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bSmooth, bRemoveOverlapLink, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetPocketing( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPocketing", LuaPocketing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
return bOk ;
}