//---------------------------------------------------------------------------- // EgalTech 2016-2016 //---------------------------------------------------------------------------- // File : LUA_GdbModifyVol.cpp Data : 27.10.16 Versione : 1.6v7 // Contenuto : Funzioni di modifica dei 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 LuaVolZmapSetStdTool( lua_State* L) { // 5 parametri : Id, sToolName, dLen, dDiam, dCornR int nId ; LuaCheckParam( L, 1, nId) string sToolName ; LuaCheckParam( L, 2, sToolName) double dLen ; LuaCheckParam( L, 3, dLen) double dDiam ; LuaCheckParam( L, 4, dDiam) double dCornR ; LuaCheckParam( L, 5, dCornR) LuaClearStack( L) ; // imposto utensile standard a Zmap indicato bool bOk = ExeVolZmapSetStdTool( nId, sToolName, dLen, dDiam, dCornR) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; } //---------------------------------------------------------------------------- static int LuaVolZmapMillingStep( lua_State* L) { // 5 o 6 parametri : nId, ptPs, vtDs, ptPe, vtDe [, nRefType] int nId ; LuaCheckParam( L, 1, nId) Point3d ptPs ; LuaCheckParam( L, 2, ptPs) Vector3d vtDs ; LuaCheckParam( L, 3, vtDs) Point3d ptPe ; LuaCheckParam( L, 4, ptPe) Vector3d vtDe ; LuaCheckParam( L, 5, vtDe) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 6, nRefType) ; LuaClearStack( L) ; // eseguo movimento di fresatura con l'utensile già associato a Zmap bool bOk = ExeVolZmapMillingStep( nId, ptPs, vtDs, ptPe, vtDe, nRefType) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; } //---------------------------------------------------------------------------- static int LuaVolZmapGetDepth( lua_State* L) { // 3 o 4 parametri : nId, ptP, vtDir [, nRefType] int nId ; LuaCheckParam( L, 1, nId) Point3d ptP ; LuaCheckParam( L, 2, ptP) Vector3d vtDir ; LuaCheckParam( L, 3, vtDir) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // eseguo calcolo profondità dal punto lungo la direzione double dLen1, dLen2 ; bool bOk = ExeVolZmapGetDepth( nId, ptP, vtDir, nRefType, dLen1, dLen2) ; // restituisco il risultato if ( bOk) { LuaSetParam( L, dLen1) ; LuaSetParam( L, dLen2) ; } else { LuaSetParam( L) ; LuaSetParam( L) ; } return 2 ; } //---------------------------------------------------------------------------- static int LuaVolZmapAvoidBox( lua_State* L) { // 3 o 4 parametri : nId, frBox, vtDiag [, nRefType] int nId ; LuaCheckParam( L, 1, nId) Frame3d frBox ; LuaCheckParam( L, 2, frBox) Vector3d vtDiag ; LuaCheckParam( L, 3, vtDiag) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // eseguo calcolo profondità dal punto lungo la direzione bool bOk = ExeVolZmapAvoidBox( nId, frBox, vtDiag, nRefType) ; // restituisco il risultato LuaSetParam( L, bOk) ; return 1 ; } //------------------------------------------------------------------------------- bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) { bool bOk = ( &luaMgr != nullptr) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapAvoidBox", LuaVolZmapAvoidBox) ; return bOk ; }