- in MachiningLib.FindBlade si restituisce il BladeEngagement, se presente

- in BLADETOWASTE.GetEdgeToMachine aggiunta la possibilità di restituire l'n-esimo lato della lista ordinata; in GetSingleCutStrategy si tenta di cambiare lato se il con il primo set non si è trovato alcun utensile; altre piccole correzioni
- in FACEBYBLADE refactoring per contemplare i vari casi di inversione
This commit is contained in:
luca.mazzoleni
2025-11-07 10:15:01 +01:00
parent 15db75dfad
commit 4ce77a4792
4 changed files with 80 additions and 41 deletions
+13 -3
View File
@@ -369,8 +369,9 @@ function MachiningLib.GetBladeEngagement( Face, Edge, Part, Tool, dDepthToMachin
end
-- rischio collisione carro Z: non lavorabile in Downup
local bIsToolBelowWorkpiece = Edge.vtN:getZ() < - 10 * GEO.EPS_SMALL
local bIsToolAboveWorkpiece = Edge.vtN:getZ() > 10 * GEO.EPS_SMALL
-- TODO questo test è da spostare sulla macchina, non è universale
local bIsToolBelowWorkpiece = Edge.vtN:getZ() < - 0.5
local bIsToolAboveWorkpiece = Edge.vtN:getZ() > 0.5
if Tool.SetupInfo.HeadType.bTop and bIsToolBelowWorkpiece
or ( Tool.SetupInfo.HeadType.bBottom and bIsToolAboveWorkpiece) then
@@ -536,6 +537,8 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
local nBestToolIndex
local dBestToolResidualDepth = 0
local sCurrentBladeEngagement
local sBestBladeEngagement
for i = 1, #TOOLS do
local bIsToolCompatible = false
@@ -552,7 +555,8 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
-- se dati sufficienti, si determina se con questo utensile il taglio è fattibile e il modo di lavorare della lama
if bIsToolCompatible then
if FaceToMachine and EdgeToMachine and Part and dElevation then
local bIsBladeOk = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[i], dElevation, bCollisionCheckForDownUpOnly)
local bIsBladeOk = false
bIsBladeOk, sCurrentBladeEngagement = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[i], dElevation, bCollisionCheckForDownUpOnly)
-- orientamento non raggiungibile
if not bIsBladeOk then
bIsToolCompatible = false
@@ -577,11 +581,13 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
if not nBestToolIndex or ( dBestToolResidualDepth > 0 and dCurrentResidualDepth <= 10 * GEO.EPS_SMALL) then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
sBestBladeEngagement = sCurrentBladeEngagement
else
-- prediligo utensile per tagli lungo vena, se richiesto
if bForceLongcutBlade and not TOOLS[nBestToolIndex].bIsUsedForLongCut and TOOLS[i].bIsUsedForLongCut then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
sBestBladeEngagement = sCurrentBladeEngagement
else
-- entrambi completi
if dBestToolResidualDepth <= 10 * GEO.EPS_SMALL and dCurrentResidualDepth <= 10 * GEO.EPS_SMALL then
@@ -592,11 +598,13 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
GetIndexToolInAvailableToolList( ToolSearchParameters.AvailableToolList, TOOLS[nBestToolIndex].sName) then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
sBestBladeEngagement = sCurrentBladeEngagement
end
-- si sceglie quello con le performance migliori
elseif TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex + 10 * GEO.EPS_SMALL then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
sBestBladeEngagement = sCurrentBladeEngagement
end
-- entrambi incompleti
elseif dBestToolResidualDepth > 10 * GEO.EPS_SMALL and dCurrentResidualDepth > 10 * GEO.EPS_SMALL then
@@ -604,6 +612,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
if dCurrentResidualDepth > dBestToolResidualDepth then
nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth
sBestBladeEngagement = sCurrentBladeEngagement
end
end
end
@@ -613,6 +622,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
ToolInfo.nToolIndex = nBestToolIndex
ToolInfo.dResidualDepth = dBestToolResidualDepth
ToolInfo.sBladeEngagement = sBestBladeEngagement
return ToolInfo
end