diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index ebe0ba2..7ec376e 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -280,7 +280,7 @@ end ------------------------------------------------------------------------------------------------------------- -- in base a tipo testa e angolo soglia, verifica se la faccia è troppo inclinata per la lavorazione scelta (per DownUp passare vtNFace opposta) -local function IsFaceZOutOfRange( vtNFace, Tool) +function MachiningLib.IsFaceZOutOfRange( vtNFace, Tool) -- lama sopra: angolo negativo troppo basso if Tool.SetupInfo.HeadType.bTop and vtNFace:getZ() < Tool.SetupInfo.GetMinNz( vtNFace, Tool) - GEO.EPS_ZERO then @@ -315,7 +315,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters) end -- se l'angolo non può essere raggiunto dall'utensile la lavorazione non è fattibile - if IsFaceZOutOfRange( vtHead, Tool) then + if MachiningLib.IsFaceZOutOfRange( vtHead, Tool) then return false end @@ -645,7 +645,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters) -- se si ha solo la faccia si può verificare se questa è orientata correttamente elseif FaceToMachine then - if IsFaceZOutOfRange( FaceToMachine.vtN, TOOLS[i]) then + if MachiningLib.IsFaceZOutOfRange( FaceToMachine.vtN, TOOLS[i]) then bIsToolCompatible = false end end diff --git a/LuaLibs/PreSimulationLib.lua b/LuaLibs/PreSimulationLib.lua index 3d6e2a3..d9aad4f 100644 --- a/LuaLibs/PreSimulationLib.lua +++ b/LuaLibs/PreSimulationLib.lua @@ -400,8 +400,8 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( ToolExitPoints[i], vtC, vtHead, PreCollisionData, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength) - -- se trovata collisione con pezzo oppure non possibile separazione, è inutile controllare gli altri punti - if bCollisionFoundPiece or ( bCannotSplitRestLength and bCollisionFoundRestLength) then + -- se trovata collisione con pezzo è inutile controllare gli altri punti + if bCollisionFoundPiece then return true diff --git a/Strategies/Standard/TAILCUT/TAILCUT.lua b/Strategies/Standard/TAILCUT/TAILCUT.lua index 389f692..937fb13 100644 --- a/Strategies/Standard/TAILCUT/TAILCUT.lua +++ b/Strategies/Standard/TAILCUT/TAILCUT.lua @@ -60,6 +60,8 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.dOffset = 0 else Strategy.bIsPreCut = true + -- TODO questo dOffset è errato, va creata una nuova faccia oppure usare dLongitudinalOffset e farlo transitare per tutti, anche Engagement + -- TODO a dRestLength va anche aggiunto lo spessore lama se c'è a fine grezzo? OptionalParameters.dOffset = Part.dRestLength end OptionalParameters.bDisableDicing = true diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 3270c67..d2fce68 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -260,6 +260,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters) local dShortPartLength = OptionalParameters.dShortPartLength or BeamData.LEN_SHORT_PART local EdgeToMachineTop = OptionalParameters.EdgeToMachineTop local EdgeToMachineBottom = OptionalParameters.EdgeToMachineBottom + local bIsDicing = OptionalParameters.bIsDicing local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength -- TODO qui sarebbe meglio avere dExtra come OptionalParameter??? @@ -288,6 +289,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters) FaceToMachine = Face, EdgeToMachine = EdgeToMachineTop, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -302,6 +304,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters) FaceToMachine = Face, EdgeToMachine = EdgeToMachineBottom, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -368,6 +371,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters) local bReduceBladePath = OptionalParameters.bReduceBladePath or false local bAllowFastCuts = OptionalParameters.bAllowFastCuts or false local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1] + local bIsDicing = OptionalParameters.bIsDicing or false local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail' local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false -- lati da lavorare in base al tipo di lama @@ -386,6 +390,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters) EdgeToMachineTop = EdgeToMachineList.Top, EdgeToMachineBottom = EdgeToMachineList.Bottom, nToolIndex = nToolIndex, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength } @@ -437,6 +442,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = EdgeToMachineList.TopGuillotine, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -469,6 +475,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) OptionalParameters = OptionalParameters or {} local nToolIndex = OptionalParameters.nToolIndex local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1] + local bIsDicing = OptionalParameters.bIsDicing or false local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail' local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false @@ -492,6 +499,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = EdgeToMachine, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -504,6 +512,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN), Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -525,6 +534,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN), Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -543,6 +553,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = EdgeToMachine, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -578,6 +589,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) FaceToMachine = FaceToMachine, EdgeToMachine = EdgeToMachine, Part = Part, + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }) @@ -595,6 +607,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters) dDepthToMachine = dDepthToMachine } local BladeEngagementOptionalParameters = { + bIsDicing = bIsDicing, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength } @@ -790,8 +803,7 @@ local function CalculateDiceMachinings( vCuts, Parameters) SetDiceFaceInfo( Proc, vCuts[i][j]) if ( i % 2) == 1 then local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT) - if ( MainFace.vtN:getY() > 0.766 and vtO:getY() < -0.05) or - ( MainFace.vtN:getY() < -0.766 and vtO:getY() > 0.05) then + if MachiningLib.IsFaceZOutOfRange( vtO, Tool) then EgtInvertSurf( vCuts[i][j]) bAreOrthogonalCutsInverted = true end @@ -836,6 +848,7 @@ local function CalculateDiceMachinings( vCuts, Parameters) end -- calcolo lavorazione della singola faccia -- per tagli paralleli e faccia aperta si prova a tagliare come se fosse una faccia singola, accorpando i tagli + -- TODO bIsDicing è da mettere a true? local bCanMergeParallelCuts = ( ( i % 2) == 0) and ( Proc.nFct == 1) local bIsDicingOk = true if bCanMergeParallelCuts then @@ -847,6 +860,7 @@ local function CalculateDiceMachinings( vCuts, Parameters) nToolIndex = Tool.nIndex, dExtendAfterTail = dExtendAfterTail, bReduceBladePath = bReduceBladePath, + bIsDicing = false, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, bCannotSplitRestLength = bCannotSplitRestLength }