From bb82dcb7249d4ffaa66cee6964bfa144ea90facb Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 3 Dec 2024 14:55:46 +0100 Subject: [PATCH] - in MachiningLib -> StartsLeftSide contemplato ToolInvert - in SLOTBYBLADE aggiunta gestione lavorazioni di coda - in STR0003 > lama aggiunta gestione lavorazioni di coda - in Config STR0003 e STR0004 aggiunto parametro dExtendAfterTail per decidere di quanto estendere una lavorazione oltre la coda --- LuaLibs/MachiningLib.lua | 3 ++ Strategies/Core/SLOTBYBLADE.lua | 43 +++++++++++++------ Strategies/Standard/STR0003/STR0003.lua | 7 ++- Strategies/Standard/STR0003/STR0003Config.lua | 1 + Strategies/Standard/STR0004/STR0004.lua | 2 +- Strategies/Standard/STR0004/STR0004Config.lua | 1 + 6 files changed, 41 insertions(+), 16 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index e10ca30..5863e61 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -66,6 +66,9 @@ end function MachiningLib.StartsLeftSide( Machining) local bStartsLeftSide = ( Machining.vtEdgeDirection:getX() > 10 * GEO.EPS_SMALL and not Machining.bInvert) or ( not( Machining.vtEdgeDirection:getX() > 10 * GEO.EPS_SMALL) and Machining.bInvert) + if Machining.bToolInvert then + bStartsLeftSide = not bStartsLeftSide + end return bStartsLeftSide end diff --git a/Strategies/Core/SLOTBYBLADE.lua b/Strategies/Core/SLOTBYBLADE.lua index beac422..26496c0 100644 --- a/Strategies/Core/SLOTBYBLADE.lua +++ b/Strategies/Core/SLOTBYBLADE.lua @@ -17,8 +17,7 @@ local function CalculateLeadInOut( Machining, EdgeToMachine) -- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom) -- si determina l'eventuale riduzione da applicare in caso di inizio o fine chiusi - local dAddLengthToReduce = 0 - dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine) + local dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine) if Machining.bInvert then Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed @@ -100,6 +99,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar OptionalParameters = {} end local bForceLongcutBlade = OptionalParameters.bForceLongcutBlade or false + local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 -- lunghezze e punti caratteristici della lavorazione e del lato lavorato Cutting.dLengthToMachine = EdgeToMachine.dLength @@ -245,18 +245,33 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- nome operazione Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1) - -- eventuale avviso di danneggiamento pezzo successivo - -- TODO da sostituire con check se si riesce a separare e il grezzo dietro รจ lungo a sufficienza --- local dOffsideLength = max( Cutting.LeadIn.dStartAddLength, Cutting.LeadOut.dEndAddLength) + TOOLS[Cutting.nToolIndex].dDiameter / 2 + 10 * GEO.EPS_SMALL --- if ( not Proc.bTail or Proc.bAdvTail) and Proc.AffectedFaces.bLeft and ( Proc.dDistanceToNextPart < dOffsideLength) then --- local sDamageNextPieceMessage = 'Feature '.. Proc.idFeature .. ' : sawblade can damage next piece.' --- if #Cutting.sMessage > 0 then --- Cutting.sMessage = Cutting.sMessage .. '\n' .. sDamageNextPieceMessage --- else --- Cutting.sMessage = sDamageNextPieceMessage --- end --- EgtOutLog( sDamageNextPieceMessage) --- end + -- se lavorazione aperta sulla coda, eventuali aggiustamenti + -- TODO valutare se fare funzione a parte + if Proc.AffectedFaces.bLeft then + local bStartLeft = MachiningLib.StartsLeftSide( Cutting) + local dAddLengthLeftSide = Cutting.LeadIn.dStartAddLength + local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine) + if bStartLeft then + dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength + end + if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then + if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then + Cutting.bMoveAfterSplitcut = true + else + Cutting.bIsApplicable = false + end + elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then + if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then + Cutting.bMoveAfterSplitcut = true + else + if bStartLeft then + Cutting.LeadOut.dEndAddLength = - dAddLengthToReduce + dExtendAfterTail + else + Cutting.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail + end + end + end + end return Cutting diff --git a/Strategies/Standard/STR0003/STR0003.lua b/Strategies/Standard/STR0003/STR0003.lua index a5da175..20c3bf0 100644 --- a/Strategies/Standard/STR0003/STR0003.lua +++ b/Strategies/Standard/STR0003/STR0003.lua @@ -169,9 +169,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) return false, Strategy.Result end + local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) + if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then + dExtendAfterTail = 10000 + end + -- lama - calcolo lavorazioni local Cutting = {} - local OptionalParameters = { bForceLongcutBlade = Strategy.Parameters.bForceLongcutBlade} + local OptionalParameters = { bForceLongcutBlade = Strategy.Parameters.bForceLongcutBlade, dExtendAfterTail = dExtendAfterTail} if Proc.Topology.sFamily == 'Tunnel' then Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) else diff --git a/Strategies/Standard/STR0003/STR0003Config.lua b/Strategies/Standard/STR0003/STR0003Config.lua index 78de872..ede85fa 100644 --- a/Strategies/Standard/STR0003/STR0003Config.lua +++ b/Strategies/Standard/STR0003/STR0003Config.lua @@ -4,6 +4,7 @@ local STR0003Data = { sStrategyId = 'STR0003', Parameters = { { sName = 'bFinishWithChainSaw', sNameNge = 'ALLOW_FINISH_CHAINSAW', sValue = 'true', sDescriptionShort = 'Finish with chainsaw if needed', sDescriptionLong = 'Finish with chainsaw if needed', sType = 'b', sMessageId = '', sMinUserLevel = '1'}, + { sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, { sName = 'bForceLongcutBlade', sNameNge = 'USE_LONGCUT_BLADE', sValue = 'false', sDescriptionShort = 'Force ripping blade', sDescriptionLong = 'Force the use of ripping blade, designed for cuts parallel to the grain', sType = 'b', sMessageId = '', sMinUserLevel = '1'}, { sName = 'bNotCompleteWithBladeRadius', sNameNge = 'NOT_COMPLETE_WITH_BLADE_RADIUS', sValue = 'true', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'}, { sName = 'bUseZigZagMortising', sNameNge = 'USE_ZIGZAG_CHAINSAW', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'}, diff --git a/Strategies/Standard/STR0004/STR0004.lua b/Strategies/Standard/STR0004/STR0004.lua index c83c3e8..d7b0d87 100644 --- a/Strategies/Standard/STR0004/STR0004.lua +++ b/Strategies/Standard/STR0004/STR0004.lua @@ -149,7 +149,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) return false, Strategy.Result end - local dExtendAfterTail = max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) + local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then dExtendAfterTail = 10000 end diff --git a/Strategies/Standard/STR0004/STR0004Config.lua b/Strategies/Standard/STR0004/STR0004Config.lua index 203c567..924b46f 100644 --- a/Strategies/Standard/STR0004/STR0004Config.lua +++ b/Strategies/Standard/STR0004/STR0004Config.lua @@ -4,6 +4,7 @@ local STR0004Data = { sStrategyId = 'STR0004', Parameters = { { sName = 'bUseZigZagMortising', sNameNge = 'USE_ZIGZAG_CHAINSAW', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'}, + { sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}, { sName = 'sCanDamageNextPiece', sNameNge = 'DAMAGE_NEXT_PIECE', sValue = 'NEVER', sType = 'combo', sMinUserLevel = '1', Choices = { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}, { sValue = 'ONLY_IF_RAWPART', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},