Aggiunta DeepCopy libreria Config delle strategie
This commit is contained in:
+10
-8
@@ -571,29 +571,31 @@ local function GetFeatureForcedStrategy( Proc)
|
||||
if sStrategyId then
|
||||
-- eseguo file config con i parametri di default
|
||||
local StrategyData = require( sStrategyId .. '\\' .. sStrategyId .. 'Config')
|
||||
|
||||
|
||||
-- se ID strategia non esiste oppure ID letto in NGE è differente da quello letto nella strategia, esco subito
|
||||
if not StrategyData or StrategyData.sStrategyId ~= sStrategyId then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
-- si copiano i dati
|
||||
local UpdatedParamList = BeamLib.TableCopyDeep( StrategyData)
|
||||
-- salvo che questa strategia è stata forzata, e che quindi ho già letto il file config con i parametri di default
|
||||
-- quando si calcolerà la lavorazione non servirà leggere/riverificare i parametri di default
|
||||
StrategyData.bForcedStrategy = true
|
||||
UpdatedParamList.bForcedStrategy = true
|
||||
|
||||
-- cerco e aggiorno i parametri come sono settati nel processing
|
||||
for i = 1, #StrategyData.Parameters do
|
||||
local sParameterToRead = StrategyData.sStrategyId .. '_' .. StrategyData.Parameters[i].sNameNge
|
||||
for i = 1, #UpdatedParamList.Parameters do
|
||||
local sParameterToRead = UpdatedParamList.sStrategyId .. '_' .. UpdatedParamList.Parameters[i].sNameNge
|
||||
local sForcedParameterForProc = EgtGetInfo( Proc.id, sParameterToRead, 's')
|
||||
-- se ho trovato il valore, lo sovrascrivo al default
|
||||
if sForcedParameterForProc then
|
||||
StrategyData.Parameters[i].sValue = sForcedParameterForProc
|
||||
UpdatedParamList.Parameters[i].sValue = sForcedParameterForProc
|
||||
end
|
||||
end
|
||||
|
||||
-- ritorno la lista strategia con parametri
|
||||
local StrategyToProc = {}
|
||||
table.insert( StrategyToProc, StrategyData)
|
||||
table.insert( StrategyToProc, UpdatedParamList)
|
||||
return StrategyToProc
|
||||
end
|
||||
return nil
|
||||
@@ -783,7 +785,7 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO contemplare anche strategie speciali
|
||||
-- caricamento librerie strategie (standard o speciali) se presenti nella Proc come strategie disponibili per questo Processing
|
||||
local function RunStrategyLibraries( sStrategyId)
|
||||
local StrategyConfigName = sStrategyId .. '\\' .. sStrategyId .. 'Config'
|
||||
local StrategyScriptName = sStrategyId .. '\\' .. sStrategyId
|
||||
|
||||
+11
-6
@@ -384,16 +384,21 @@ end
|
||||
-- N.B. : I parametri personalizzati non più presenti tra i default della strategia, verranno ignorati. Quelli extra avranno valore di default
|
||||
-- Il controllo deve essere fatto SEMPRE all'inizio di ogni strategia, per controllare conformità parametri custom
|
||||
function BeamLib.GetUpdateCustomParameters( CustomStrategyParamList, DefaultStrategyParamList)
|
||||
if CustomStrategyParamList and #CustomStrategyParamList > 0 then
|
||||
for i = 1, #DefaultStrategyParamList do
|
||||
for j = 1, #CustomStrategyParamList do
|
||||
if DefaultStrategyParamList[i].sName == CustomStrategyParamList[j].sName then
|
||||
DefaultStrategyParamList[i].sValue = CustomStrategyParamList[j].sValue
|
||||
local UpdatedParamList = BeamLib.TableCopyDeep( DefaultStrategyParamList)
|
||||
-- se esistono i parametri di default (normalmente ce n'è sempre almeno uno)
|
||||
if UpdatedParamList then
|
||||
for i = 1, #UpdatedParamList do
|
||||
table.insert( UpdatedParamList, UpdatedParamList[i])
|
||||
if CustomStrategyParamList then
|
||||
for j = 1, #CustomStrategyParamList do
|
||||
if UpdatedParamList[i].sName == CustomStrategyParamList[j].sName then
|
||||
UpdatedParamList[i].sValue = CustomStrategyParamList[j].sValue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return DefaultStrategyParamList
|
||||
return UpdatedParamList
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -216,9 +216,9 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
-- controlli standard
|
||||
elseif ToolSearchParameters.dMaxToolDiameter and TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then
|
||||
bIsToolCompatible = false
|
||||
elseif ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.GetMinNz( ToolSearchParameters.vtToolDirection) - GEO.EPS_ZERO and TOOLS[i].SetupInfo.HeadType.bTop then
|
||||
elseif TOOLS[i].SetupInfo.HeadType.bTop and ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.GetMinNz( ToolSearchParameters.vtToolDirection) - GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
elseif ToolSearchParameters.vtToolDirection:getZ() > TOOLS[i].SetupInfo.GetMaxNz( ToolSearchParameters.vtToolDirection) + GEO.EPS_ZERO and TOOLS[i].SetupInfo.HeadType.bBottom then
|
||||
elseif TOOLS[i].SetupInfo.HeadType.bBottom and ToolSearchParameters.vtToolDirection:getZ() > TOOLS[i].SetupInfo.GetMaxNz( ToolSearchParameters.vtToolDirection) + GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
elseif ToolSearchParameters.sMillShape == 'STANDARD' and ( TOOLS[i].dSideAngle ~= 0 or TOOLS[i].bIsPen) then
|
||||
bIsToolCompatible = false
|
||||
@@ -334,10 +334,10 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
end
|
||||
|
||||
-- check angolo limite lama
|
||||
if ToolSearchParameters.vtN:getZ() < TOOLS[i].SetupInfo.GetMinNz( ToolSearchParameters.vtN) - GEO.EPS_ZERO then
|
||||
if TOOLS[i].SetupInfo.HeadType.bTop and ToolSearchParameters.vtN:getZ() < TOOLS[i].SetupInfo.GetMinNz( ToolSearchParameters.vtN) - GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
end
|
||||
if ToolSearchParameters.vtN:getZ() > TOOLS[i].SetupInfo.GetMaxNz( ToolSearchParameters.vtN) + GEO.EPS_ZERO then
|
||||
if TOOLS[i].SetupInfo.HeadType.bBottom and ToolSearchParameters.vtN:getZ() > TOOLS[i].SetupInfo.GetMaxNz( ToolSearchParameters.vtN) + GEO.EPS_ZERO then
|
||||
bIsToolCompatible = false
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user