Modificate funzioni per lettura e gestione parametri generali
This commit is contained in:
+59
-59
@@ -118,7 +118,7 @@ function BeamLib.AddPhaseWithRawParts( idRaw, OriXR, PosXR, dDeltaSucc)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.IsPointOnBoxLimit( ptPointToCheck, b3Solid)
|
||||
local bOnBoxLimit = false
|
||||
if abs( ptPointToCheck:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL or
|
||||
@@ -131,7 +131,7 @@ function BeamLib.IsPointOnBoxLimit( ptPointToCheck, b3Solid)
|
||||
end
|
||||
return bOnBoxLimit
|
||||
end
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.SetOpenSide( nPathInt, b3Solid)
|
||||
-- fondo tra loro le curve compatibili
|
||||
EgtMergeCurvesInCurveCompo( nPathInt)
|
||||
@@ -337,7 +337,7 @@ function BeamLib.GetAffectedFaces( Proc, Part)
|
||||
return vtFacesAffected
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
||||
-- se definita anche la normale alla faccia, elimino la parte di vtRef parallela a questa
|
||||
local vtMyRef = Vector3d( vtRef)
|
||||
@@ -372,7 +372,7 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
||||
return nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
|
||||
-- se definita anche la normale alla faccia, elimino la parte di vtRef parallela a questa
|
||||
local vtMyRef = Vector3d( vtRef)
|
||||
@@ -406,7 +406,7 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
|
||||
return nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
||||
function BeamLib.Is3EdgesApprox( Proc, idFace, nAddGrpId)
|
||||
nAddGrpId = nAddGrpId or BeamLib.GetAddGroup( Proc.idPart)
|
||||
@@ -460,27 +460,32 @@ end
|
||||
|
||||
-- TODO bisogna recuperare il nome del parametro NGE, perchè in questo caso è forzato
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetPieceGeneralParameters( idPart, DefaultGeneralParamList)
|
||||
function BeamLib.GetPieceGeneralParameters( Part, DefaultGeneralParamList)
|
||||
local GeneralParameters = {}
|
||||
|
||||
-- si salvano sul pezzo le note forzate, altrimenti si leggeranno dopo, quando si prendono i dati della strategia
|
||||
for i = 1, #DefaultGeneralParamList.PIECE do
|
||||
if DefaultGeneralParamList.PIECE[i].sType ~= 'inherited' then
|
||||
|
||||
local sParamNameNGE = DefaultGeneralParamList.PIECE[i].sNameNge
|
||||
local xParameterValue = EgtGetInfo( idPart, sParamNameNGE, 's') or DefaultGeneralParamList.PIECE[i].sValue
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.PIECE[i].sType == 'b' then
|
||||
GeneralParameters[DefaultGeneralParamList.PIECE[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.PIECE[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.PIECE[i].sValue > 0 then
|
||||
GeneralParameters[DefaultGeneralParamList.PIECE[i].sName] = tonumber( xParameterValue)
|
||||
for i = 1, #DefaultGeneralParamList do
|
||||
local sParamNameNGE = DefaultGeneralParamList[i].sNameNge
|
||||
local xParameterValue = EgtGetInfo( Part.id, sParamNameNGE, 's') or nil
|
||||
-- se il paraemtro esiste, salvataggio dato su lista con accesso diretto
|
||||
if xParameterValue then
|
||||
if DefaultGeneralParamList[i].sType == 'b' then
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList[i].sValue > 0 then
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
GeneralParameters[DefaultGeneralParamList.PIECE[i].sName] = nil
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = nil
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
GeneralParameters[DefaultGeneralParamList.PIECE[i].sName] = xParameterValue
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = xParameterValue
|
||||
end
|
||||
else
|
||||
if GENERAL_PARAMETERS.BTL and GENERAL_PARAMETERS.BTL[Part.sBTLInfo] and GENERAL_PARAMETERS.BTL[Part.sBTLInfo][DefaultGeneralParamList[i].sName] then
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = GENERAL_PARAMETERS.BTL[Part.sBTLInfo][DefaultGeneralParamList[i].sName]
|
||||
elseif GENERAL_PARAMETERS.PROJECT[DefaultGeneralParamList[i].sName] then
|
||||
GeneralParameters[DefaultGeneralParamList[i].sName] = GENERAL_PARAMETERS.PROJECT[DefaultGeneralParamList[i].sName]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -564,54 +569,49 @@ end
|
||||
function BeamLib.LoadGeneralParametersInList( DefaultGeneralParamList)
|
||||
local UpdatedParameters = { PROJECT = {}, BTL = {}}
|
||||
-- aggiornamento parametri PROJECT
|
||||
if DefaultGeneralParamList and DefaultGeneralParamList.PROJECT then
|
||||
if DefaultGeneralParamList then
|
||||
local idProjectInfo = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'ProjectInfo') or GDB_ID.NULL
|
||||
UpdatedParameters.PROJECT.sAISetupConfig = EgtGetInfo( idProjectInfo, 'AISETUP', 's') or nil
|
||||
for i = 1, #DefaultGeneralParamList.PROJECT do
|
||||
local sParamNameNGE = DefaultGeneralParamList.PROJECT[i].sNameNge
|
||||
local xParameterValue = EgtGetInfo( idProjectInfo, sParamNameNGE, 's') or DefaultGeneralParamList.PROJECT[i].sValue
|
||||
for i = 1, #DefaultGeneralParamList do
|
||||
local sParamNameNGE = DefaultGeneralParamList[i].sNameNge
|
||||
local xParameterValue = EgtGetInfo( idProjectInfo, sParamNameNGE, 's') or DefaultGeneralParamList[i].sValue
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.PROJECT[i].sType == 'b' then
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList.PROJECT[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.PROJECT[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.PROJECT[i].sValue > 0 then
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList.PROJECT[i].sName] = tonumber( xParameterValue)
|
||||
if DefaultGeneralParamList[i].sType == 'b' then
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList[i].sValue > 0 then
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList.PROJECT[i].sName] = nil
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList[i].sName] = nil
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList.PROJECT[i].sName] = xParameterValue
|
||||
UpdatedParameters.PROJECT[DefaultGeneralParamList[i].sName] = xParameterValue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- aggiornamento parametri BTL
|
||||
if DefaultGeneralParamList and DefaultGeneralParamList.BTL then
|
||||
-- TODO verificare perchè sembra non funzionare, mentre la EgtGetFirstNameInGroup restituiva l'ID
|
||||
-- aggiornamento parametri BTL
|
||||
local BTLInfo = EgtGetNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
||||
for j = 1, #BTLInfo do
|
||||
local BTLName = EgtGetInfo( BTLInfo[j], 'PROJ', 's')
|
||||
UpdatedParameters.BTL[BTLName].sAISetupConfig = EgtGetInfo( BTLName, 'AISETUP', 's') or nil
|
||||
for i = 1, #DefaultGeneralParamList.BTL do
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'inherited' then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = UpdatedParameters.PROJECT[DefaultGeneralParamList.BTL[i].sName]
|
||||
else
|
||||
local sParamNameNGE = DefaultGeneralParamList.BTL[i].sNameNge
|
||||
|
||||
local xParameterValue = EgtGetInfo( BTLInfo[j], sParamNameNGE, 's') or DefaultGeneralParamList.BTL[i].sValue
|
||||
local BTLName = EgtGetInfo( BTLInfo[j], 'PROJECT', 's')
|
||||
if BTLName then
|
||||
UpdatedParameters.BTL[BTLName] = {}
|
||||
UpdatedParameters.BTL[BTLName].sAISetupConfig = EgtGetInfo( BTLInfo[j], 'AISETUP', 's') or nil
|
||||
for i = 1, #DefaultGeneralParamList do
|
||||
local sParamNameNGE = DefaultGeneralParamList[i].sNameNge
|
||||
local xParameterValue = EgtGetInfo( BTLInfo[j], sParamNameNGE, 's') or DefaultGeneralParamList[i].sValue
|
||||
-- salvataggio dato su lista con accesso diretto
|
||||
if DefaultGeneralParamList.BTL[i].sType == 'b' then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList.BTL[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList.BTL[i].sValue > 0 then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = tonumber( xParameterValue)
|
||||
if DefaultGeneralParamList[i].sType == 'b' then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList[i].sName] = xParameterValue == 'true' or xParameterValue == '1' or xParameterValue == true
|
||||
elseif DefaultGeneralParamList[i].sType == 'd' then
|
||||
if #DefaultGeneralParamList[i].sValue > 0 then
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList[i].sName] = tonumber( xParameterValue)
|
||||
-- stringa vuota equivale a non passare alcun valore (deciderà la strategia)
|
||||
else
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = nil
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList[i].sName] = nil
|
||||
end
|
||||
else --DefaultGeneralParamList[i].sType == 's' or DefaultGeneralParamList[i].sType == 'combo'
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList.BTL[i].sName] = xParameterValue
|
||||
UpdatedParameters.BTL[BTLName][DefaultGeneralParamList[i].sName] = xParameterValue
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -620,7 +620,7 @@ function BeamLib.LoadGeneralParametersInList( DefaultGeneralParamList)
|
||||
|
||||
return UpdatedParameters
|
||||
end
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
if BeamData.GetChainSawInitAngs then
|
||||
return BeamData.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
@@ -637,7 +637,7 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetBlockedAxis( nToolIndex, sBlockedAxis, b3Raw, vtTool, vtOut)
|
||||
-- se presente funzione specifica nella macchina, la richiamo
|
||||
if BeamData.GetBlockedAxis then
|
||||
@@ -659,7 +659,7 @@ function BeamLib.GetBlockedAxis( nToolIndex, sBlockedAxis, b3Raw, vtTool, vtOut)
|
||||
return ''
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.BinaryToDecimal( dNumber)
|
||||
local sNumberToConvert = tostring( dNumber)
|
||||
local dResult = 0
|
||||
@@ -674,7 +674,7 @@ function BeamLib.BinaryToDecimal( dNumber)
|
||||
return dResult
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.DecimalToBinary( dNumber)
|
||||
local sNumberToConvert = tostring( dNumber)
|
||||
local n = sNumberToConvert
|
||||
@@ -699,7 +699,7 @@ function BeamLib.DecimalToBinary( dNumber)
|
||||
return tonumber( sResult)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
||||
local NumberString = tostring( dNumber)
|
||||
while #NumberString < CharNumber do
|
||||
@@ -709,7 +709,7 @@ function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
||||
return NumberString
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--- copia una tabella lua in modo ricorsivo, ossia mantiene indipendenti anche tutte le sottotabelle
|
||||
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
|
||||
function BeamLib.TableCopyDeep( OriginalTable)
|
||||
@@ -743,7 +743,7 @@ function BeamLib.TableCopyDeep( OriginalTable)
|
||||
return CopiedTable
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.MergeTables( OriginalTable, InputTable)
|
||||
local result = {}
|
||||
for k, v in pairs( OriginalTable) do result[k] = v end
|
||||
@@ -751,7 +751,7 @@ function BeamLib.MergeTables( OriginalTable, InputTable)
|
||||
return result
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.FindEdgeBestOrientedAsDirection( Edges, vtDirection)
|
||||
local BestEdge = {}
|
||||
|
||||
@@ -870,7 +870,7 @@ function BeamLib.GetStrategiesFromList( Proc, StrategyList)
|
||||
return nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Merge sorting - algoritmo di sorting stabile, ossia che mantiene l'ordine relativo se gli elementi sono equivalenti
|
||||
-- TODO vedere come riordinare (tutto in tabella MergeSort??)
|
||||
-- TODO libreria Sorting??
|
||||
|
||||
Reference in New Issue
Block a user