diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index f8b3595..43cd040 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -176,6 +176,10 @@ function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets, bUseMul end end end + -- se MultiDrill non si prova il DrillPocket + if bUseMultiDrill then + return + end -- ricerca sulle svuotature, dal diametro maggiore al minore for i = #Drillings, 1, -1 do local Drilling = Drillings[i] diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index e53519d..6e304e8 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -464,16 +464,18 @@ function WPD.Make( Proc, nRawId, b3Raw, bUseMultiDrill, DrillingsToAvoid) elseif bUseMultiDrill then if Proc.SkippedGeometries and #Proc.SkippedGeometries > 0 then EgtSetMachiningGeometry( Proc.SkippedGeometries) - elseif Proc.OtherGeometries and #Proc.OtherGeometries > 0 then + else local HolesGeometries = {} -- aggiungo foro principale table.insert( HolesGeometries, { AuxId, -1}) - -- aggiungo altre geometrie connesse - for i = 1, #Proc.OtherGeometries do - -- recupero geometria da lavorare - local OtherAuxId = Proc.OtherGeometries[i].Id + EgtGetInfo( Proc.OtherGeometries[i].Id, 'AUXID', 'i') - local Geometry = { OtherAuxId, -1} - table.insert( HolesGeometries, Geometry) + -- aggiungo eventuali altre geometrie connesse + if Proc.OtherGeometries and #Proc.OtherGeometries > 0 then + for i = 1, #Proc.OtherGeometries do + -- recupero geometria da lavorare + local OtherAuxId = Proc.OtherGeometries[i].Id + EgtGetInfo( Proc.OtherGeometries[i].Id, 'AUXID', 'i') + local Geometry = { OtherAuxId, -1} + table.insert( HolesGeometries, Geometry) + end end EgtSetMachiningGeometry( HolesGeometries) end @@ -581,7 +583,8 @@ function WPD.Make( Proc, nRawId, b3Raw, bUseMultiDrill, DrillingsToAvoid) SkippedGeometries = EgtGetMachiningSkippedGeometry() if bUseMultiDrill and SkippedGeometries and #SkippedGeometries > 0 then if ( Proc.SkippedGeometries and ( #SkippedGeometries == #Proc.SkippedGeometries)) - or ( #SkippedGeometries == #Proc.OtherGeometries + 1) then + or ( Proc.OtherGeometries and ( #SkippedGeometries == #Proc.OtherGeometries + 1)) + or ( not Proc.OtherGeometries and #SkippedGeometries == 1) then EgtRemoveOperation( nMchId) end Proc.SkippedGeometries = SkippedGeometries @@ -591,16 +594,24 @@ function WPD.Make( Proc, nRawId, b3Raw, bUseMultiDrill, DrillingsToAvoid) -- non trovata lavorazione, si prova con le lavorazioni singole if not bOk then for i = #Proc.SkippedGeometries, 1, -1 do - for j = 1, #Proc.OtherGeometries do - local AuxIdOtherGeometry = EgtGetInfo( Proc.OtherGeometries[j].Id, 'AUXID', 'i') or 0 - if AuxIdOtherGeometry then AuxIdOtherGeometry = AuxIdOtherGeometry + Proc.OtherGeometries[j].Id end + if Proc.OtherGeometries then + for j = 1, #Proc.OtherGeometries do + local AuxIdOtherGeometry = EgtGetInfo( Proc.OtherGeometries[j].Id, 'AUXID', 'i') or 0 + if AuxIdOtherGeometry then AuxIdOtherGeometry = AuxIdOtherGeometry + Proc.OtherGeometries[j].Id end + if Proc.SkippedGeometries[i][1] == AuxIdOtherGeometry then + bOk = WPD.Make( Proc.OtherGeometries[j], nRawId, b3Raw, false) + break + end + end + -- se nelle altre geometrie non è stato trovato, potrebbe essere la principale local AuxIdProc = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 if AuxIdProc then AuxIdProc = AuxIdProc + Proc.Id end - if Proc.SkippedGeometries[i][1] == AuxIdOtherGeometry then - bOk = WPD.Make( Proc.OtherGeometries[j], nRawId, b3Raw, false) - elseif Proc.SkippedGeometries[i][1] == AuxIdProc then + if Proc.SkippedGeometries[i][1] == AuxIdProc then bOk = WPD.Make( Proc, nRawId, b3Raw, false) end + -- se non ci sono altre geometrie quella da fare è sicuramente la Proc principale + else + bOk = WPD.Make( Proc, nRawId, b3Raw, false) end if bOk then table.remove( Proc.SkippedGeometries, i)