diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 897ec82..af583d6 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -397,17 +397,38 @@ end local function GetParameters_Essetre( Proc, sStrategyIdToGet) local Parameters = {} - -- Feature : Cut (1-340) + -- Feature : HeadCut (1-340) 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 = 0 -- eventuali informazioni da recuperare sulla feature sostituita if Proc.SlaveProcIndexes then local idSlaveProc = PROCESSINGS[Proc.idPart].Rotation[Proc.nCurrentRotation][Proc.SlaveProcIndexes[1]].id - dDepthChamfer = EgtGetInfo( idSlaveProc or GDB_ID.NULL, 'Q06', 'd') or 0 + local dDepthChamfer = EgtGetInfo( idSlaveProc or GDB_ID.NULL, 'Q06', 'd') or 0 + table.insert( Parameters, { sName = 'dDepthChamfer', sValue = dDepthChamfer, sType = 'd'}) + + local dCuttingStrategy = EgtGetInfo( idSlaveProc 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 + 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 + if sStrategyIdToGet == 'STR0002' then + -- non ci sono Q per questa strategia + elseif sStrategyIdToGet == 'STR0005' then + if bForcePocketing then + Parameters = { { bToRemove = true}} + else + 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 - Parameters = { { sName = 'dDepthChamfer', sValue = dDepthChamfer, sType = 'd'}} end end @@ -451,6 +472,17 @@ function BasicCustomerStrategies.GetParametersFromBasicCustomerStrategies( Proc, 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 rimuiovere, 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 ------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 6deef97..3e20c79 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -546,6 +546,8 @@ local function GetStrategies( Proc) end end end + -- si riprocessano le strategie dopo che sono stati letti i parametri + AvailableStrategiesForProc = BCS.UpdateStrategies( AvailableStrategiesForProc) end end return AvailableStrategiesForProc diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 0470992..c399d71 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -478,7 +478,7 @@ function BeamLib.LoadCustomParametersInStrategy( Proc, CustomParameters, Default end if DefaultStrategyParamList.ParameterList[i].sType == 'b' then - UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' + UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true elseif DefaultStrategyParamList.ParameterList[i].sType == 'd' then if #DefaultStrategyParamList.ParameterList[i].sValue > 0 then UpdatedParameters[DefaultStrategyParamList.ParameterList[i].sName] = tonumber( xParameterValue)