- in MachiningLib.GetBladeEngagement refactoring

This commit is contained in:
luca.mazzoleni
2025-12-04 18:39:29 +01:00
parent 322412a1f3
commit ad1ea741d0
3 changed files with 63 additions and 6 deletions
+22 -2
View File
@@ -288,7 +288,17 @@ end
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp)
-- 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( Face, Edge, Part, Tool, dDepthToMachine, bIsDicing)
function MachiningLib.GetBladeEngagement( Parameters, OptionalParameters)
local Face = Parameters.Face
local Edge = Parameters.Edge
local Part = Parameters.Part
local Tool = Parameters.Tool
local dDepthToMachine = Parameters.dDepthToMachine
-- parametri opzionali
OptionalParameters = OptionalParameters or {}
local bIsDicing = OptionalParameters.bIsDicing or false
-- la normale della faccia permette di lavorare in modo standard, ma potrebbero esserci collisioni che fanno fallire il taglio
-- se cubetti si controlla con pezzo solo asse Z e grezzo con tutti (ci sarebbe collisione con il materiale già rimosso controllando AB e C con pezzo)
@@ -516,8 +526,18 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
if bIsToolCompatible then
if FaceToMachine and EdgeToMachine and Part and dElevation then
local bIsBladeOk = false
local BladeEngagementParameters = {
Face = FaceToMachine,
Edge = EdgeToMachine,
Part = Part,
Tool = TOOLS[i],
dDepthToMachine = dElevation
}
local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing
}
TIMER:startElapsed( 'GetBladeEngagement')
bIsBladeOk, sCurrentBladeEngagement, bCurrentMoveAfterSplit = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[i], dElevation, bIsDicing)
bIsBladeOk, sCurrentBladeEngagement, bCurrentMoveAfterSplit = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters)
TIMER:stopElapsed( 'GetBladeEngagement')
-- orientamento non raggiungibile
if not bIsBladeOk then
+8 -1
View File
@@ -561,8 +561,15 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
-- lavorando dalla direzione opposta si verifica come se si lavorasse il lato opposto
local EdgeToMachineOpposite = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN)
local BladeEngagementParameters = {
Face = FaceToMachine,
Edge = EdgeToMachineOpposite,
Part = Part,
Tool = TOOLS[ToolInfo.nToolIndex],
dDepthToMachine = dDepthToMachine
}
TIMER:startElapsed( 'GetBladeEngagement')
local bIsApplicableOpposite = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachineOpposite, Part, TOOLS[ToolInfo.nToolIndex], dDepthToMachine)
local bIsApplicableOpposite = MachiningLib.GetBladeEngagement( BladeEngagementParameters)
TIMER:stopElapsed( 'GetBladeEngagement')
if not bIsApplicableOpposite then
return CuttingParametersList, EdgeToMachine
+33 -3
View File
@@ -274,8 +274,18 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
if nToolIndex then
Cutting.nToolIndex = nToolIndex
local BladeEngagementParameters = {
Face = FaceToMachine,
Edge = EdgeToMachine,
Part = Part,
Tool = TOOLS[Cutting.nToolIndex],
dDepthToMachine = dDepthToMachine
}
local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing
}
TIMER:startElapsed( 'GetBladeEngagement')
Cutting.bIsApplicable, Cutting.sBladeEngagement, Cutting.bMoveAfterSplit = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, Part, TOOLS[Cutting.nToolIndex], dDepthToMachine, bIsDicing)
Cutting.bIsApplicable, Cutting.sBladeEngagement, Cutting.bMoveAfterSplit = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters)
TIMER:stopElapsed( 'GetBladeEngagement')
-- utensile da cercare: si prende la lama migliore che può effettuare questo taglio, senza particolari analisi
@@ -357,8 +367,18 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
if OppositeToolDirectionMode ~= 'Disabled' then
-- lavorando dalla direzione opposta si verifica come se si lavorasse il lato opposto
local BladeEngagementParameters = {
Face = FaceToMachine,
Edge = EdgeToMachineOpposite,
Part = Part,
Tool = TOOLS[Cutting.nToolIndex],
dDepthToMachine = dDepthToMachine
}
local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing
}
TIMER:startElapsed( 'GetBladeEngagement')
local bIsApplicableOpposite, sBladeEngagementOpposite, bMoveAfterSplit = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachineOpposite, Part, TOOLS[Cutting.nToolIndex], dDepthToMachine, bIsDicing)
local bIsApplicableOpposite, sBladeEngagementOpposite, bMoveAfterSplit = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters)
TIMER:stopElapsed( 'GetBladeEngagement')
-- taglio opposto non fattibile
@@ -454,8 +474,18 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
if OppositeToolDirectionMode == 'Enabled' then
EdgeToMachineForEngagement = EdgeToMachineOpposite
end
local BladeEngagementParameters = {
Face = FaceToMachine,
Edge = EdgeToMachineForEngagement,
Part = Part,
Tool = TOOLS[Cutting.nToolIndex],
dDepthToMachine = dDepthToMachine
}
local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing
}
TIMER:startElapsed( 'GetBladeEngagement')
local bIsApplicable, sBladeEngagement, bMoveAfterSplit = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachineForEngagement, Part, TOOLS[Cutting.nToolIndex], dDepthToMachine)
local bIsApplicable, sBladeEngagement, bMoveAfterSplit = MachiningLib.GetBladeEngagement( BladeEngagementParameters, BladeEngagementOptionalParameters )
TIMER:stopElapsed( 'GetBladeEngagement')
-- se non fattibile o cambiano le condizioni BladeEngagement, non si riduce