DataWall :
- aggiunta ottimizzazione movimenti tra lavorazioni - aggiunta pulitura spigoli (con utensile conico o con foro).
This commit is contained in:
+79
-6
@@ -1,4 +1,4 @@
|
||||
-- WallExec.lua by Egaltech s.r.l. 2020/11/12
|
||||
-- WallExec.lua by Egaltech s.r.l. 2020/12/23
|
||||
-- Libreria esecuzione lavorazioni per Pareti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -201,14 +201,15 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MoveMachiningsAtEnd( nPhase, nType, sStartName)
|
||||
local function MoveMachiningsAtEnd( nPhase, nType, sStartName, sProperty)
|
||||
local nOperId = EgtGetPhaseDisposition( nPhase)
|
||||
local nLastId = EgtGetLastOperation()
|
||||
local nInsertId = nLastId
|
||||
while nOperId do
|
||||
local nNextOperId = EgtGetNextOperation( nOperId)
|
||||
if EgtGetOperationPhase( nOperId) == nPhase and EgtGetOperationType( nOperId) == nType and
|
||||
( not sStartName or string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName) then
|
||||
( ( EgtGetInfo( nOperId, 'MOVE_AFTER', 'i') == 1 ) or
|
||||
( not sStartName or string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName)) then
|
||||
EgtRelocateGlob( nOperId, nInsertId, GDB_IN.AFTER)
|
||||
nInsertId = nOperId
|
||||
end
|
||||
@@ -217,16 +218,88 @@ local function MoveMachiningsAtEnd( nPhase, nType, sStartName)
|
||||
end
|
||||
nOperId = nNextOperId
|
||||
end
|
||||
end
|
||||
|
||||
------ Ordinamento dei tagli, delle fresature e delle forature -------
|
||||
local function SortMach( nPhase, LastMch, 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)
|
||||
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
|
||||
-- rendo comunque attiva la lavorazione
|
||||
EgtSetOperationMode( nOperId, true)
|
||||
EgtSetCurrMachining( nOperId)
|
||||
if not EgtIsMachiningEmpty() then
|
||||
-- punto iniziale e finale e direzione della lavorazione
|
||||
local ptStart = EgtGetMachiningStartPoint()
|
||||
local ptEnd = EgtGetMachiningEndPoint()
|
||||
table.insert( TabCut, {Mch=nOperId, Ent=nEntId, Start=ptStart, End=ptEnd})
|
||||
end
|
||||
end
|
||||
-- Passo alla operazione successiva
|
||||
nOperId = EgtGetNextOperation( nOperId)
|
||||
end
|
||||
|
||||
-- ordino le lavorazioni
|
||||
--EgtOutLog('Dati per ShortestPath :')
|
||||
EgtSpInit()
|
||||
for i = 1, #TabCut do
|
||||
local ptS = TabCut[i].Start
|
||||
local ptE = TabCut[i].End
|
||||
EgtSpAddPoint( ptS:getX(), ptS:getY(), ptS:getZ(), 0, 0,
|
||||
ptE:getX(), ptE:getY(), ptE:getZ(), 0, 0)
|
||||
end
|
||||
EgtSpSetAngularParams( 1000, 40, 2000, 60)
|
||||
EgtSpSetOpenBound( true,SHP_OB.NEAR_PNT,-2000,0,0,90,90)
|
||||
local vOrd = EgtSpCalculate( SHP_TY.OPEN)
|
||||
EgtSpTerminate()
|
||||
|
||||
-- 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
|
||||
end
|
||||
end
|
||||
|
||||
return LastMch
|
||||
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 dopo i tagli di lama
|
||||
MoveMachiningsAtEnd( nPhase, MCH_OY.MORTISING, 'Csaw_')
|
||||
-- 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')
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user