- In ShortestPathSorting si settano ora inizio e fine di ogni gruppo per ordine lavorazioni

- In STR0010 in caso che la strategia sia stata forzata da utente, non viene bocciata a causa della sua posizione/forma. Se forzata il cliente si è preso al responsabilità della sua scelta ed è giusto che venga provata. Al massimo si avranno errori di extra-corsa o colisioni.
This commit is contained in:
andrea.villa
2025-12-23 16:42:04 +01:00
parent 309bae0265
commit 570e41a40d
2 changed files with 57 additions and 10 deletions
+43 -4
View File
@@ -1694,15 +1694,12 @@ end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.ShortestPathSorting()
-- verificare se serve settare prima e ultima lavorazione
-- EgtOptMachSetFirstMachining( int nId)
-- EgtOptMachSetLastMachining( int nId)
local nStartIndex
local i = 1
while i <= #DB_MACH_APPLIED do
local nMachInDisp = 0
local MachiningOptList = {}
local GroupInfo = {}
-- se è una lavorazione
if DB_MACH_APPLIED[i].sType ~= 'DISP' then
@@ -1715,9 +1712,11 @@ function MachiningLib.ShortestPathSorting()
-- tra gruppi (stage) non si può ottimizzare
EgtOptMachSetAllGroupsDependencesAsMandatory( true)
EgtOptMachSetOptimizationForGroups( true)
-- se è una lavorazione
while DB_MACH_APPLIED[i] and DB_MACH_APPLIED[i].sType ~= 'DISP' do
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])
@@ -1729,6 +1728,29 @@ function MachiningLib.ShortestPathSorting()
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
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
i = i + 1
end
@@ -1754,6 +1776,23 @@ function MachiningLib.ShortestPathSorting()
end
end
-- definisco gruppo per gruppo la direzione preferita di ottimizzazione
for t = 1, #GroupInfo do
-- se gruppo "Taglio di coda" l'ordinamento è al contrario
if GroupInfo[t].nStage == 3 then
-- start point
EgtOptMachSetOpenBoundForGroups( GroupInfo[t].nGroup, true, SHP_OB.NEAR_PNT, GroupInfo[t].ptMin[1], GroupInfo[t].ptMin[2], GroupInfo[t].ptMin[3])
-- end point
EgtOptMachSetOpenBoundForGroups( GroupInfo[t].nGroup, false, SHP_OB.NEAR_PNT, GroupInfo[t].ptMax[1], GroupInfo[t].ptMax[2], GroupInfo[t].ptMax[3])
-- in tutti gli altri gruppi si ordina sempre dalla testa alla coda
else
-- start point
EgtOptMachSetOpenBoundForGroups( GroupInfo[t].nGroup, true, SHP_OB.NEAR_PNT, GroupInfo[t].ptMax[1], GroupInfo[t].ptMax[2], GroupInfo[t].ptMax[3])
-- end point
EgtOptMachSetOpenBoundForGroups( GroupInfo[t].nGroup, false, SHP_OB.NEAR_PNT, GroupInfo[t].ptMin[1], GroupInfo[t].ptMin[2], GroupInfo[t].ptMin[3])
end
end
-- calcolo ordine lavorazioni
MachiningOptList = EgtOptMachCalculate( MachiningOptList)
+14 -6
View File
@@ -83,7 +83,8 @@ end
-------------------------------------------------------------------------------------------------------------
local function IsTopologyOk( Proc)
if Proc.Topology.sFamily == 'Bevel' or Proc.Topology.sFamily == 'DoubleBevel' or
Proc.Topology.sName == 'VGroove-2-Through' or Proc.Topology.sName == 'Rabbet-2-Through' then
Proc.Topology.sName == 'VGroove-2-Through' or Proc.Topology.sName == 'Rabbet-2-Through' or
Proc.Topology.sName == 'Cut-1-Through' then
return true
else
return false
@@ -178,10 +179,12 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters)
return false, Strategy.Result
end
-- controllo dimensioni
if not IsPositionOK( Proc, Part) then
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Feature not machinable in this position')
return false, Strategy.Result
-- controllo dimensioni solo se non è forzata
if not CustomParameters.bForcedStrategy then
if not IsPositionOK( Proc, Part) then
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( 'Feature not machinable in this position')
return false, Strategy.Result
end
end
-- volume della feature
@@ -253,7 +256,12 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters)
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
-- aggiunge lavorazione
for j = 1, #Strategy.Machinings do
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j])
local AuxiliaryData = {}
-- se strategia forzata non considero area non pinzabile
if CustomParameters.bForcedStrategy then
AuxiliaryData.bIgnoreNotClampableLength = true
end
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j], AuxiliaryData)
end
end
else