DataBeam :

- modifiche per semplificazione file lavorazioni disponibili e aggiunta flag On/Off.
This commit is contained in:
Dario Sassi
2019-07-16 07:14:36 +00:00
parent d39116d84f
commit 22fdec88f7
+32 -11
View File
@@ -1,4 +1,4 @@
-- MachiningLib.lua by Egaltech s.r.l. 2019/04/26
-- MachiningLib.lua by Egaltech s.r.l. 2019/07/16
-- Libreria ricerca lavorazioni per Travi
-- Tabella per definizione modulo
@@ -21,7 +21,7 @@ local Drillings = require( 'DrillData')
function MachiningLib.FindCutting( sType)
for i = 1, #Cuttings do
local Cutting = Cuttings[i]
if Cutting.Type == sType then
if Cutting.On and Cutting.Type == sType then
return Cutting.Name
end
end
@@ -31,7 +31,7 @@ end
function MachiningLib.FindMilling( sType)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.Type == sType then
if Milling.On and Milling.Type == sType then
return Milling.Name
end
end
@@ -41,9 +41,14 @@ end
function MachiningLib.FindPocketing( sType, dMaxMat)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.Type == sType then
if not dMaxMat or dMaxMat < Pocketing.MaxMat then
return Pocketing.Name
if Pocketing.On and Pocketing.Type == sType and EgtMdbSetCurrMachining( Pocketing.Name) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if sTool and EgtTdbSetCurrTool( sTool) then
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
if not dMaxMat or dMaxMat < dTMaxDepth then
return Pocketing.Name
end
end
end
end
@@ -53,7 +58,7 @@ end
function MachiningLib.FindSawing( sType)
for i = 1, #Sawings do
local Sawing = Sawings[i]
if Sawing.Type == sType then
if Sawing.On and Sawing.Type == sType then
return Sawing.Name
end
end
@@ -65,15 +70,31 @@ function MachiningLib.FindDrilling( dDiam)
-- ricerca sulle forature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if ( Drilling.Type == 'Drill' and Drilling.Diam < dDiam + 10 * GEO.EPS_SMALL and Drilling.Diam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL) then
return Drilling.Name, Drilling.Type, Drilling.MaxMat
if Drilling.On and Drilling.Type == 'Drill' and EgtMdbSetCurrMachining( Drilling.Name) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if sTool and EgtTdbSetCurrTool( sTool) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxMat
end
end
end
end
-- ricerca sulle svuotature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if ( Drilling.Type == 'Pocket' and dDiam > Drilling.Diam + 10 * GEO.EPS_SMALL) then
return Drilling.Name, Drilling.Type, Drilling.MaxMat
if Drilling.On and Drilling.Type == 'Pocket' and EgtMdbSetCurrMachining( Drilling.Name) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if sTool and EgtTdbSetCurrTool( sTool) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
if dTDiam < dDiam - 10 * GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxDepth
end
end
end
end
end