diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp index d29a16e..f80c209 100644 --- a/EXE_GdbModifyVol.cpp +++ b/EXE_GdbModifyVol.cpp @@ -330,6 +330,28 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName, return bOk ; } +//---------------------------------------------------------------------------- +bool +ExeVolZmapResetTool( const INTVECTOR& vIds) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero gli Zmap e assegno i dati dell'utensile + bool bOk = true ; + for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { + IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; + bOk = ( pVZM != nullptr && pVZM->ResetTool() && bOk) ; + } + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtVolZmapResetTool({" + IdListToString( vIds) + "})" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco risultato + return bOk ; +} + //---------------------------------------------------------------------------- int MyVolZmapGetToolOutline( int nId, int nDestGrpId, bool bApprox) diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp index d1a1472..69315f7 100644 --- a/LUA_GdbModifyVol.cpp +++ b/LUA_GdbModifyVol.cpp @@ -234,6 +234,21 @@ LuaVolZmapSetChiselTool( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaVolZmapResetTool( lua_State* L) +{ + // 1 parametro : vIds + INTVECTOR vIds ; + LuaCheckParam( L, 1, vIds) + LuaClearStack( L) ; + // reset utensile a Zmap indicati + bool bOk = ExeVolZmapResetTool( vIds) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaVolZmapGetToolOutline( lua_State* L) @@ -447,6 +462,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ;