From edf030367eabc8850876ad9d3a6de3fbbb689c92 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 19 May 2025 15:08:12 +0200 Subject: [PATCH] - introdotta STR0012 per RidgeLap, da completare e testare --- BatchProcessNew.lua | 2 +- LuaLibs/BasicCustomerStrategies.lua | 32 +---- LuaLibs/FeatureLib.lua | 2 - Strategies/AvailableStrategyList.json | 2 +- Strategies/Standard/STR0012/STR0012.json | 93 +++++++++++++ Strategies/Standard/STR0012/STR0012.lua | 167 +++++++++++++++++++++++ 6 files changed, 264 insertions(+), 34 deletions(-) create mode 100644 Strategies/Standard/STR0012/STR0012.json create mode 100644 Strategies/Standard/STR0012/STR0012.lua diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index 97ea391..09a263d 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -3,7 +3,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index a27b17a..c0e63e7 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -115,21 +115,7 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Ridge Lap (1-30) elseif ID.IsRidgeLap( Proc) then - if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-4-Blind' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-3-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Tunnel-4-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-3-Blind' then - Strategies = { { sStrategyId = 'STR0002'}} - elseif Proc.Topology.sName == 'Bevel-3-Blind' then - Strategies = { { sStrategyId = 'STR0002'}} - elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} - end + Strategies = { { sStrategyId = 'STR0012'}} --------------------------------------------------------------------- -- Feature : Lap Joint (0-30) elseif ID.IsLapJoint( Proc) then @@ -440,21 +426,7 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Ridge Lap (1-30) elseif ID.IsRidgeLap( Proc) then - if Proc.Topology.sName == 'Pocket-5-Blind' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-4-Blind' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-3-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Tunnel-4-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} - elseif Proc.Topology.sName == 'Groove-3-Blind' then - Strategies = { { sStrategyId = 'STR0002'}} - elseif Proc.Topology.sName == 'Bevel-3-Blind' then - Strategies = { { sStrategyId = 'STR0002'}} - elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} - end + Strategies = { { sStrategyId = 'STR0012'}} --------------------------------------------------------------------- -- Feature : Lap Joint (0-30) elseif ID.IsLapJoint( Proc) then diff --git a/LuaLibs/FeatureLib.lua b/LuaLibs/FeatureLib.lua index 6a87064..4e591d2 100644 --- a/LuaLibs/FeatureLib.lua +++ b/LuaLibs/FeatureLib.lua @@ -64,8 +64,6 @@ function FeatureLib.NeedTopologyFeature( Proc) return true elseif ID.IsBirdsMouth( Proc) then return true - elseif ID.IsRidgeLap( Proc) then - return true elseif ID.IsLapJoint( Proc) then return true elseif ID.IsNotchRabbet( Proc) then diff --git a/Strategies/AvailableStrategyList.json b/Strategies/AvailableStrategyList.json index 31d21b8..2eeb0f4 100644 --- a/Strategies/AvailableStrategyList.json +++ b/Strategies/AvailableStrategyList.json @@ -132,7 +132,7 @@ "nGrp": "1", "TopologyList" : [ { "sName": "Feature", - "StrategyList" : [ { "sStrategyId": "STR0011"} ] + "StrategyList" : [ { "sStrategyId": "STR0012"} ] } ] }, diff --git a/Strategies/Standard/STR0012/STR0012.json b/Strategies/Standard/STR0012/STR0012.json new file mode 100644 index 0000000..b6e504f --- /dev/null +++ b/Strategies/Standard/STR0012/STR0012.json @@ -0,0 +1,93 @@ +{ + "sStrategyId": "STR0012", + "ParameterList" : [ + { + "sName": "dExtendAfterTail", + "sNameNge": "EXTEND_AFTER_TAIL", + "sValue": "", + "sDescriptionShort": "Extend after tail", + "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sType": "d", + "sMessageId": " ", + "sMinUserLevel": "1" + }, + { + "sName": "sCanDamageNextPiece", + "sNameNge": "DAMAGE_NEXT_PIECE", + "sValue": "NEVER", + "sDescriptionShort": "Damage next piece", + "sDescriptionLong": "This option allows you to decide how to consider the next piece in the bar. The software calculates specifics LeadIn/out to respect the parameter. This parameter may change the machining time", + "sType": "combo", + "sMinUserLevel": "1", + "Choices": [ + { + "sValue": "NEVER", + "sDescriptionShort": "Never damage", + "sDescriptionLong": "", + "sMessageId": "" + }, + { + "sValue": "ONLY_IF_RAWPART", + "sDescriptionShort": "Damage only if raw", + "sDescriptionLong": "", + "sMessageId": "" + }, + { + "sValue": "ALWAYS", + "sDescriptionShort": "Can damage", + "sDescriptionLong": "", + "sMessageId": "" + } + ] + }, + { + "sName": "sRidgelapStrategy", + "sNameNge": "RIDGELAP_STRATEGY", + "sValue": "AUTO", + "sDescriptionShort": "Ridge Lap strategy", + "sDescriptionLong": "", + "sType": "combo", + "sMinUserLevel": "1", + "Choices": [ + { + "sValue": "AUTO", + "sDescriptionShort": "Automatic", + "sDescriptionLong": "", + "sMessageId": "" + }, + { + "sValue": "BLADE", + "sDescriptionShort": "Use blade", + "sDescriptionLong": "", + "sMessageId": "" + }, + { + "sValue": "MILL", + "sDescriptionShort": "Use mill", + "sDescriptionLong": "", + "sMessageId": "" + } + ] + }, + { + "sName": "dMinZAngleTopBlade", + "sNameNge": "MIN_Z_ANGLE_TOP_BLADE", + "sValue": "", + "sDescriptionShort": "Min Z angle top blade", + "sDescriptionLong": "", + "sType": "d", + "sMessageId": " ", + "sMinUserLevel": "1" + }, + { + "sName": "dMaxYAngleTopBlade", + "sNameNge": "MAX_Y_ANGLE_TOP_BLADE", + "sValue": "", + "sDescriptionShort": "Max Y angle top blade", + "sDescriptionLong": "", + "sType": "d", + "sMessageId": " ", + "sMinUserLevel": "1" + } + ] +} \ No newline at end of file diff --git a/Strategies/Standard/STR0012/STR0012.lua b/Strategies/Standard/STR0012/STR0012.lua new file mode 100644 index 0000000..3b4b89f --- /dev/null +++ b/Strategies/Standard/STR0012/STR0012.lua @@ -0,0 +1,167 @@ +-- Strategia: STR0012 +-- Descrizione +-- RidgeLap +-- Feature: RidgeLap + +-- carico librerie +local BeamLib = require( 'BeamLib') +local BeamData = require( 'BeamData') +local MachiningLib = require( 'MachiningLib') +local FeatureLib = require( 'FeatureLib') +-- strategie di base +local BladeToWaste = require( 'BLADETOWASTE') + +-- Tabella per definizione modulo +local STR0012 = {} +local Strategy = {} +local RidgeLap = {} + +------------------------------------------------------------------------------------------------------------- +function STR0012.Make( bAddMachining, Proc, Part, CustomParameters) + -- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) + local StrategyLib = {} + StrategyLib.Config = STRATEGIES_CONFIG[CustomParameters.sStrategyId] + Strategy.sName = StrategyLib.Config.sStrategyId + Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( Proc, CustomParameters, StrategyLib.Config) + Strategy.Result = {} + Strategy.Result.sInfo = '' + RidgeLap.Result = {} + local dTimeToMachine = 0 + local dMRRBlade = 0 + local dCompletionPercentage = 0 + local nQuality = 0 + local dMRRBladeAddedFace = 0 + local dCompletionPercentageAddedFace = 0 + local nQualityAddedFace = 0 + + -- RidgeLap ha sempre 3 facce + if Proc.nFct ~= 3 then + Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'RidgeLap must have 3 faces') + end + + -- estensione oltre la coda + local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) + if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then + dExtendAfterTail = 10000 + end + + -- separazione della terza faccia + local idAddedTmFace + local nAddedFace + if Proc.AdjacencyMatrix[1][2] > 10 * GEO.EPS_ANG_SMALL and Proc.AdjacencyMatrix[2][3] < 10 * GEO.EPS_ANG_SMALL then + nAddedFace = 1 - 1 + elseif Proc.AdjacencyMatrix[2][3] > 10 * GEO.EPS_ANG_SMALL and Proc.AdjacencyMatrix[3][1] < 10 * GEO.EPS_ANG_SMALL then + nAddedFace = 2 - 1 + else + nAddedFace = 3 - 1 + end + -- recupero gruppo per geometria addizionale + local nAddGrpId = BeamLib.GetAddGroup( Part.id) + -- faccia aggiuntiva da lavorare + idAddedTmFace = EgtCopySurfTmFacet( Proc.id, nAddedFace, nAddGrpId) + -- rimozione della terza faccia dalla Proc + local idNewProc = EgtCopyGlob( Proc.id, nAddGrpId) + EgtSurfTmRemoveFacet( idNewProc, nAddedFace) + Proc = FeatureLib.GetProcFromTrimesh( idNewProc, Part, Proc) + + -- considerazioni necessarie a determinare se lavorare con codolo oppure no + local bKeepWasteAttached = ( Strategy.Parameters.sCuttingStrategy == 'KEEP_WASTE_ATTACHED') + local bDropWaste = ( Strategy.Parameters.sCuttingStrategy == 'DROP_WASTE') + local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part) + local bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) + local bIsFeatureLong = FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) + + -- lavorazione a cubetti facce concave + local dMinZTopBlade + local dMaxNyTopBlade + local BladeToWasteResult + if Strategy.Parameters.dMinZAngleTopBlade then + dMinZTopBlade = sin( Strategy.Parameters.dMinZAngleTopBlade) + end + if Strategy.Parameters.dMaxYAngleTopBlade then + dMaxNyTopBlade = sin( Strategy.Parameters.dMaxYAngleTopBlade) + end + local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume, + dMaxWasteLength = Strategy.Parameters.dMaxWasteLength, + dMinNzTopBlade = dMinZTopBlade, + dMaxNyTopBlade = dMaxNyTopBlade, + bSaveAddedGeometries = bAddMachining, + dExtendAfterTail = dExtendAfterTail + } + RidgeLap.Result, BladeToWasteResult = BladeToWaste.Make( Proc, Part, OptionalParameters) + dTimeToMachine = BladeToWasteResult.dTimeToMachine + dMRRBlade = BladeToWasteResult.dMRR + dCompletionPercentage = BladeToWasteResult.dCompletionPercentage + nQuality = BladeToWasteResult.nQuality + + -- lavorazione terza faccia + -- TODO da completare + -- TODO va messa per prima???????? + if idAddedTmFace then + local dMinZTopBlade + local dMaxNyTopBlade + local BladeToWasteResult + if Strategy.Parameters.dMinZAngleTopBlade then + dMinZTopBlade = sin( Strategy.Parameters.dMinZAngleTopBlade) + end + if Strategy.Parameters.dMaxYAngleTopBlade then + dMaxNyTopBlade = sin( Strategy.Parameters.dMaxYAngleTopBlade) + end + local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume, + dMaxWasteLength = Strategy.Parameters.dMaxWasteLength, + dMinNzTopBlade = dMinZTopBlade, + dMaxNyTopBlade = dMaxNyTopBlade, + bSaveAddedGeometries = bAddMachining, + dExtendAfterTail = dExtendAfterTail + } + RidgeLap.Result, BladeToWasteResult = BladeToWaste.Make( idAddedTmFace, Part, OptionalParameters) + + -- TODO calcolo risultati da aggiornare con funzioni nuove + dMRRBladeAddedFace = BladeToWasteResult.dMRR + dCompletionPercentageAddedFace = BladeToWasteResult.dCompletionPercentage + nQualityAddedFace = BladeToWasteResult.nQuality + + dTimeToMachine = dTimeToMachine + BladeToWasteResult.dTimeToMachine + -- la faccia aggiuntiva conta per 1/3 + dMRRBlade = 2/3 * dMRRBlade + 1/3 * dMRRBladeAddedFace + dCompletionPercentage = 2/3 * dCompletionPercentage + 1/3 * dCompletionPercentageAddedFace + nQuality = 2/3 * nQuality + 1/3 * nQualityAddedFace + end + + -- aggiunta lavorazioni + local nIsApplicableCount = 0 + local bAreAllMachiningsAdded = true + for i = 1, #RidgeLap.Result do + if RidgeLap.Result[i].bIsApplicable then + nIsApplicableCount = nIsApplicableCount + 1 + if bAddMachining then + local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, RidgeLap.Result[i]) + if not bIsMachiningAdded then + bAreAllMachiningsAdded = false + end + end + Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. RidgeLap.Result[i].sMessage + end + end + -- TODO migliorare calcolo area lavorata; se ho il codolo ha senso l'incompleta? se incompleta con codolo faccio i cubetti?? + -- TODO settare che il codolo restituisce incompleta tranne quando รจ forzato + if nIsApplicableCount > 0 then + if dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then + Strategy.Result.sStatus = 'Completed' + else + Strategy.Result.sStatus = 'Not-Completed' + end + else + Strategy.Result.sStatus = 'Not-Applicable' + end + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage) + Strategy.Result.nQuality = nQuality + Strategy.Result.dTimeToMachine = dTimeToMachine + Strategy.Result.dMRR = dMRRBlade + + return bAreAllMachiningsAdded, Strategy.Result +end + +------------------------------------------------------------------------------------------------------------- + + return STR0012 \ No newline at end of file