DataWall :

- altre modifiche per gestione pareti su macchine travi.
This commit is contained in:
Dario Sassi
2021-03-08 06:34:19 +00:00
parent 631b8aec2d
commit 5f5d24c731
6 changed files with 300 additions and 122 deletions
+70 -48
View File
@@ -231,18 +231,19 @@ local function MoveMachiningsAtEnd( nPhase, nType, sStartName, sProperty)
end
------ Ordinamento dei tagli, delle fresature e delle forature -------
local function SortMach( nPhase, LastMch, nType, sStartName, bExistName, sInfo, bExistInfo)
local function SortMach( nPhase, PrevMch, nPartId, nType, sStartName, bExistName, sInfo, bExistInfo)
-- dichiarazione tabella
local TabCut = {}
-- Recupero gli identificativi delle lavorazioni e annullo eventuali allungamenti e Id di altre lavorazioni rappresentate
local nOperId = EgtGetPhaseDisposition( nPhase)
local nOperId = EgtGetNextOperation( PrevMch)
while nOperId do
-- Se appartiene alla fase corrente e taglio con lama non da sopra (sempre su 1 sola entità)
if EgtGetOperationPhase( nOperId) == nPhase and EgtGetOperationType( nOperId) == nType and
( not sStartName or ( string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName and bExistName) or
( string.sub( EgtGetName( nOperId), 1, #sStartName) ~= sStartName and not bExistName)) and
( not sInfo or ( EgtGetInfo( nOperId, sInfo, 'i') == 1 and bExistInfo) or
( EgtGetInfo( nOperId, sInfo, 'i') ~= 1 and not bExistInfo)) then
( not nPartId or EgtGetInfo( nOperId, 'Part', 'i') == nPartId) and
( not sStartName or ( bExistName and string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName) or
( not bExistName and string.sub( EgtGetName( nOperId), 1, #sStartName) ~= sStartName)) and
( not sInfo or ( bExistInfo and EgtGetInfo( nOperId, sInfo, 'i') == 1) or
( not bExistInfo and EgtGetInfo( nOperId, sInfo, 'i') ~= 1)) then
-- rendo comunque attiva la lavorazione
EgtSetOperationMode( nOperId, true)
EgtSetCurrMachining( nOperId)
@@ -277,42 +278,34 @@ local function SortMach( nPhase, LastMch, nType, sStartName, bExistName, sInfo,
-- applico ordinamento calcolato
if vOrd then
for i = 1, #vOrd do
EgtRelocateGlob( TabCut[vOrd[i]].Mch, LastMch, GDB_IN.AFTER)
LastMch = TabCut[vOrd[i]].Mch
EgtRelocateGlob( TabCut[vOrd[i]].Mch, PrevMch, GDB_IN.AFTER)
PrevMch = TabCut[vOrd[i]].Mch
end
end
return LastMch
return PrevMch
end
-------------------------------------------------------------------------------------------------------------
local function SortMachinings()
-- Recupero la fase corrente
local nPhase = 1
local LastMch = EgtGetLastOperation()
-- ordino i tagli di lama e li metto alla fine
LastMch = SortMach( nPhase, LastMch, MCH_OY.SAWING)
-- ordino i tagli con segacatena che non hanno nel nome la parte indicata
-- e li metto nelle prime posizioni
local LastMchMort = EgtGetPhaseDisposition( nPhase)
LastMchMort = SortMach( nPhase, LastMchMort, MCH_OY.MORTISING, 'Csaw_', false)
-- ordino i tagli con segacatena che hanno nel nome la parte indicata
-- e li metto nelle ultime
LastMch = SortMach( nPhase, LastMch, MCH_OY.MORTISING, 'Csaw_', true)
-- ordino le fresature che non hanno la nota indicata e le metto alla fine degli eventuali tagli di sega-catena
LastMchMort = SortMach( nPhase, LastMchMort, MCH_OY.MILLING, 'Clean_', false, 'MOVE_AFTER', false)
-- ordino le svuotature e le metto alla fine degli eventuali tagli di sega-catena
LastMchMort = SortMach( nPhase, LastMchMort, MCH_OY.POCKETING)
-- ordino le fresature che hanno la nota indicata e le metto alla fine
LastMch = SortMach( nPhase, LastMch, MCH_OY.MILLING, nil, nil, 'MOVE_AFTER', true)
-- lascio commentate gli spostamenti delle lavorazioni nel caso ci sarà qualche lavorazione
-- non ancora contemplata che richiede queste funzioni
-- Sposto i tagli di lama alla fine
-- MoveMachiningsAtEnd( nPhase, MCH_OY.SAWING)
-- Sposto i tagli con sega a catena che hanno un certo nome dopo i tagli di lama (i tagli del freecontour con segacatena non vengono spostati perchè hanno un nome diverso)
-- MoveMachiningsAtEnd( nPhase, MCH_OY.MORTISING, 'Csaw_')
-- Sposto le lavorazioni di pulitura spigolo passanti dopo i tagli di lama e con sega a catena
-- MoveMachiningsAtEnd( nPhase, MCH_OY.MILLING, nil, 'MoveAfter')
local function SortMachinings( nPhase, PrevMch, nPartId)
-- Chiodature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Nail_', true)
-- Tagli con sega a catena che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, 'Csaw_', false)
-- Fresature che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', false, 'MOVE_AFTER', false)
-- Svuotature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING)
-- Fresature che sono puliture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, 'Clean_', true, 'MOVE_AFTER', false)
-- Tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING)
-- Qui rimozione sfridi (se ci sono lavorazioni successive)
-- Tagli con sega a catena che vanno fatti dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, 'Csaw_', true)
-- Fresature (puliture di spigoli) che vanno fatte dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, nil, nil, 'MOVE_AFTER', true)
return PrevMch
end
-------------------------------------------------------------------------------------------------------------
@@ -323,19 +316,24 @@ function WallExec.ProcessFeatures()
-- recupero il grezzo e il suo box
local nRawId = EgtGetFirstRawPart()
local b3Raw = EgtGetRawPartBBox( nRawId)
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
local vProc = {}
-- raccolgo l'elenco dei pezzi
local vPart = {}
local nPartId = EgtGetFirstPartInRawPart( nRawId)
while nPartId do
-- recupero le feature di lavorazione della parete
local vPartProc = CollectFeatures( nPartId, b3Raw)
vProc = EgtJoinTables( vProc, vPartProc)
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
table.insert( vPart, {Id=nPartId, Box=b3Solid})
nPartId = EgtGetNextPartInRawPart( nPartId)
end
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
local vProc = {}
for i = 1, #vPart do
-- recupero le feature di lavorazione della parete
local vPartProc = CollectFeatures( vPart[i].Id, b3Raw)
vProc = EgtJoinTables( vProc, vPartProc)
end
-- classifico le feature
ClassifyFeatures( vProc, b3Raw)
-- ordino le feature
-- *** TODO ***
-- debug
if EgtGetDebugLevel() >= 1 then
PrintFeatures( vProc)
@@ -359,11 +357,26 @@ function WallExec.ProcessFeatures()
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
end
-- riordino le lavorazioni
SortMachinings()
-- se macchina travi
if WD.BEAM_MACHINE then
-- dati su prima disposizione
-- se macchina pareti
if not WD.BEAM_MACHINE then
-- riordino le lavorazioni tra tutti i pezzi
local nPhase = 1
local PrevMch = EgtGetPhaseDisposition( nPhase)
SortMachinings( nPhase, PrevMch)
-- altrimenti macchina travi
else
-- ordino i pezzi secondo le X decrescenti
local function CompareParts( P1, P2)
return P1.Box:getCenter():getX() > P2.Box:getCenter():getX()
end
table.sort( vPart, CompareParts)
-- riordino le lavorazioni sui singoli pezzi
local nPhase = 1
local PrevMch = EgtGetPhaseDisposition( nPhase)
for i = 1, #vPart do
PrevMch = SortMachinings( nPhase, PrevMch, vPart[i].Id)
end
-- aggiungo dati su prima disposizione
local nDispId = EgtGetPhaseDisposition( 1)
EgtSetInfo( nDispId, 'TYPE', 'START')
EgtSetInfo( nDispId, 'ORD', 1)
@@ -378,6 +391,15 @@ function WallExec.ProcessFeatures()
local nDisp2Id = EgtGetPhaseDisposition( 2)
EgtSetInfo( nDisp2Id, 'TYPE', 'END')
EgtSetInfo( nDisp2Id, 'ORD', 1)
-- Aggiornamento finale di tutto
EgtSetCurrPhase( 1)
local bApplOk, sApplErrors, sApplWarns = EgtApplyAllMachinings()
if not bApplOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err = 1, Msg=sApplErrors, Rot=0, CutId=0, TaskId=0})
elseif sApplWarns and #sApplWarns > 0 then
-- non interessano perchè riguardano lo scarico delle travi
end
end
-- restituzione risultati
return ( nTotErr == 0), Stats