diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index 28a95a0..63fc6d8 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -1,4 +1,4 @@ --- MachiningLib.lua by Egaltech s.r.l. 2021/08/29 +-- MachiningLib.lua by Egaltech s.r.l. 2021/09/17 -- Libreria ricerca lavorazioni per Pareti -- Tabella per definizione modulo @@ -58,7 +58,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID) local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i') if ( not sTuuid or sTuuid == sMyTuuid) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and - ( not nTool_ID or nTool_ID == nMyTool_ID) then + ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam end end @@ -79,14 +79,16 @@ function WMachiningLib.FindNailing( nType) end --------------------------------------------------------------------- -function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth) +function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID) for i = 1, #Pocketings do local Pocketing = Pocketings[i] if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) + local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i') if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and - ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then + ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and + ( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then return Pocketing.Name, dTDiam, dTMaxDepth end end diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 12b2cd7..96a2514 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,4 +1,4 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2021/08/06 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/09/17 -- Gestione calcolo profilo libero per Pareti -- Tabella per definizione modulo @@ -1766,6 +1766,7 @@ local function MakeByMill( Proc, nRawId, b3Raw) local sMilling = WM.FindMilling( 'FreeContour', nil, nil, nTool_ID) if not sMilling then local sErr = 'Error : milling not found in library' + if nTool_ID then sErr = sErr .. ' (Tool_ID=' .. tostring( nTool_ID) .. ')' end EgtOutLog( sErr) return false, sErr end @@ -1961,11 +1962,12 @@ local function MakeByPocket( Proc, nRawId, b3Raw) end end if Proc.Fct < 5 and (( bIsL and not bIsU) or ( bIsU and dMiddleFacetLength > dDiam * 2)) then dDiam = dDiam * 2 end - --local bToolInv = ( vtExtr:getZ() < -0.1) + local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') -- recupero la lavorazione - local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dDepth) + local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dDepth, nTool_ID) if not sPocketing then local sErr = 'Error : pocketing not found in library' + if nTool_ID then sErr = sErr .. ' (Tool_ID=' .. tostring( nTool_ID) .. ')' end EgtOutLog( sErr) return false, sErr end