- MachiningLib, PreSimulationLib e FACEBYBLADE modificate per introduzione check finecorsa (da completare) e check attacchi
This commit is contained in:
+71
-25
@@ -304,7 +304,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
||||
error( 'TestEngagement : unknown engagement')
|
||||
end
|
||||
|
||||
-- se l'angolo non può essere raggiunto dall'utensile si esce subito
|
||||
-- se l'angolo non può essere raggiunto dall'utensile la lavorazione non è fattibile
|
||||
if IsFaceZOutOfRange( vtHead, Tool) then
|
||||
return false
|
||||
end
|
||||
@@ -318,31 +318,85 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
||||
dDepthToMachine = dDepthToMachine
|
||||
}
|
||||
|
||||
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, OptionalParameters)
|
||||
-- lavorazione oltre le corse: non fattibile
|
||||
local bOutOfStroke = PreSimulationLib.CheckOutOfStroke()
|
||||
if bOutOfStroke then
|
||||
return false
|
||||
end
|
||||
|
||||
return not bCollisionFound, bMoveAfterSplit
|
||||
-- lavorazione in collisione con il pezzo: non fattibile
|
||||
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, OptionalParameters)
|
||||
if bCollisionFound then
|
||||
return false
|
||||
end
|
||||
|
||||
-- check attacchi
|
||||
local bNeedTangentLeadInOut = false
|
||||
local bOutOfStrokePerpendicular = PreSimulationLib.CheckOutOfStroke() -- TODO passare punti custom attacco perpendicolare
|
||||
|
||||
-- attacco perpendicolare oltre le corse: si prova attacco tangenziale
|
||||
if bOutOfStrokePerpendicular then
|
||||
|
||||
local bOutOfStrokeTangent = PreSimulationLib.CheckOutOfStroke() -- TODO passare punti custom attacco tangenziale
|
||||
|
||||
-- entrambi gli attacchi oltre le corse: lavorazione non fattibile
|
||||
if bOutOfStrokeTangent then
|
||||
|
||||
return false
|
||||
|
||||
-- check collisione attacco tangenziale
|
||||
else
|
||||
local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, OptionalParameters) -- TODO passare punti custom attacco tangenziale
|
||||
|
||||
-- attacco perpendicolare oltre le corse e attacco tangenziale in collisione: lavorazione non fattibile
|
||||
if bCollisionFoundTangent then
|
||||
|
||||
return false
|
||||
|
||||
-- obbligatorio attacco tangenziale
|
||||
else
|
||||
bMoveAfterSplit = bMoveAfterSplit or bMoveAfterSplitTangent
|
||||
bNeedTangentLeadInOut = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- arrivati qui la lavorazione è fattibile: si restituisce se è necessario farla dopo separazione e se serve attacco tangenziale
|
||||
return true, bMoveAfterSplit, bNeedTangentLeadInOut
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp)
|
||||
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp) e se è necessario un attacco tangenziale
|
||||
-- TODO si dovrà decidere come tagliare anche se pezzo corto (il motore non deve ingombrare con il pinzaggio)
|
||||
-- TODO da gestire riduzione percorso
|
||||
function MachiningLib.GetBladeEngagement( Parameters, OptionalParameters)
|
||||
|
||||
local Engagement
|
||||
|
||||
-- test lavorazione faccia in modo standard (no DownUp)
|
||||
local bIsEngagementOk, bMoveAfterSplit = TestEngagement( 'Standard', Parameters, OptionalParameters)
|
||||
local bIsEngagementOk, bMoveAfterSplit, bNeedTangentLeadInOut = TestEngagement( 'Standard', Parameters, OptionalParameters)
|
||||
|
||||
if bIsEngagementOk then
|
||||
|
||||
return true, 'Standard', bMoveAfterSplit
|
||||
Engagement = {
|
||||
sBladeEngagement = 'Standard',
|
||||
bMoveAfterSplit = bMoveAfterSplit,
|
||||
bNeedTangentLeadInOut = bNeedTangentLeadInOut
|
||||
}
|
||||
return true, Engagement
|
||||
end
|
||||
|
||||
-- faccia non lavorabile in modo standard: si verifica se il DownUp è fattibile
|
||||
bIsEngagementOk, bMoveAfterSplit = TestEngagement( 'DownUp', Parameters, OptionalParameters)
|
||||
bIsEngagementOk, bMoveAfterSplit, bNeedTangentLeadInOut = TestEngagement( 'DownUp', Parameters, OptionalParameters)
|
||||
|
||||
if bIsEngagementOk then
|
||||
|
||||
return true, 'DownUp', bMoveAfterSplit
|
||||
Engagement = {
|
||||
sBladeEngagement = 'DownUp',
|
||||
bMoveAfterSplit = bMoveAfterSplit,
|
||||
bNeedTangentLeadInOut = bNeedTangentLeadInOut
|
||||
}
|
||||
return true, Engagement
|
||||
end
|
||||
|
||||
return false
|
||||
@@ -495,10 +549,8 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
|
||||
local nBestToolIndex
|
||||
local dBestToolResidualDepth = 0
|
||||
local sCurrentBladeEngagement
|
||||
local sBestBladeEngagement
|
||||
local bCurrentMoveAfterSplit
|
||||
local bBestMoveAfterSplit
|
||||
local CurrentEngagement
|
||||
local BestEngagement
|
||||
for i = 1, #TOOLS do
|
||||
local bIsToolCompatible = false
|
||||
|
||||
@@ -527,7 +579,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
bIsDicing = bIsDicing
|
||||
}
|
||||
TIMER:startElapsed( 'GetBladeEngagement')
|
||||
bIsBladeOk, sCurrentBladeEngagement, bCurrentMoveAfterSplit = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters)
|
||||
bIsBladeOk, CurrentEngagement = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters)
|
||||
TIMER:stopElapsed( 'GetBladeEngagement')
|
||||
-- orientamento non raggiungibile
|
||||
if not bIsBladeOk then
|
||||
@@ -553,15 +605,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
|
||||
bBestMoveAfterSplit = bCurrentMoveAfterSplit
|
||||
BestEngagement = CurrentEngagement
|
||||
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
|
||||
bBestMoveAfterSplit = bCurrentMoveAfterSplit
|
||||
BestEngagement = CurrentEngagement
|
||||
else
|
||||
-- entrambi completi
|
||||
if dBestToolResidualDepth <= 10 * GEO.EPS_SMALL and dCurrentResidualDepth <= 10 * GEO.EPS_SMALL then
|
||||
@@ -572,15 +622,13 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
GetIndexToolInAvailableToolList( ToolSearchParameters.AvailableToolList, TOOLS[nBestToolIndex].sName) then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
sBestBladeEngagement = sCurrentBladeEngagement
|
||||
bBestMoveAfterSplit = bCurrentMoveAfterSplit
|
||||
BestEngagement = CurrentEngagement
|
||||
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
|
||||
bBestMoveAfterSplit = bCurrentMoveAfterSplit
|
||||
BestEngagement = CurrentEngagement
|
||||
end
|
||||
-- entrambi incompleti
|
||||
elseif dBestToolResidualDepth > 10 * GEO.EPS_SMALL and dCurrentResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
@@ -588,8 +636,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
if dCurrentResidualDepth > dBestToolResidualDepth then
|
||||
nBestToolIndex = i
|
||||
dBestToolResidualDepth = dCurrentResidualDepth
|
||||
sBestBladeEngagement = sCurrentBladeEngagement
|
||||
bBestMoveAfterSplit = bCurrentMoveAfterSplit
|
||||
BestEngagement = CurrentEngagement
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -599,8 +646,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
|
||||
ToolInfo.nToolIndex = nBestToolIndex
|
||||
ToolInfo.dResidualDepth = dBestToolResidualDepth
|
||||
ToolInfo.sBladeEngagement = sBestBladeEngagement
|
||||
ToolInfo.bMoveAfterSplit = bBestMoveAfterSplit
|
||||
ToolInfo.Engagement = BestEngagement
|
||||
|
||||
return ToolInfo
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user