- Se la lavorazione non ha percorso, la si disattiva
- Se rotazione impostata su "IF_NECESSARY", prima del numero rotazioni, si controllano il numero di feature non eseguite
This commit is contained in:
@@ -1315,8 +1315,11 @@ local function GetBestCombination( ListToCompare, Part)
|
||||
else
|
||||
-- se rotazione ha un grande impatto
|
||||
if Part.GeneralParameters.GEN_sPieceRotation == 'IF_NECESSARY' then
|
||||
-- scelgo soluzione con meno feature saltate
|
||||
if ListToCompare[ListIndex].nNotExecute < ListToCompare[nIndexBestCombination].nNotExecute then
|
||||
nIndexBestCombination = ListIndex
|
||||
-- scelgo soluzione con meno rotazioni indipendentemente dal voto
|
||||
if ListToCompare[nIndexBestCombination].nRotations > ListToCompare[ListIndex].nRotations then
|
||||
elseif ListToCompare[nIndexBestCombination].nRotations > ListToCompare[ListIndex].nRotations then
|
||||
nIndexBestCombination = ListIndex
|
||||
-- se stesso numero di rotazioni
|
||||
elseif ListToCompare[nIndexBestCombination].nRotations == ListToCompare[ListIndex].nRotations then
|
||||
|
||||
+42
-35
@@ -1355,6 +1355,11 @@ function MachiningLib.AddOperations( MACHININGS, Part, sRotation)
|
||||
MachStartAxesPos = EgtGetMachiningStartAxes(),
|
||||
MachEndAxesPos = EgtGetMachiningEndAxes()}
|
||||
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
||||
|
||||
-- se non esistono punto iniziale o finale, si disattiva operazione
|
||||
if not MachExtraInfo.MachStartAxesPos or not MachExtraInfo.MachEndAxesPos then
|
||||
EgtSetOperationMode( nOperationId, false)
|
||||
end
|
||||
|
||||
-- se errore in applicazione
|
||||
if not bIsApplyOk then
|
||||
@@ -1780,44 +1785,46 @@ function MachiningLib.ShortestPathSorting()
|
||||
|
||||
-- se è una lavorazione
|
||||
while DB_MACH_APPLIED[i] and DB_MACH_APPLIED[i].sType ~= 'DISP' do
|
||||
-- se lavorazione non attiva non va considerata
|
||||
local nOperationId = DB_MACH_APPLIED[i].nOperationId
|
||||
if EgtGetOperationMode( nOperationId) then
|
||||
local ptMinX, ptMaxX
|
||||
-- aggiungo lavorazioni
|
||||
local nToolIndex = MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nToolIndex
|
||||
EgtOptMachAddTool( nToolIndex, 2, 2) -- , [ num dTC_X, num dTC_Y, num dTC_Z, num dTC_A, num dTC_B, num dTC_C])
|
||||
-- viene eseguito prima il gruppo con indice più alto, quindi si inverte indice dato che lo stage è dal più piccolo al più grande
|
||||
local nGroup = 10 - MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nStage
|
||||
local MachStartAxesPos = DB_MACH_APPLIED[i].MachStartAxesPos
|
||||
local MachEndAxesPos = DB_MACH_APPLIED[i].MachEndAxesPos
|
||||
EgtOptMachAddMachining( i, nToolIndex, nGroup, MachStartAxesPos, MachEndAxesPos)
|
||||
table.insert( MachiningOptList, i)
|
||||
if DB_MACH_APPLIED[i].MachStartAxesPos and DB_MACH_APPLIED[i].MachEndAxesPos then
|
||||
-- se lavorazione non attiva non va considerata
|
||||
local nOperationId = DB_MACH_APPLIED[i].nOperationId
|
||||
if EgtGetOperationMode( nOperationId) then
|
||||
local ptMinX, ptMaxX
|
||||
-- aggiungo lavorazioni
|
||||
local nToolIndex = MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nToolIndex
|
||||
EgtOptMachAddTool( nToolIndex, 2, 2) -- , [ num dTC_X, num dTC_Y, num dTC_Z, num dTC_A, num dTC_B, num dTC_C])
|
||||
-- viene eseguito prima il gruppo con indice più alto, quindi si inverte indice dato che lo stage è dal più piccolo al più grande
|
||||
local nGroup = 10 - MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nStage
|
||||
local MachStartAxesPos = DB_MACH_APPLIED[i].MachStartAxesPos
|
||||
local MachEndAxesPos = DB_MACH_APPLIED[i].MachEndAxesPos
|
||||
EgtOptMachAddMachining( i, nToolIndex, nGroup, MachStartAxesPos, MachEndAxesPos)
|
||||
table.insert( MachiningOptList, i)
|
||||
|
||||
-- si salvano i punti minimi e massimi tra tutte le lavorazioni di ogni gruppo
|
||||
if MachStartAxesPos[1] < MachEndAxesPos[1] then
|
||||
ptMinX = MachStartAxesPos
|
||||
ptMaxX = MachEndAxesPos
|
||||
else
|
||||
ptMinX = MachEndAxesPos
|
||||
ptMaxX = MachStartAxesPos
|
||||
end
|
||||
|
||||
-- si aggiungono le info di gruppo
|
||||
local bFound = false
|
||||
for t = 1, #GroupInfo do
|
||||
if GroupInfo[t].nGroup == nGroup then
|
||||
if GroupInfo[t].ptMin[1] > ptMinX[1] then GroupInfo[t].ptMin = ptMinX end
|
||||
if GroupInfo[t].ptMax[1] < ptMaxX[1] then GroupInfo[t].ptMax = ptMaxX end
|
||||
bFound = true
|
||||
-- si salvano i punti minimi e massimi tra tutte le lavorazioni di ogni gruppo
|
||||
if MachStartAxesPos[1] < MachEndAxesPos[1] then
|
||||
ptMinX = MachStartAxesPos
|
||||
ptMaxX = MachEndAxesPos
|
||||
else
|
||||
ptMinX = MachEndAxesPos
|
||||
ptMaxX = MachStartAxesPos
|
||||
end
|
||||
end
|
||||
-- se non ho trovato, si aggiunge in lista
|
||||
if not bFound then
|
||||
table.insert( GroupInfo, { nGroup = nGroup, nStage = MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nStage, ptMin = ptMinX, ptMax = ptMaxX})
|
||||
end
|
||||
|
||||
nMachInDisp = nMachInDisp + 1
|
||||
-- si aggiungono le info di gruppo
|
||||
local bFound = false
|
||||
for t = 1, #GroupInfo do
|
||||
if GroupInfo[t].nGroup == nGroup then
|
||||
if GroupInfo[t].ptMin[1] > ptMinX[1] then GroupInfo[t].ptMin = ptMinX end
|
||||
if GroupInfo[t].ptMax[1] < ptMaxX[1] then GroupInfo[t].ptMax = ptMaxX end
|
||||
bFound = true
|
||||
end
|
||||
end
|
||||
-- se non ho trovato, si aggiunge in lista
|
||||
if not bFound then
|
||||
table.insert( GroupInfo, { nGroup = nGroup, nStage = MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nStage, ptMin = ptMinX, ptMax = ptMaxX})
|
||||
end
|
||||
|
||||
nMachInDisp = nMachInDisp + 1
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user