- in MachiningLib migliorata funzione FinalizeSorting

This commit is contained in:
luca.mazzoleni
2025-03-20 11:38:08 +01:00
parent a89f09b572
commit 67ceda8599
+6 -12
View File
@@ -901,22 +901,16 @@ end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.FinalizeSorting()
local nShifts = 0
local nCurrentMachiningIndex = #MACHININGS
while nCurrentMachiningIndex > 1 do
local nCurrentMachiningIndex2 = nCurrentMachiningIndex - 1
while nCurrentMachiningIndex2 > 0 do
if MACHININGS[nCurrentMachiningIndex].Proc.id == MACHININGS[nCurrentMachiningIndex2].Proc.id
and MACHININGS[nCurrentMachiningIndex].Machining.nFeatureInternalIndex < MACHININGS[nCurrentMachiningIndex2].Machining.nFeatureInternalIndex then
local Machining = table.remove( MACHININGS, nCurrentMachiningIndex)
table.insert( MACHININGS, nCurrentMachiningIndex2, Machining)
for i = #MACHININGS, 2, -1 do
for j = i - 1, 1, -1 do
if MACHININGS[i].Proc.id == MACHININGS[j].Proc.id
and MACHININGS[i].Machining.nFeatureInternalIndex < MACHININGS[j].Machining.nFeatureInternalIndex then
MACHININGS[i], MACHININGS[j] = MACHININGS[j], MACHININGS[i]
nShifts = nShifts + 1
else
nCurrentMachiningIndex2 = nCurrentMachiningIndex2 - 1
end
end
nCurrentMachiningIndex = nCurrentMachiningIndex - 1
end
return MACHININGS, nShifts