diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index ee3f01e..849765b 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -477,14 +477,27 @@ function MachiningLib.ApplyMachining( bRecalc, bApplyPost) end ------------------------------------------------------------------------------------------------------------- --- funzione che restituisce l'indice MRR (Material Removal Rate) della strategia. -function MachiningLib.GetToolMRR( dMachiningStep, dMachiningSideStep, dFeed) +-- funzione che restituisce l'indice MRR (Material Removal Rate) della strategia. Dati in ingresso: Step, SideStep, Feed, ToolIndex, MachiningType +function MachiningLib.GetToolMRR( Parameters) local dMRR = 1 - -- Unità: dm/min per avere un indice vicino alle unità - dMRR = ( dMachiningStep * dMachiningSideStep * dFeed) / pow( 10, 6) + -- se ho già tutti i parametri + if not Parameters.dStep or not Parameters.dSideStep or not Parameters.dFeed then + -- se manca qualche parametro, lo recupero da parametro di default dell'utensile + if Parameters.nToolIndex then + Parameters.dStep = Parameters.dStep or TOOLS[Parameters.nToolIndex].dStep + Parameters.dSideStep = Parameters.dSideStep or TOOLS[Parameters.nToolIndex].dSideStep + Parameters.dFeed = Parameters.dFeed or TOOLS[Parameters.nToolIndex].Feeds.dFeed + -- se non riesco a calcolare, ritorno un indice molto basso + else + return GEO.EPS_SMALL + end + end - return dMRR + dMRR = Parameters.dStep * Parameters.dSideStep * Parameters.dFeed + + -- Unità: dm/min per avere un indice vicino alle unità + return dMRR / pow( 10, 6) end ------------------------------------------------------------------------------------------------------------- diff --git a/Strategies/STR0002/STR0002.lua b/Strategies/STR0002/STR0002.lua index 81cb065..8d7a41c 100644 --- a/Strategies/STR0002/STR0002.lua +++ b/Strategies/STR0002/STR0002.lua @@ -84,7 +84,9 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters) local dCompletionPercentage = min( 100, ( ( Proc.MainFaces.BottomFace.dElevation - ToolInfo.dResidualDepth) / Proc.MainFaces.BottomFace.dElevation) * 100) Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dCompletionPercentage) Strategy.Result.nQuality = FeatureData.GetFeatureQuality( 'Mill') - Strategy.Result.dMRR = MachiningLib.GetToolMRR( TOOLS[ToolInfo.nToolIndex].dStep, TOOLS[ToolInfo.nToolIndex].dSideStep, TOOLS[ToolInfo.nToolIndex].Feeds.dFeed) + local ParametersMRR = {} + ParametersMRR.nToolIndex = nToolIndex + Strategy.Result.dMRR = MachiningLib.GetToolMRR( ParametersMRR) Strategy.Result.sInfo = '' -- se richiesto applico lavorazione