34bc5e8f0d
- aggiunte funzioni Exe e Lua CAvToolStmPosition.
62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2018-2018
|
|
//----------------------------------------------------------------------------
|
|
// File : LUA_CAvTool.cpp Data : 28.04.18 Versione : 1.9e1
|
|
// Contenuto : Funzioni per evitare collisioni utensile-superfici.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 28.04.18 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"
|
|
#include "/EgtDev/Include/EgnStringUtils.h"
|
|
|
|
using namespace std ;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaCAvToolStmPosition( lua_State* L)
|
|
{
|
|
// 7 o 8 parametri : dToolLen, dToolDiam, dToolCornR, nSurfTmId, ptP, vtAx, vtMove [, nRefType]
|
|
double dToolLen ;
|
|
LuaCheckParam( L, 1, dToolLen)
|
|
double dToolDiam ;
|
|
LuaCheckParam( L, 2, dToolDiam)
|
|
double dToolCornR ;
|
|
LuaCheckParam( L, 3, dToolCornR)
|
|
int nSurfTmId ;
|
|
LuaCheckParam( L, 4, nSurfTmId)
|
|
Point3d ptP ;
|
|
LuaCheckParam( L, 5, ptP)
|
|
Vector3d vtAx ;
|
|
LuaCheckParam( L, 6, vtAx)
|
|
Vector3d vtMove ;
|
|
LuaCheckParam( L, 7, vtMove)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 8, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// determino il movimento da dare all'utensile per evitare la collisione con la superficie
|
|
double dMove = ExeCAvToolStmPosition( dToolLen, dToolDiam, dToolCornR, nSurfTmId,
|
|
ptP, vtAx, vtMove, nRefType) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, dMove) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallCAvTool( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolStmPosition", LuaCAvToolStmPosition) ;
|
|
return bOk ;
|
|
}
|