From 2f1b56ddc6d72dcf9dff155404d80b3cbe4ec0fd Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 31 Jan 2025 13:08:27 +0100 Subject: [PATCH] - in BLADETOWASTE taglio singolo funzionante, da completare --- LuaLibs/DiceCut.lua | 2 +- Strategies/Standard/STR0005/STR0005.lua | 11 +++++++---- StrategyLibs/BLADETOWASTE.lua | 11 +++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index 0ae2788..576de61 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -428,7 +428,7 @@ function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters) -- distanza tra piani paralleli e piani di taglio (era sempre 0, serve???) local dTolerance = OptionalParameters.dTolerance or 0 -- inclinazione limite per taglio da sotto - local dNzLimDownUp = OptionalParameters.dNzLimDownUp BeamLib.GetNzLimDownUp( b3BoxDicing) + local dNzLimDownUp = OptionalParameters.dNzLimDownUp or BeamLib.GetNzLimDownUp( b3BoxDicing) --Ricavo le altezze dei BoundingBox contenente feature e estremi del grezzo local TBoxPoint = CalcolaPuntiEstremiBox( b3BoxDicing) diff --git a/Strategies/Standard/STR0005/STR0005.lua b/Strategies/Standard/STR0005/STR0005.lua index 297d262..e742d0f 100644 --- a/Strategies/Standard/STR0005/STR0005.lua +++ b/Strategies/Standard/STR0005/STR0005.lua @@ -116,6 +116,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) Blade.Result = {} local Cutting = {} local dMRRBlade = 0 + local dCompletionPercentage = 0 -- estensione oltre la coda local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) @@ -194,7 +195,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) local dMRRBlade2 = MachiningLib.GetToolMRR( MRRParameters2) dMRRBlade = ( dMRRBlade1 + dMRRBlade2) / 2 - Cutting = Cutting2 + dCompletionPercentage = Cutting2.dCompletionPercentage -- se la lavorazione con codolo fallisce o non è possibile si proseguirà a quella con cubetti end @@ -202,9 +203,11 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) -- lavorazione a cubetti / taglio singolo if #Blade.Result == 0 and not bLeaveWasteAttached then local bDropWholeWaste = Strategy.Parameters.sCuttingStrategy == 'DROP_WHOLE_WASTE' - local OptionalParameters = { bDropWholeWaste = bDropWholeWaste} + local OptionalParameters = { bDropWholeWaste = bDropWholeWaste, dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume, dMaxWasteLength = Strategy.Parameters.dMaxWasteLength} Blade.Result.Sorted = BladeToWaste.Make( Proc, Part, OptionalParameters) + -- TODO la BladeToWaste dovrà restituire la dCompletionPercentage + dCompletionPercentage = Blade.Result.Sorted[#Blade.Result.Sorted].dCompletionPercentage end -- aggiunta lavorazioni @@ -225,12 +228,12 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) end -- TODO calcolo migliore area lavorata; se ho il codolo ha senso l'incompleta? se incompleta con codolo faccio i cubetti?? if nIsApplicableCount > 0 then - if Cutting.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then + if dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then Strategy.Result.sStatus = 'Completed' else Strategy.Result.sStatus = 'Not-Completed' -- TODO al momento si assume che la percentuale di completamento dell'ultima lavorazione sia quella rilevante - dFinalCompletionPercentage = Cutting.dCompletionPercentage + dFinalCompletionPercentage = dCompletionPercentage end else Strategy.Result.sStatus = 'Not-Applicable' diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 5b477d6..c663360 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -24,11 +24,13 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters) -- parametri opzionali e default local nToolIndex = OptionalParameters.nToolIndex local bDropWholeWaste = OptionalParameters.bDropWholeWaste or false + local dMaxWasteVolume = OptionalParameters.dMaxWasteVolume or 0 + local dMaxWasteLength = OptionalParameters.dMaxWasteLength or 0 local dFeatureVolume = FeatureLib.GetFeatureVolume( Proc, Part) local dFeatureMaxDimension = max( Proc.b3Box:getDimX(), Proc.b3Box:getDimY()) - local bIsFeatureSmall = dFeatureVolume < StrategyParameters.dMaxWasteVolume + 10 * GEO.EPS_SMALL - and dFeatureMaxDimension < StrategyParameters.dMaxWasteLength + 10 * GEO.EPS_SMALL + local bIsFeatureSmall = dFeatureVolume < dMaxWasteVolume + 10 * GEO.EPS_SMALL + and dFeatureMaxDimension < dMaxWasteLength + 10 * GEO.EPS_SMALL if Proc.nFct == 1 and ( bIsFeatureSmall or bDropWholeWaste) then local EdgeToMachine = {} @@ -36,7 +38,7 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters) if not nToolIndex then local ToolSearchParameters = {} for i = 1, #Proc.Faces[1].Edges do - if Proc.Faces[1].Edges[i].dElevation < EdgeToMachine.dElevation - 10 * GEO.EPS_SMALL then + if ( i == 1) or Proc.Faces[1].Edges[i].dElevation < EdgeToMachine.dElevation - 10 * GEO.EPS_SMALL then EdgeToMachine = Proc.Faces[1].Edges[i] end end @@ -50,7 +52,8 @@ function BLADETOWASTE.Make( Proc, Part, OptionalParameters) nToolIndex = ToolInfo.nToolIndex end - local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine) + local OptionalParametersFaceByBlade = { dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA} + local Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParametersFaceByBlade) table.insert( Result, Cutting) -- restituire tabella contenente lavorazioni, già con cloni se necessari