From d45fc8e89b7ab352eb03e06eaa2caab72592d55e Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 8 May 2024 15:32:51 +0200 Subject: [PATCH] - Prima versione file INI interfaccia selezione strategie Beam&Wall - BeamLib : nuova funzione 'LoadCustomParametersInStrategy' - Piccoli aggiustamenti vari --- LuaLibs/BasicCustomerStrategies.lua | 4 +- LuaLibs/BeamExec.lua | 2 +- LuaLibs/BeamLib.lua | 18 +++++ LuaLibs/FaceData.lua | 25 ++++--- Strategies/STR0001/STR0001.lua | 1 + Strategies/STR0001/STR0001Config.lua | 7 +- Strategies/STR0002/STR0002.lua | 1 + Strategies/STR0002/STR0002Config.lua | 4 +- Strategies/Strategies.ini | 106 +++++++++++++++++++++++++++ 9 files changed, 148 insertions(+), 20 deletions(-) create mode 100644 Strategies/Strategies.ini diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 923116c..29175e9 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -27,7 +27,7 @@ local function GetStrategies_Egalware( Proc) if true or ID.IsHeadCut( Proc) then -- TODO TOGLIERE IL true PER FORZARE IF!!! PROVVISORIO PER PROVARE STRATEGIE if Proc.Topology.Name == 'FEATURE' then Strategy_Egalware = { - StrategyId = 'STR0010', + StrategyId = 'STR0001', Parameters = { { Value = '15', Name = 'Step', Type = 'd'}, { Value = 'false', Name = 'AntiSplint', Type = 'b'} @@ -206,7 +206,7 @@ local function GetStrategies_Essetre( Proc) if true or ID.IsHeadCut( Proc) then -- TODO TOGLIERE IL true PER FORZARE IF!!! PROVVISORIO PER PROVARE STRATEGIE if Proc.Topology.Name == 'FEATURE' then Strategy_Essetre = { - StrategyId = 'STR0010', + StrategyId = 'STR0001', Parameters = { { Value = '15', Name = 'Step', Type = 'd'}, { Value = 'false', Name = 'AntiSplint', Type = 'b'} diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 94c87d0..d30559f 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -496,7 +496,7 @@ local function CollectFeatures( PartId, Part) Proc.Topology = {} if FeatureData.NeedTopologyFeature( Proc) then Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc) - Proc.Faces = FaceData.GetFacesInfo( Proc) + Proc.Faces = FaceData.GetFacesInfo( Proc, Part) Proc.Topology = FeatureData.ClassifyTopology( Proc, Part) else Proc.Topology.Family = 'FEATURE' diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 5398f1f..b4075bd 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -259,5 +259,23 @@ function BeamLib.GetUpdateCustomParameters( CustomStrategyParamList, DefaultStra return DefaultStrategyParamList end +------------------------------------------------------------------------------------------------------------- +-- si traduce la tabella dei parametri con tutte le informazioni in una lista contenente i parametri utilizzabili con accesso diretto +function BeamLib.LoadCustomParametersInStrategy( CustomParameters) + local Parameters = {} + if CustomParameters and #CustomParameters > 0 then + for i=1, #CustomParameters do + if CustomParameters[i].Type == 'b' then + Parameters[CustomParameters[i].Name] = CustomParameters[i].Value == 'true' + elseif CustomParameters[i].Type == 'd' then + Parameters[CustomParameters[i].Name] = tonumber( CustomParameters[i].Value) + else -- CustomParameters.Type == 's' + Parameters[CustomParameters[i].Name] = CustomParameters[i].Value + end + end + end + return Parameters +end + ------------------------------------------------------------------------------------------------------------- return BeamLib diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 2069209..1251de5 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -111,7 +111,7 @@ function FaceData.GetFacesByAdjacencyNumber( Proc) end ------------------------------------------------------------------------------------------------------------- -function FaceData.GetFacesInfo( Proc) +function FaceData.GetFacesInfo( Proc, Part) EgtOutLog( '---Faces START---') local Faces = {} @@ -131,7 +131,7 @@ function FaceData.GetFacesInfo( Proc) Faces[i].Id = i - 1 Faces[i].PtCenter, Faces[i].VtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) if Proc.Fct < 6 then - local frHV, dFaceWidth, dFaceHeight = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1) + local frHV, dFaceWidth, dFaceHeight = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1, Part) -- frame OCS faccia Faces[i].FrameHV = frHV -- larghezza OCS faccia @@ -216,19 +216,20 @@ local function GetBottomFace( Proc) -- la faccia di fondo ha sempre Fct - 1 adiacenze. Se si trovano più facce di fondo si sceglie quella con minor elevazione local FacesByAdjacencyNumber = FaceData.GetFacesByAdjacencyNumber( Proc) - local BottomFaces = FacesByAdjacencyNumber[ Proc.Fct - 1] - if #BottomFaces > 1 then - local dMinElevation = GEO.INFINITO - for i = 1, #BottomFaces do - if Proc.Faces[BottomFaces[i].Id + 1].Elevation < dMinElevation then - dMinElevation = Proc.Faces[BottomFaces[i].Id + 1].Elevation - BottomFace = Proc.Faces[BottomFaces[i].Id + 1] + if FacesByAdjacencyNumber then + local BottomFaces = FacesByAdjacencyNumber[ Proc.Fct - 1] + if #BottomFaces > 1 then + local dMinElevation = GEO.INFINITO + for i = 1, #BottomFaces do + if Proc.Faces[BottomFaces[i].Id + 1].Elevation < dMinElevation then + dMinElevation = Proc.Faces[BottomFaces[i].Id + 1].Elevation + BottomFace = Proc.Faces[BottomFaces[i].Id + 1] + end end + else + BottomFace = BottomFaces[1] end - else - BottomFace = BottomFaces[1] end - return BottomFace end diff --git a/Strategies/STR0001/STR0001.lua b/Strategies/STR0001/STR0001.lua index b8bc90e..10521f5 100644 --- a/Strategies/STR0001/STR0001.lua +++ b/Strategies/STR0001/STR0001.lua @@ -12,6 +12,7 @@ function STR0001.Make( AddMachining, Proc, Part, CustomParameters) local StrategyLib = {} StrategyLib.Config = require( 'STR0001\\STR0001Config') CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters) + StrategyParameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters) end diff --git a/Strategies/STR0001/STR0001Config.lua b/Strategies/STR0001/STR0001Config.lua index 5084f82..abf82f0 100644 --- a/Strategies/STR0001/STR0001Config.lua +++ b/Strategies/STR0001/STR0001Config.lua @@ -3,9 +3,10 @@ local STR0001Data = { StrategyId = 'STR0001', Parameters = { - { Value = '15', Name = 'Step', Description = 'Questo è lo step di lavorazione', Type = 'd'}, - { Value = '2', Name = 'Depth', Description = 'Affondamento lavorazione', Type = 'd'}, - { Value = 'false', Name = 'AntiSplint', Description = 'Antischeggia', Type = 'b'} + { Name = 'OverMatOnLenght', Value = '0', Description = 'Sovramateriale lunghezza tenone', Type = 'd'}, + { Name = 'OverMatOnRadius', Value = '0', Description = 'Sovramateriale larghezza tenone', Type = 'd'}, + { Name = 'MaxMillingPaths', Value = '3', Description = 'Numero massimo di passaggi di fresatura. Se richiesti più passaggi, si fa svuotatura', Type = 'd'}, + { Name = 'UseDTToolOnPocketing', Value = 'true', Description = 'Utilizza utensile a coda di rondimne per fare svuotatura', Type = 'b'} } } diff --git a/Strategies/STR0002/STR0002.lua b/Strategies/STR0002/STR0002.lua index bcc12ff..f435d6e 100644 --- a/Strategies/STR0002/STR0002.lua +++ b/Strategies/STR0002/STR0002.lua @@ -12,6 +12,7 @@ function STR0002.Make( AddMachining, Proc, Part, CustomParameters) local StrategyLib = {} StrategyLib.Config = require( 'STR0002\\STR0002Config') CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters) + StrategyParameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters) end diff --git a/Strategies/STR0002/STR0002Config.lua b/Strategies/STR0002/STR0002Config.lua index 7aa2cf4..06f7e67 100644 --- a/Strategies/STR0002/STR0002Config.lua +++ b/Strategies/STR0002/STR0002Config.lua @@ -3,8 +3,8 @@ local STR0002Data = { StrategyId = 'STR0002', Parameters = { - { Value = '10', Name = 'Step', Description = 'Questo è lo step di lavorazione', Type = 'd'}, - { Value = '5', Name = 'Depth', Description = 'Affondamento lavorazione', Type = 'd'}, + { Name = 'Step', Value = '10', Description = 'Questo è lo step di lavorazione', Type = 'd'}, + { Name = 'Depth', Value = '5', Description = 'Affondamento lavorazione', Type = 'd'}, } } diff --git a/Strategies/Strategies.ini b/Strategies/Strategies.ini new file mode 100644 index 0000000..3e93932 --- /dev/null +++ b/Strategies/Strategies.ini @@ -0,0 +1,106 @@ +; Commento per evitare BOM con UTF-8 +[Comments] +STR0001 = Tenone a coda di rondine. Lama + fresa a coda di rondine + +[Strategies] +; Processing , Gruppo , Topologia , Strategie +;Feature : Cut +10,1,Feature, +;Feature : Longitudinal Cut +10,0,Feature, +;Feature : Double Cut +11,1,Feature, +; Feature : Ridge or Valley Cut +12,0,Feature, +; Feature : Saw Cut +13,0,Feature, +; Feature : Slot +16.0,Feature, +; Feature : Front Slot +17,0,Feature, +; Feature : Birds Mouth +20,0,Feature, +; Feature : Hip or Valley Rafter Notch +25,0,Feature, +; Feature : Ridge Lap +30,1,Feature, +; Feature : Lap Joint +30,0,Feature, +; Feature : Notch/Rabbet +32,0,Feature, +; Feature : Block Haus +33,0,Feature, +; Feature : Notch +34,0,Feature, +; Feature : French Ridge Lap +35,1,Feature, +; Feature : Chamfer +36,0,Feature, +; Feature : Block Haus Half Lap +37,0,Feature, +; Feature : Block Haus Front +38,0,Feature, +; Feature : Pocket +39,0,Feature, +; Feature : Drilling +40,0,Feature, +; Feature : Tenon +50,1,Feature, +; Feature : Mortise +50,0,Feature, +; Feature : Front Mortise +51,0,Feature, +; Feature : House +52,1,Feature, +; Feature : House Mortise +53,0,Feature, +; Feature : Dovetail Tenon +55,1,Feature,STR0001 +; Feature : Dovetail Mortise +55,0,Feature, +; Feature : Dovetail Mortise Front +56,0,Feature, +; Feature : Marking +60,0,Feature, +; Feature : Text +61,0,Feature, +; Feature : Scarf Simple +70,1,Feature, +; Feature : Scarf Joint +71,1,Feature, +; Feature : Step Joint +80,1,Feature, +; Feature : Step Joint Notch +80,0,Feature, +; Feature : Planing +90,0,Feature, +; Feature : Front Profile +100,0,Feature, +; Feature : Head Concave Profile +101,0,Feature, +; Feature : Head Convex Profile +102,0,Feature, +; Feature : Head Cambered Profile +103,0,Feature, +; Feature : Round Arch +104,0,Feature, +; Feature : Head Profile +106,0,Feature, +; Feature : Sphere +107,0,Feature, +; Feature : Triangle Cut +120,0,Feature, +; Feature : TyroleanDovetail +136,0,Feature, +; Feature : Dovetail +138,0,Feature, +; Feature : Free Contour +250,0,Feature, +; Feature : Outline +251,0,Feature, +; Feature : Aperture +252,0,Feature, +; Feature : Variant +900,0,Feature, +; Feature Decor +959,0,Feature,