--BasicCustomerStrategies.lua by Egalware s.r.l. 2024/04/02 -- Libreria strategie di base disponibili per i clienti -- 2024/04/02 PRIMA VERSIONE CALCOLO LAVORAZIONI CON STRATEGIE -- Tabella per definizione modulo local BasicCustomerStrategies = {} -- Include require( 'EgtBase') -- Carico i dati globali local BeamData = require( 'BeamDataNew') local BeamLib = require( 'BeamLib') local ID = require( 'Identity') -- TODO tabella da compleatare man mano che si inseriscono le varie strategie -- ESEMPIO SCRITTURA TABELLA CON STRATEGIE DISPONIBILI --------------------------------------------------------------------- -- Feature : Cut -- if ID.TipoFeature( Proc) then -- if Proc.Topology.sName == 'QQQQQQQQQ' then -- Strategies = { -- { sStrategyId = 'STR9999', -- Parameters = { -- { sName = 'Val_1', sValue = '15', sType = 'd'}, -- { sName = 'Val_2', sValue = 'false', sType = 'b'} -- } -- } -- { sStrategyId = 'STR9998'} -- } -- end -- end ---------------------------------------------------------------------------------- -- *** STRATEGIE *** ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** EGALWARE *** ---------------------------------------------------------------------------------- local function GetStrategies_Egalware( Proc) local Strategies = {} local sFile = BEAM.BASEDIR .. '\\Strategies\\AvailableStrategyList.json' -- se non esiste file JSON, annullo la lista contenente le strategie if not EgtExistsFile( sFile) then return nil end local CompleteList = {} CompleteList.FEATURE = BeamLib.ImportFileJSON( sFile) Strategies = BeamLib.GetStrategiesFromList( Proc, CompleteList) -- si salva che la strategia è stata presa dallo standard if Strategies and #Strategies > 0 then Strategies.bIsBasicStrategy = true end return Strategies end ---------------------------------------------------------------------------------- -- *** ESSETRE *** ---------------------------------------------------------------------------------- local function GetStrategies_Essetre( Proc) local Strategies = {} --------------------------------------------------------------------- -- Feature : Cut (1-10) if ID.IsHeadCut( Proc) then Strategies = { { sStrategyId = 'HEADCUT'}} --------------------------------------------------------------------- -- Feature : Cut (2-10) elseif ID.IsTailCut( Proc) then Strategies = { { sStrategyId = 'TAILCUT'}} --------------------------------------------------------------------- -- Feature : Cut (1-10) elseif ID.IsCut( Proc) then if Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'Bevel-1-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} elseif Proc.Topology.sName == 'HeadCut' then Strategies = { { sStrategyId = 'HEADCUT'}} elseif Proc.Topology.sName == 'TailCut' then Strategies = { { sStrategyId = 'TAILCUT'}} end --------------------------------------------------------------------- -- Feature : Longitudinal Cut (0-10) elseif ID.IsLongitudinalCut( Proc) then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Double Cut (1-11) elseif ID.IsDoubleCut( Proc) then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Ridge or Valley Cut (0-12) elseif ID.IsDoubleLongitudinalCut( Proc) then Strategies = { { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Saw Cut (0-13) elseif ID.IsSawCut( Proc) then if Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'Bevel-1-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Slot (0-16) elseif ID.IsSlot( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Front Slot (0-17) elseif ID.IsFrontSlot( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Birds Mouth (0-20) elseif ID.IsBirdsMouth( Proc) then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Hip or Valley Rafter Notch (0-25) elseif ID.IsHipValleyRafterNotch( Proc) then if Proc.Topology.sName == 'RafterNotch-5-Through' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Groove-3-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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Ridge Lap (1-30) elseif ID.IsRidgeLap( Proc) then if Proc.Topology.sName == 'RidgeLap-3-Through' then Strategies = { { sStrategyId = 'STR0012'}} 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Cut-1-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0005'}} end --------------------------------------------------------------------- -- Feature : Lap Joint (0-30) elseif ID.IsLapJoint( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Notch/Rabbet (0-32) elseif ID.IsNotchRabbet( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Block Haus (0-33) elseif ID.IsBlockHaus( Proc) then if Proc.Topology.sName == 'Groove-3-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0003'}, { sStrategyId = 'STR0004'}} end --------------------------------------------------------------------- -- Feature : Notch (0-32) elseif ID.IsNotch( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : French Ridge Lap (1-35) elseif ID.IsFrenchRidgeLap( Proc) then --------------------------------------------------------------------- -- Feature : Chamfer (0-36) elseif ID.IsChamfer( Proc) then --------------------------------------------------------------------- -- Feature : Block Haus Half Lap (0-37) elseif ID.IsHalfBlockHaus( Proc) then --------------------------------------------------------------------- -- Feature : Block Haus Front (0-38) elseif ID.IsFrontBlockHaus( Proc) then --------------------------------------------------------------------- -- Feature : Pocket (0-39) elseif ID.IsPocket( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Drilling (0-40) elseif ID.IsDrill( Proc) then Strategies = { { sStrategyId = 'STR0011'}, { sStrategyId = 'STR0013'}} --------------------------------------------------------------------- -- Feature : Tenon (1-50) elseif ID.IsTenon( Proc) then Strategies = { { sStrategyId = 'STR0006'}} --------------------------------------------------------------------- -- Feature : Mortise (0-50) elseif ID.IsMortise( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end --------------------------------------------------------------------- -- Feature : Front Mortise (0-51) elseif ID.IsFrontMortise( 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 == 'Bevel-2-Blind' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end --------------------------------------------------------------------- -- Feature : House (1-52) elseif ID.IsHouse( Proc) then --------------------------------------------------------------------- -- Feature : House Mortise (0-53) elseif ID.IsHouseMortise( Proc) then --------------------------------------------------------------------- -- Feature : Dovetail Tenon (1-55) elseif ID.IsDovetailTenon( Proc) then Strategies = { { sStrategyId = 'STR0001'}} --------------------------------------------------------------------- -- Feature : Dovetail Mortise (0-55) elseif ID.IsDovetailMortise( Proc) then Strategies = { { sStrategyId = 'STR0007'}} --------------------------------------------------------------------- -- Feature : Dovetail Mortise Front (0-56) elseif ID.IsFrontDovetailMortise( Proc) then Strategies = { { sStrategyId = 'STR0007'}} --------------------------------------------------------------------- -- Feature : Marking (0-60) elseif ID.IsMarking( Proc) then Strategies = { { sStrategyId = 'STR0014'}} --------------------------------------------------------------------- -- Feature : Text (0-61) elseif ID.IsText( Proc) then Strategies = { { sStrategyId = 'STR0014'}} --------------------------------------------------------------------- -- Feature : Scarf Simple (1-70) elseif ID.IsScarfSimple( Proc) then --------------------------------------------------------------------- -- Feature : Scarf Joint (1-71) elseif ID.IsScarfJoint( Proc) then --------------------------------------------------------------------- -- Feature : Step Joint (1-80) elseif ID.IsStepJoint( Proc) then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Step Joint Notch (0-80) elseif ID.IsStepJointNotch( Proc) then Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Planing (0-90) elseif ID.IsPlaning( Proc) then --------------------------------------------------------------------- -- Feature : Front Profile (0-100) elseif ID.IsFrontProfile( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Head Concave Profile (0-101) elseif ID.IsHeadConcaveProfile( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Head Convex Profile (0-102) elseif ID.IsHeadConvexProfile( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Head Cambered Profile (0-103) elseif ID.IsHeadCamberedProfile( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Round Arch (0-104) elseif ID.IsRoundArch( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Head Profile (0-106) elseif ID.IsHeadProfile( Proc) then Strategies = { { sStrategyId = 'STR0015'}} --------------------------------------------------------------------- -- Feature : Sphere (0-107) elseif ID.IsSphere( Proc) then --------------------------------------------------------------------- -- Feature : Triangle Cut (0-120) elseif ID.IsTriangleCut( Proc) then --------------------------------------------------------------------- -- Feature : TyroleanDovetail (0-136) elseif ID.IsTyroleanDovetail( Proc) then --------------------------------------------------------------------- -- Feature : Dovetail (0-138) elseif ID.IsDovetail( Proc) then --------------------------------------------------------------------- -- Feature : Free Contour (0-250) elseif ID.IsFreeContour( Proc) then --------------------------------------------------------------------- -- Feature : Outline (0-251) elseif ID.IsOutline( Proc) then --------------------------------------------------------------------- -- Feature : Aperture (0-252) elseif ID.IsAperture( Proc) then --------------------------------------------------------------------- -- Feature : Variant (0-900) elseif ID.IsVariant( Proc) then --------------------------------------------------------------------- end -- si salva che la strategia è stata presa dallo script if #Strategies > 0 then Strategies.bIsBasicStrategy = true end return Strategies end ---------------------------------------------------------------------------------- -- *** PARAMETRI *** ---------------------------------------------------------------------------------- ---------------------------------------------------------------------------------- -- *** ESSETRE *** ---------------------------------------------------------------------------------- -- funzione che recupera i parametri custom della strategia. Per cliente Essetre, vengono salvati dei valori 'Q' sul processing del file NGE per modificare il comportamento delle macro local function GetParameters_Essetre( Proc, sStrategyIdToGet) local Parameters = {} --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : HeadCut if ID.IsHeadCut( Proc) then -- Per Essetre non esiste il taglio di testa, quindi si leggono le variabili Q sul processing che coincide con il taglio di testa if sStrategyIdToGet == 'HEADCUT' then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q06', 'd') or 0 table.insert( Parameters, { sName = 'dDepthChamfer', sValue = dDepthChamfer, sType = 'd'}) local dCuttingStrategy = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q05', 'd') or 0 local bForceChainSaw = dCuttingStrategy > 0 table.insert( Parameters, { sName = 'bForceChainSaw', sValue = bForceChainSaw, sType = 'b'}) local bFinishWithMill = dCuttingStrategy == 2 table.insert( Parameters, { sName = 'bFinishWithMill', sValue = bFinishWithMill, sType = 'b'}) end --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Cut (1-10) elseif ID.IsCut( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q06', 'd') or 0 table.insert( Parameters, { sName = 'dDepthChamfer', sValue = dDepthChamfer, sType = 'd'}) local bForcePocketing = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q07', 'd') == 1 -- tutte le strategie che non siano svuotatura, devono essere rimosse if bForcePocketing and sStrategyIdToGet ~= 'STR0002' then Parameters.bToRemove = true else if sStrategyIdToGet == 'STR0002' then -- non ci sono Q per questa strategia elseif sStrategyIdToGet == 'STR0005' then local dCuttingStrategy = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q04', 'd') or 0 local sCuttingStrategy = EgtIf( dCuttingStrategy == 1, 'KEEP_WASTE_ATTACHED', 'AUTO') table.insert( Parameters, { sName = 'sCuttingStrategy', sValue = sCuttingStrategy, sType = 's'}) end end --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Drill (1-40) elseif ID.IsDrill( Proc) then if sStrategyIdToGet == 'STR0011' then local dDepthPreHole = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q03', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthPreHole', sValue = dDepthPreHole, sType = 'd'}) elseif sStrategyIdToGet == 'STR0013' then local bOnlyContouring = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0) == 1 table.insert( Parameters, { sName = 'bOnlyContouring', sValue = bOnlyContouring, sType = 'b'}) end local bDrillFromOneSide = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0) == 1 local sDrillingMode = EgtIf( bDrillFromOneSide, 'PREFER_ONE', 'AUTO') table.insert( Parameters, { sName = 'sDrillingMode', sValue = sDrillingMode, sType = 's'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Front Profile (0-100) elseif ID.IsFrontProfile( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0 local bOnlyChamfer = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q03', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'bOnlyChamfer' , sValue = bOnlyChamfer, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Head Concave Profile (0-101) elseif ID.IsHeadConcaveProfile( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0 local bOnlyChamfer = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q04', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'bOnlyChamfer' , sValue = bOnlyChamfer, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Head Convex Profile (0-102) elseif ID.IsHeadConvexProfile( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q04', 'd') or 0 local bOnlyChamfer = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'bOnlyChamfer' , sValue = bOnlyChamfer, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Head Cambered Profile (0-103) elseif ID.IsHeadCamberedProfile( Proc) then local sUpperFaceStrategy = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 's') or '' -- Q01 = forza fresa sUpperFaceStrategy = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 's') or sUpperFaceStrategy or 'AUTO' -- Q02 = forza lama (se entrambi attivi comanda la lama) table.insert( Parameters, { sName = 'sUpperFaceStrategy' , sValue = sUpperFaceStrategy, sType = 's'}) local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q03', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q04', 'd') or 0 local bOnlyChamfer = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q05', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'bOnlyChamfer' , sValue = bOnlyChamfer, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Round Arch (0-104) elseif ID.IsRoundArch( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q03', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0 local dStripWidth = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0) table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'dStripWidth' , sValue = dStripWidth, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) --###---###---###---###---###---###---###---###---###---###---###---###---###-- -- Feature : Head Profile (0-106) elseif ID.IsHeadProfile( Proc) then local dDepthChamfer = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q01', 'd') or 0 local dOverMaterial = EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q02', 'd') or 0 local bOnlyChamfer = ( EgtGetInfo( Proc.id or GDB_ID.NULL, 'Q03', 'd') or 0) == 1 table.insert( Parameters, { sName = 'dDepthChamfer' , sValue = dDepthChamfer, sType = 'd'}) table.insert( Parameters, { sName = 'bOnlyChamfer' , sValue = bOnlyChamfer, sType = 'b'}) table.insert( Parameters, { sName = 'dOverMaterial' , sValue = dOverMaterial, sType = 'd'}) end ------------------------------------------------------------------------------- return Parameters end ------------------------------------------------------------------------------------------------------------- -- funzione che verifica se un item è contenuto in lista local function Contains( List, Item) for _, value in ipairs( List) do if EgtStartsWith( Item, value) then return true end end return false end ------------------------------------------------------------------------------------------------------------- -- funzione che ritorna lista utensili presenti in lista compatibili con i tag passati local function GetToolsFromMachDataFile( MachiningDataList, TagListToGet) local ToolList = {} if MachiningDataList and #MachiningDataList > 0 and #TagListToGet > 0 then for nIndex = 1, #MachiningDataList do -- se utensile attivo e compatibile con TAG if MachiningDataList[nIndex].On and Contains( TagListToGet, MachiningDataList[nIndex].Type) then -- se è nuova versione, prendo il tool if MachiningDataList[nIndex].Tool then table.insert( ToolList, { sName = MachiningDataList[nIndex].Tool}) -- altrimenti dalla lavorazione si ricava il tool elseif MachiningDataList[nIndex].Name then if EgtMdbSetCurrMachining( MachiningDataList[nIndex].Name) then table.insert( ToolList, { sName = EgtMdbGetCurrMachiningParam( MCH_MP.TOOL)}) end end end end end return ToolList end ------------------------------------------------------------------------------------------------------------- -- TODO da completare -- funzione che recupera gli utensili disponibili per un certo tipo di lavorazione local function GetTools_Essetre( Proc, sMachiningCategory) local sMachDir = EgtGetCurrMachineDir() local TagList = {} local ToolList = {} -- CATEGORIE PREVISTE : -- Cutting -- Drill -- Milling, MillingFinish, MillingAntiSplint, MillingChamfer -- Pocketing -- ChainSawing if sMachiningCategory == 'Cutting' then if EgtExistsFile( sMachDir .. '\\Beam\\CutData.lua') then local CutData = dofile( sMachDir .. '\\Beam\\CutData.lua') if ID.IsDoubleLongitudinalCut( Proc) or ID.IsLongitudinalCut( Proc) then TagList = { 'LongCut'} else TagList = { 'HeadSide', 'TailSide'} end ToolList = GetToolsFromMachDataFile( CutData, TagList) end elseif sMachiningCategory == 'Drilling' or ID.IsDrill( Proc) then if EgtExistsFile( sMachDir .. '\\Beam\\DrillData.lua') then local DrillData = dofile( sMachDir .. '\\Beam\\DrillData.lua') if sMachiningCategory == 'Pocketing' or sMachiningCategory == 'Milling' then TagList = { 'Pocket'} else TagList = { 'Drill', 'Predrill', 'AngleDrill', 'MultiDrill'} end ToolList = GetToolsFromMachDataFile( DrillData, TagList) end elseif sMachiningCategory == 'Milling' or sMachiningCategory == 'MillingFinish' or sMachiningCategory == 'MillingAntiSplint' or sMachiningCategory == 'MillingChamfer' or sMachiningCategory == 'MillingSmooth' then if EgtExistsFile( sMachDir .. '\\Beam\\MillingData.lua') then local MillingData = dofile( sMachDir .. '\\Beam\\MillingData.lua') -- si cercano TAG esclusivi if sMachiningCategory == 'MillingSmooth' then TagList = { 'Mark', 'Text', 'Decor01', 'CleanCorner'} elseif sMachiningCategory == 'MillingAntiSplint' then TagList = { 'AntiSplintMillCut'} elseif ID.IsTenon( Proc) then TagList = { 'Tenon'} elseif ID.IsDovetailTenon( Proc) then -- gestione passaggio di taglio tenone superiore in caso di P14>0. Si prendono le frese per tenone standard dato che serve fresa cilindrica if sMachiningCategory == 'MillingFinish' then TagList = { 'Tenon'} else TagList = { 'DtTenon'} end elseif ID.IsDovetailMortise( Proc) then TagList = { 'DtMortise'} elseif ID.IsFrontProfile( Proc) or ID.IsHeadConcaveProfile( Proc) or ID.IsHeadConvexProfile( Proc) or ID.IsHeadCamberedProfile( Proc) or ID.IsRoundArch( Proc) or ID.IsHeadProfile( Proc) then if sMachiningCategory == 'MillingFinish' then TagList = { 'Prof_end'} end if not TagList or #TagList == 0 then TagList = { 'Prof', 'Prof_end'} end elseif ID.IsFreeContour( Proc) then TagList = { 'FreeContour', 'Prof', 'Prof_end'} elseif ID.IsMarking( Proc) then TagList = { 'Mark'} elseif sMachiningCategory == 'MillingChamfer' then TagList = { 'Chamfer'} elseif ID.IsText( Proc) then TagList = { 'Text'} elseif ID.IsTyroleanDovetail( Proc) or ID.IsDovetail( Proc) then TagList = { 'ProfTCone', 'Long2Cut'} elseif ID.IsBirdsMouth( Proc) then TagList = { 'BirdsMouth'} elseif sMachiningCategory == 'MillingFinish' then TagList = { 'CleanCorner', 'SmallToolContour'} elseif ID.IsSlot( Proc) or ID.IsFrontSlot( Proc) or ID.IsLapJoint( Proc) or ID.IsNotchRabbet( Proc) or ID.IsNotch( Proc) or ID.IsPocket( Proc) or ID.IsMortise( Proc) or ID.IsFrontMortise( Proc) then TagList = { 'SideMillAsBlade', 'BHSideMill', 'Long2Cut', 'Long2CutDown', 'LongSmallCut', 'Long2CutSide'} elseif ID.IsDoubleLongitudinalCut( Proc) or ID.IsDoubleLongitudinalCut( Proc) then TagList = { 'Long2Cut', 'Long2CutDown', 'LongSmallCut', 'Long2CutSide'} end ToolList = GetToolsFromMachDataFile( MillingData, TagList) end elseif sMachiningCategory == 'Pocketing' then if EgtExistsFile( sMachDir .. '\\Beam\\PocketingData.lua') then local PocketingData = dofile( sMachDir .. '\\Beam\\PocketingData.lua') -- si cercano TAG esclusivi if ID.IsMortise( Proc) then TagList = { 'Mortise'} else TagList = { 'Pocket', 'OpenPocket'} end ToolList = GetToolsFromMachDataFile( PocketingData, TagList) end elseif sMachiningCategory == 'ChainSawing' then if EgtExistsFile( sMachDir .. '\\Beam\\SawingData.lua') then local SawingData = dofile( sMachDir .. '\\Beam\\SawingData.lua') TagList = { 'Sawing', 'Mortising'} ToolList = GetToolsFromMachDataFile( SawingData, TagList) end end return ToolList end ---------------------------------------------------------------------------------- -- *** Esecuzione *** ---------------------------------------------------------------------------------- -- script delle strategie di base standard definito con cliente (statico e non modificabile) -- se non esiste JSON configurazione, o se non ha trovato nessuna strategia, prova a cercare in questi script function BasicCustomerStrategies.GetStrategiesFromBasicCustomerStrategies( Proc) local StrategiesFromScript = {} -- CLIENTE : ESSETRE if EgtStartsWith( EgtGetCurrMachineName(), 'Essetre') then StrategiesFromScript = GetStrategies_Essetre( Proc) -- per tutti gli altri clienti, si carica standard di default EGALWARE else StrategiesFromScript = GetStrategies_Egalware( Proc) end return StrategiesFromScript end ---------------------------------------------------------------------------------- -- lettura parametri che personalizzano le strategie. I parametri di default sono decisi con cliente function BasicCustomerStrategies.GetParametersFromBasicCustomerStrategies( Proc, sStrategyIdToGet) local ParametersFromScript = {} -- CLIENTE : ESSETRE if EgtStartsWith( EgtGetCurrMachineName(), 'Essetre') then ParametersFromScript = GetParameters_Essetre( Proc, sStrategyIdToGet) else ParametersFromScript = nil end return ParametersFromScript end ---------------------------------------------------------------------------------- -- funzione che riprocessa le strategie dopo che sono stati letti tutti i parmetri function BasicCustomerStrategies.UpdateStrategies( AvailableStrategies) -- se la strategia è settata come da rimuovere, la si toglie dalla lista for nIndexStrategy = #AvailableStrategies, 1, -1 do if AvailableStrategies[nIndexStrategy].bToRemove then table.remove( AvailableStrategies, nIndexStrategy) end end return AvailableStrategies end ---------------------------------------------------------------------------------- -- lettura utensili disponibili settati in lista machining data function BasicCustomerStrategies.GetToolsFromMachiningDataFile( Proc, sToolType) local ToolList = {} -- CLIENTE : ESSETRE if EgtStartsWith( EgtGetCurrMachineName(), 'Essetre') then ToolList = GetTools_Essetre( Proc, sToolType) -- l'ordine di come le lavorazioni sono state in lista deve essere rispettato ToolList.bRespectListOrder = true -- per tutti gli altri si considerano tutti gli utensili a disposizione else ToolList = nil end return ToolList end ------------------------------------------------------------------------------------------------------------- return BasicCustomerStrategies