diff --git a/EXE_CAvTool.cpp b/EXE_CAvTool.cpp index 2ee65e3..9074fb6 100644 --- a/EXE_CAvTool.cpp +++ b/EXE_CAvTool.cpp @@ -49,6 +49,15 @@ ExeCAvSetAdvTool( double dToolLen, double dToolDiam, double dTipLen, double dTip return s_pCAvTlStm->SetAdvTool( dToolLen, dToolDiam / 2, dTipLen, dTipDiam / 2, dToolCornR) ; } +//---------------------------------------------------------------------------- +bool +ExeCAvSetSawTool( double dToolLen, double dToolDiam, double dThickness, double dStemDiam, double dToolCornR) +{ + if ( IsNull( s_pCAvTlStm)) + return false ; + return s_pCAvTlStm->SetSawTool( dToolLen, dToolDiam / 2, dThickness, dStemDiam / 2, dToolCornR) ; +} + //---------------------------------------------------------------------------- bool ExeCAvSetGenTool( int nToolSectId) diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp index 1d0c443..158eca6 100644 --- a/EXE_GdbModifyVol.cpp +++ b/EXE_GdbModifyVol.cpp @@ -211,6 +211,34 @@ ExeVolZmapSetAdvTool( int nId, const string& sToolName, return bOk ; } +//---------------------------------------------------------------------------- +bool +ExeVolZmapSetSawTool( int nId, const string& sToolName, + double dLen, double dDiam, double dThick, double dStemDiam, double dCornR, int nFlag) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero lo Zmap e assegno i dati dell'utensile + IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; + bool bOk = ( pVZM != nullptr && + pVZM->SetSawTool( sToolName, dLen, dDiam / 2, dThick, dStemDiam / 2, dCornR, nFlag)) ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtVolZmapSetSawTool(" + IdToString( nId) + "," + + sToolName + "," + + ToString( dLen) + "," + + ToString( dDiam) + "," + + ToString( dThick) + "," + + ToString( dStemDiam) + "," + + ToString( dCornR) + "," + + ToString( nFlag) + ")" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco risultato + return bOk ; +} + //---------------------------------------------------------------------------- bool ExeVolZmapSetGenTool( int nId, const string& sToolName, int nToolSectId, int nFlag) diff --git a/LUA_CAvTool.cpp b/LUA_CAvTool.cpp index 6bc1347..3e3cff9 100644 --- a/LUA_CAvTool.cpp +++ b/LUA_CAvTool.cpp @@ -63,6 +63,29 @@ LuaCAvSetAdvTool( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaCAvSetSawTool( lua_State* L) +{ + // 5 parametri : dToolLen, dToolDiam, dThickness, dStemDiam, dToolCornR + double dToolLen ; + LuaCheckParam( L, 1, dToolLen) + double dToolDiam ; + LuaCheckParam( L, 2, dToolDiam) + double dThickness ; + LuaCheckParam( L, 3, dThickness) + double dStemDiam ; + LuaCheckParam( L, 4, dStemDiam) + double dToolCornR ; + LuaCheckParam( L, 5, dToolCornR) + LuaClearStack( L) ; + // assegno dati utensile lama per Collision Avoidance + bool bOk = ExeCAvSetSawTool( dToolLen, dToolDiam, dThickness, dStemDiam, dToolCornR) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaCAvSetGenTool( lua_State* L) @@ -148,6 +171,7 @@ LuaInstallCAvTool( LuaMgr& luaMgr) bool bOk = ( &luaMgr != nullptr) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetStdTool", LuaCAvSetStdTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetAdvTool", LuaCAvSetAdvTool) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ; diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp index 5093891..8b981ea 100644 --- a/LUA_GdbModifyVol.cpp +++ b/LUA_GdbModifyVol.cpp @@ -132,6 +132,35 @@ LuaVolZmapSetAdvTool( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaVolZmapSetSawTool( lua_State* L) +{ + // 7 o 8 parametri : Id, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag + 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 dThick ; + LuaCheckParam( L, 5, dThick) + double dStemDiam ; + LuaCheckParam( L, 6, dStemDiam) + double dCornR ; + LuaCheckParam( L, 7, dCornR) + int nFlag = 1 ; + LuaGetParam( L, 8, nFlag) ; + LuaClearStack( L) ; + // imposto utensile avanzato a Zmap indicato + bool bOk = ExeVolZmapSetSawTool( nId, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaVolZmapSetGenTool( lua_State* L) @@ -375,6 +404,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetSawTool", LuaVolZmapSetSawTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;