diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 5dffeb5..de0daca 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -263,6 +263,8 @@ local function GetBottomFaces( Proc) elseif not ( Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Bevel') then error( 'GetBottomFace : Topology not implemented') + elseif Proc.nFct == 1 then + return { Proc.Faces[1]} end -- la faccia di fondo ha sempre Fct - 1 adiacenze @@ -346,6 +348,8 @@ local function GetLongFaces( Proc, MainFaces) if Proc.nFct > 5 then error( 'GetLongFaces : Topology not implemented') + elseif Proc.nFct == 1 then + return {} end local BottomFace @@ -442,6 +446,8 @@ local function GetSideFaces( Proc, MainFaces) if Proc.nFct > 5 then error( 'GetSideFaces : Topology not implemented') + elseif Proc.nFct == 1 then + return {} end local BottomFace @@ -528,7 +534,7 @@ function FaceData.GetMainFaces( Proc, Part) local MainFaces = {} -- CASO 1 : Feature tipo LapJoint - if Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or + if Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' then if Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5 then diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index 3262aff..c45cdba 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -66,7 +66,7 @@ function GetTenonStrategy( Proc, Part) if Machining.bCuttingWithMill and ( not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit) then ToolSearchParameters = {} ToolSearchParameters.dElevation = 0 - ToolSearchParameters.vtToolDirection = Proc.vtTenonN + ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) if Machining.Cutting.ToolInfo.nToolIndex then Machining.Cutting.bIsApplicable = true @@ -100,40 +100,43 @@ function GetTenonStrategy( Proc, Part) end end - -- === ricerca utensile di svuotatura (se richiesto) === - Machining.nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep) - if Machining.nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then - Machining.Pocketing.bNotNeeded = true - Machining.Pocketing.dMRR = Machining.Milling.dMRR - -- serve svuotatura - else - -- se ammessa svuotatura con utensile DoveTail, copio i dati - if Strategy.Parameters.bUseDTToolOnPocketing then - Machining.Pocketing.bIsApplicable = true - Machining.Pocketing.ToolInfo = Machining.Milling.ToolInfo + -- === ricerca utensile di svuotatura (se richiesto e se รจ andata a buon fine la coda di rondine) === + if Machining.Milling.bIsApplicable then + Machining.nMillingPathsNeeded = ceil( Proc.FeatureInfo.dTenonMaxDist / TOOLS[Machining.Milling.ToolInfo.nToolIndex].dSideStep) + if Machining.nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then + Machining.Pocketing.bNotNeeded = true Machining.Pocketing.dMRR = Machining.Milling.dMRR - -- altrimenti serve cercarne un altro + -- serve svuotatura else - ToolSearchParameters = {} - ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength - ToolSearchParameters.vtToolDirection = Proc.vtTenonN - Machining.Pocketing.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) - if Machining.Pocketing.ToolInfo.nToolIndex then + -- se ammessa svuotatura con utensile DoveTail, copio i dati + if Strategy.Parameters.bUseDTToolOnPocketing then Machining.Pocketing.bIsApplicable = true - local ParametersMRR = {} - ParametersMRR.nToolIndex = Machining.Pocketing.ToolInfo.nToolIndex - Result.Pocketing.dMRR = MachiningLib.GetToolMRR( ParametersMRR) - if Machining.Pocketing.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then - Result.Pocketing.sStatus = 'Completed' - Result.Pocketing.dCompletionPercentage = 100 - else - Result.Pocketing.sStatus = 'Not-Completed' - Result.Pocketing.sInfo = 'Tenon not complete, left ' .. ceil( Machining.Pocketing.ToolInfo.dResidualDepth) .. 'mm' - Result.Pocketing.dCompletionPercentage = ( 1 - Machining.Pocketing.ToolInfo.dResidualDepth / Proc.dDTLength) * 100 + Machining.Pocketing.ToolInfo = Machining.Milling.ToolInfo + Machining.Pocketing.dMRR = Machining.Milling.dMRR + -- altrimenti serve cercarne un altro + else + ToolSearchParameters = {} + ToolSearchParameters.dElevation = Proc.FeatureInfo.dTenonLength + ToolSearchParameters.vtToolDirection = Proc.vtTenonN + Machining.Pocketing.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) + if Machining.Pocketing.ToolInfo.nToolIndex then + Machining.Pocketing.bIsApplicable = true + local ParametersMRR = {} + ParametersMRR.nToolIndex = Machining.Pocketing.ToolInfo.nToolIndex + Result.Pocketing.dMRR = MachiningLib.GetToolMRR( ParametersMRR) + if Machining.Pocketing.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then + Result.Pocketing.sStatus = 'Completed' + Result.Pocketing.dCompletionPercentage = 100 + else + Result.Pocketing.sStatus = 'Not-Completed' + Result.Pocketing.sInfo = 'Tenon not complete, left ' .. ceil( Machining.Pocketing.ToolInfo.dResidualDepth) .. 'mm' + Result.Pocketing.dCompletionPercentage = ( 1 - Machining.Pocketing.ToolInfo.dResidualDepth / Proc.dDTLength) * 100 + end end end end end + return Machining, Result end diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 3c2c364..9d9b18d 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -131,19 +131,25 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) -- controlli preventivi if Proc.nFct > 3 then error( 'BladeKeepWaste : max 3 faces supported') + -- per angolo tra le facce >= 90deg (feature convessa) non applicabile elseif Proc.nFct == 2 then if Proc.AdjacencyMatrix[1][2] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[1][2] < -91 then - error( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + return Machinings, Result end + -- caso speciale RidgeLap - per angolo tra le facce >= 90deg (feature convessa) non applicabile elseif Proc.nFct == 3 then if Proc.AdjacencyMatrix[1][2] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[1][2] < -91 then - error( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + return Machinings, Result end if Proc.AdjacencyMatrix[1][3] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[1][3] < -91 then - error( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + return Machinings, Result end if Proc.AdjacencyMatrix[2][3] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[2][3] < -91 then - error( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : angle between faces must be concave and >= 90deg') + return Machinings, Result end end diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 2aaf0ec..5edf140 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -647,7 +647,7 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters) -- calcolo risultati Result.nQuality = FeatureLib.GetStrategyQuality( Machinings) - Result.dCompletionPercentage = dAreaToMachineTotal / ( Proc.Faces[1].dArea + Proc.Faces[2].dArea) * 100 + Result.dCompletionPercentage = dAreaToMachineTotal / ( EgtSurfArea( idFace1) + EgtSurfArea( idFace2)) * 100 Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Result.dCompletionPercentage) Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings) Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6)