diff --git a/Strategies/Standard/STR0005/STR0005Config.lua b/Strategies/Standard/STR0005/STR0005Config.lua index c825ed3..400ecad 100644 --- a/Strategies/Standard/STR0005/STR0005Config.lua +++ b/Strategies/Standard/STR0005/STR0005Config.lua @@ -19,7 +19,8 @@ local STR0005Data = { { sName = 'dMaxWasteVolume', sNameNge = 'MAX_WASTE_VOLUME', sValue = '6000000', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, { sName = 'dStripWidth', sNameNge = 'STRIP_WIDTH', sValue = '5', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, { sName = 'dMinZAngleTopBlade', sNameNge = 'MIN_Z_ANGLE_TOP_BLADE', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, - { sName = 'dMaxYAngleTopBlade', sNameNge = 'MAX_Y_ANGLE_TOP_BLADE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'} + { sName = 'dMaxYAngleTopBlade', sNameNge = 'MAX_Y_ANGLE_TOP_BLADE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, + { sName = 'bFinishWithMill', sNameNge = 'ALLOW_FINISH_MILL', sValue = '1', sDescriptionShort = 'Clean blade radius with mill', sDescriptionLong = 'Clean blade radius with mill', sType = 'b', sMessageId = '', sMinUserLevel = '1'} } } diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index c8e1a59..81d7c97 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -13,6 +13,7 @@ local FaceData = require( 'FaceData') local MachiningLib = require( 'MachiningLib') -- strategie di base local FaceByBlade = require('FACEBYBLADE') +local FaceByMill = require('FACEBYMILL') -- tabella per definizione modulo @@ -84,8 +85,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) -- il FindBlade dovrà restituire di utilizzare sempre la lama sopra se l'angolo lo permette, ma avendo un'altezza massima (da macchina) oltre cui il DownUp non sarà fattibile (evita collisioni tra asse e pezzo) local Result = {} - local Blade = {} - Blade.Result = {} + local Machining = {} + Machining.Result = {} local Cutting1 = {} local Cutting2 = {} @@ -108,16 +109,29 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) end end + -- parametri opzionali e default + if not OptionalParameters then + OptionalParameters = {} + end + local nToolIndex = OptionalParameters.nToolIndex + local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 + local bFinishWithMill + if OptionalParameters.bFinishWithMill == nil then + bFinishWithMill = true + else + bFinishWithMill = OptionalParameters.bFinishWithMill + end + -- si trovano le facce da lavorare - local FaceToMachine = {} + local BottomFace = {} local LongFaces = {} if Proc.nFct == 1 then - FaceToMachine = Proc.Faces[1] + BottomFace = Proc.Faces[1] else if not Proc.MainFaces then Proc.MainFaces = FaceData.GetMainFaces( Proc, Part) end - FaceToMachine = Proc.MainFaces.BottomFaces[1] + BottomFace = Proc.MainFaces.BottomFaces[1] LongFaces = Proc.MainFaces.LongFaces end @@ -125,8 +139,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) -- si trova il lato da lavorare local EdgeToMachine = {} local EdgesSorted = {} - for i = 1, #FaceToMachine.Edges do - table.insert( EdgesSorted, FaceToMachine.Edges[i]) + for i = 1, #BottomFace.Edges do + table.insert( EdgesSorted, BottomFace.Edges[i]) end table.sort( EdgesSorted, CompareEdges) EdgeToMachine = EdgesSorted[1] @@ -141,27 +155,38 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) end -- calcolo lavorazioni - -- primo lato - local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = OptionalParameters.dExtendAfterTail} - Cutting1 = FaceByBlade.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade) - table.insert( Blade.Result, Cutting1) - -- secondo lato - OptionalParametersFaceByBlade.bOppositeToolDirection = true - Cutting2 = FaceByBlade.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade) - table.insert( Blade.Result, Cutting2) - -- eventuali facce di chiusura + -- taglio eventuali facce di chiusura for i = 1, #LongFaces do local CuttingLongFace = {} - OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = OptionalParameters.dExtendAfterTail} + local OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex} CuttingLongFace = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[i], Proc.MainFaces.LongFaces[i].MainEdges.BottomEdge, OptionalParametersFaceByBlade) - table.insert( Blade.Result, CuttingLongFace) + table.insert( Machining.Result, CuttingLongFace) + end + -- faccia di fondo + -- primo lato + local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex} + Cutting1 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade) + table.insert( Machining.Result, Cutting1) + -- secondo lato + OptionalParametersFaceByBlade.bOppositeToolDirection = true + Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade) + table.insert( Machining.Result, Cutting2) + -- eventuale pulitura raggio lama + if bFinishWithMill then + for i = 1, #LongFaces do + local OptionalParametersFaceByMill = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, + dDepthToMachine = max( Cutting1.dBladeMarkLength, Cutting2.dBladeMarkLength) + } + local MillingClosedSide = FaceByMill.Make( Proc, Part, BottomFace, BottomFace.MainEdges.LongEdges[i], OptionalParametersFaceByMill) + table.insert( Machining.Result, MillingClosedSide) + end end -- lavorazioni raggruppate in unica lista local Machinings = {} - for i = 1, #Blade.Result do - if Blade.Result[i].bIsApplicable then - table.insert( Machinings, Blade.Result[i]) + for i = 1, #Machining.Result do + if Machining.Result[i].bIsApplicable then + table.insert( Machinings, Machining.Result[i]) end end diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index 861640e..32c1129 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -207,7 +207,11 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara Milling.nToolIndex = nToolIndex else local ToolSearchParameters = {} - ToolSearchParameters.sMillShape = 'TSHAPEMILL' + if OptionalParameters.dPocketHeight then + ToolSearchParameters.sMillShape = 'TSHAPEMILL' + else + ToolSearchParameters.sMillShape = 'STANDARD' + end ToolSearchParameters.dElevation = dDepthToMachine -- TODO qui ToolSearchParameters.vtToolDirection andrà sosituito con vtN!! if Milling.bToolInvert then @@ -238,7 +242,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- verifica dimensioni tasca compatibili -- se tasca meno spessa della fresa la lavorazione non è applicabile - if OptionalParameters.dPocketHeight and ( not TOOLS[Milling.nToolIndex].bIsTMill or ( TOOLS[Milling.nToolIndex].dMaxMaterial > dPocketHeight + 10 * GEO.EPS_SMALL)) then + if OptionalParameters.dPocketHeight and TOOLS[Milling.nToolIndex].dMaxMaterial > dPocketHeight + 10 * GEO.EPS_SMALL then Milling.sMessage = 'Pocket too narrow for blade thickness' Milling.bIsApplicable = false EgtOutLog( Milling.sMessage) @@ -275,23 +279,30 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara Milling.bInvert = not Milling.bInvert end -- profondità da lavorare e offset radiale - if TOOLS[Milling.nToolIndex].dMaxDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then - -- TODO la depth dovrebbe essere quella del machining + if OptionalParameters.dPocketHeight then + if TOOLS[Milling.nToolIndex].dSideDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then + -- TODO la depth dovrebbe essere quella del machining + Milling.dDepthToMachine = dDepthToMachine + Milling.dResidualDepth = 0 + if bOppositeToolDirection then + Milling.dRadialOffset = -dDepthToMachine + else + Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine + end + else + Milling.dDepthToMachine = TOOLS[Milling.nToolIndex].dSideDepth - 1 + Milling.dResidualDepth = dDepthToMachine - Milling.dDepthToMachine + if bOppositeToolDirection then + Milling.dRadialOffset = -Milling.dDepthToMachine + else + Milling.dRadialOffset = EdgeToMachine.dElevation - Milling.dDepthToMachine + end + end + -- TODO qui bisogna controllare la profondità di lavoro + else Milling.dDepthToMachine = dDepthToMachine Milling.dResidualDepth = 0 - if bOppositeToolDirection then - Milling.dRadialOffset = -dDepthToMachine - else - Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine - end - else - Milling.dDepthToMachine = TOOLS[Milling.nToolIndex].dMaxDepth - 1 - Milling.dResidualDepth = dDepthToMachine - Milling.dDepthToMachine - if bOppositeToolDirection then - Milling.dRadialOffset = -Milling.dDepthToMachine - else - Milling.dRadialOffset = EdgeToMachine.dElevation - Milling.dDepthToMachine - end + Milling.dRadialOffset = 0 end -- completamento Milling.dCompletionPercentage = 100 - Milling.dResidualDepth / Milling.dDepthToMachine @@ -323,7 +334,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- SCC Milling.nSCC = GetSCC( Milling.vtToolDirection) -- asse bloccato - Milling.sBlockedAxis = ''BeamLib.GetBlockedAxis( Milling.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN, EgtIf( FaceToMachine.vtN:getX() > 0, X_AX(), -X_AX()))'' + Milling.sBlockedAxis = '' -- eventuale step orizzontale Milling.CloneStepsHorizontal = {} if not bDisableHorizontalSteps and TOOLS[Milling.nToolIndex].dSideStep then