Compare commits

...

2 Commits

Author SHA1 Message Date
daniele.nicoli ff036cd017 - Modifica scarico al carico con variabile globale nel file mlde.
- Corretta generazione con M77.
2026-02-11 17:16:08 +01:00
daniele.nicoli 6be500cf38 Prime modifiche di test per scarico al carico 2026-02-10 11:36:51 +01:00
3 changed files with 101 additions and 17 deletions
+16 -1
View File
@@ -289,7 +289,11 @@ function OnDispositionEnd()
-- altrimenti disposizione finale, eventuale scarico pezzo lavorato se non ci sono lavorazioni
else
if #EMT.MDCHAR > 0 then
EmitRemark( 'PART UNLOAD')
if EMT.AUXTYPE == 'R' and UnloadOnLoadPos then
EmitRemark( 'PART UNLOAD ON LOAD POSITION')
else
EmitRemark( 'PART UNLOAD')
end
end
for i = 1, #EMT.MDCHAR do
-- Se è un'istruzione del piano ferma pezzo
@@ -316,6 +320,9 @@ function OnDispositionEnd()
local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2'
MyOutput( sEnd)
end
if UnloadOnLoadPos then
MyOutput('M77')
end
end
EMT.MDCHAR = {}
EMT.AUXTYPE = nil
@@ -494,6 +501,10 @@ function OnMachiningEnd()
elseif EMT.AUXTYPE == 'U' then
EmitRemark( 'PART UNLOAD')
elseif EMT.AUXTYPE == 'P' then
local nNextPathId
local nNextMchId
if EMT.PATHID then nNextPathId = EgtGetNextActiveOperation( EMT.PATHID) end
if EMT.MCHID then nNextMchId = EgtGetNextActiveOperation( EMT.MCHID) end
if EMT.PREROT then
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true
@@ -505,6 +516,10 @@ function OnMachiningEnd()
EMT.TO_ZMAX = nil
end
EmitRemark( 'PART FALL')
elseif UnloadOnLoadPos and not nNextPathId and not nNextMchId then
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true
EmitRemark( 'PART UNLOAD ON LOAD POSITION')
else
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true
+83 -15
View File
@@ -276,6 +276,7 @@ local DIST_Y1MAX_LOAD = 100 -- distanza carrello Y1 da massimo asse al ca
----------------------- Variabili -----------------------------------
local Test = false
local SPLIT
UnloadOnLoadPos = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo'), 'Output', 'b') == 1 -- se il pezzo dev'essere scaricato al carico
---------------------------------------------------------------------
local function PrepareClGroup( nParentId)
@@ -567,6 +568,10 @@ function OnSpecialApplyDisposition()
end
-- eseguo scarico
SpecSetCarrPosFromCmds( vCmd2)
-- determino posizione testa trave
local nLastEntId = EgtGetLastInGroup( EgtGetLastInGroup( EgtGetFirstNameInGroup( EgtGetPrev( EMC.DISPID), 'CL')))
local vAxes = EmtGetAxesPos( nLastEntId)
if #vAxes > 0 then EMC.TPOS = vAxes[1] end
local vCmd3 = SpecCalcUnload()
-- unisco ed emetto i comandi
vCmd = EgtJoinTables( vCmd, vCmd2)
@@ -732,7 +737,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
-- Verifico se lavorazione pareti
local bWall = ( EgtGetInfo( EgtGetCurrMachGroup() or GDB_ID.NULL, 'Wall', 'd') == 1)
-- mi salvo info lavorazione su una lista
local AuxInfoMach = {}
AuxInfoMach.bPreSplit = bPreSplit
@@ -740,7 +745,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
AuxInfoMach.bPreCut = bPreCut
AuxInfoMach.bCutting = bCutting
AuxInfoMach.bUnload = bUnload
-- Assegno flag di pezzo separato dal resto del grezzo
SPLIT = IsEndPhase( EMC.PHASE)
@@ -748,6 +753,8 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
local b3Tot = BBox3d()
local b3Raw = BBox3d()
local nNextOddPhase = GetNextStartOrRestPhase( EMC.PHASE)
-- se esistono più grezzi toglie l'impostazione di scarico al carico
if UnloadOnLoadPos and ( nNextOddPhase and nNextOddPhase <= EgtGetPhaseCount()) then UnloadOnLoadPos = false end
local nRawId = EgtGetFirstRawPart()
local nCurrRawId = GDB_ID.NULL
while nRawId do
@@ -798,6 +805,10 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
elseif bPreCut or bCutting then
local dDistF, dDistB, dRollF, dRollB = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1)
dDistFront = min( dDistFront, dDistF)
-- Se è previsto lo scarico al carico aumenta l'ingombro dell'area di lavoro
if UnloadOnLoadPos then
dDistFront = dDistFront -( MinDeltaYV*2 + AGG_V)
end
dDistBack = min( dDistBack, dDistB)
end
@@ -896,11 +907,10 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
EgtSetInfo( NextDispId, 'V1POS', EMC.V1POS)
EgtSetInfo( NextDispId, 'V2POS', EMC.V2POS)
end
end
end
-- Se previsto scarico, lo eseguo
if bUnload then
EMC.LB = b3Raw:getDimX()
local vCmdTmp = SpecCalcUnload()
vCmd = EgtJoinTables( vCmd, vCmdTmp)
end
@@ -1326,8 +1336,66 @@ function SpecCalcSplit( dLenRaw, dMaxLenLeft)
return vCmd
end
---------------------------------------------------------------------
-- Scarica il pezzo in zona di carico
function SpecCalcUnloadOnLoadPos()
local vCmdPre = {}
EgtOutLog( ' *[UL]', 1)
-- Se pinza Y2 chiusa, devo effettuare uno scambio
local dY1DeltaMaxSP = MaxY1 - LoadT - TurnerOffs - 10 * GEO.EPS_SMALL
if EMC.Y2DELTA or EMC.Y1DELTA > dY1DeltaMaxSP then
-- imposto quote aggancio per avere solo pinza Y
local dDistFront = 0
local dDistBack = EMC.LB - MinOther - EMC.HOVM + 10 * GEO.EPS_SMALL
-- effettuo scambio
vCmdPre = SpecCalcCarriages( dDistFront, dDistBack, 0, 0, dY1DeltaMaxSP)
-- recupero nuova posizione carrelli
SpecSetCarrPosFromCmds( vCmdPre)
EgtOutLog( ' [UL1]', 1)
end
-- porto il pezzo alla zona di rotazione con il carro Y1
local vCmd = {}
-- Commento
table.insert( vCmd, { 0, 'Unload-On-Load'})
-- posizionamento sicuro teste e rulli
if #vCmdPre > 0 then
EnsureZmax( true, vCmdPre, 2)
else
EnsureZmax( true, vCmd)
end
-- Se pinza V chiusa, la apro
if EMC.Y2DELTA then
table.insert( vCmd, { 12, 0})
end
-- riporto la trave al carico
local dRotT = LoadT + TurnerOffs
table.insert( vCmd, { 2, 'Y1', dRotT + EMC.Y1DELTA, 'T', dRotT})
-- apro la morsa
table.insert( vCmd, { 11, 0})
EMC.CNT = nil
-- riporto il carrello in home
table.insert( vCmd, { 1, 'Y1', ParkY1})
-- eventuale unione tabelle
if #vCmdPre > 0 then
vCmd = EgtJoinTables( vCmdPre, vCmd)
end
return vCmd
end
---------------------------------------------------------------------
function SpecCalcUnload()
-- In caso di condizioni rispettate richiama lo scarico al carico e ritorna
local nNextPathId
local nNextMchId
if EMC.PATHID then nNextPathId = EgtGetNextActiveOperation( EMC.PATHID) end
if EMC.MCHID then nNextMchId = EgtGetNextActiveOperation( EMC.MCHID) end
-- Opzione attiva, è l'ultimo path, è l'ultima lavorazione e non c'è rimanenza
if UnloadOnLoadPos and not nNextPathId and not nNextMchId and not IsStartOrRestPhase(EMC.PHASE) then
local vCmd = SpecCalcUnloadOnLoadPos()
return vCmd
end
local vCmdPre = {}
EgtOutLog( ' *[U]', 1)
if not EMC.Y1DELTA and not EMC.Y2DELTA then
@@ -1633,7 +1701,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- allontano (Y1+T) e (Y2)
dY1a = MaxY1
dY2a = MinY2
dTa = ( dY1a - TabI.dY1PosI) + dTa
dTa = ( dY1a - TabI.dY1PosI) + dTa
-- **[M2]** = allontanamento dei trascinatori con Y2 in presa
elseif sType == 'M2' then
EmitComment( vCmd, '[M2]')
@@ -1644,7 +1712,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- allontano (Y2+T) e (Y1)
dY1a = MaxY1
dY2a = MinY2
dTa = ( dY2a - TabI.dY2PosI) + dTa
dTa = ( dY2a - TabI.dY2PosI) + dTa
-- **[M3]** = accentramento dei trascinatori con Y1 in presa
elseif sType == 'M3' then
EmitComment( vCmd, '[M3]')
@@ -1654,7 +1722,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- accentro (Y1+T) e (Y2)
dY1a = TabI.MyMinY1V1
dY2a = TabI.MaxY2V2
dTa = ( dY1a - TabI.dY1PosI) + dTa
dTa = ( dY1a - TabI.dY1PosI) + dTa
-- **[M4]** = accentramento dei trascinatori con Y2 in presa
elseif sType == 'M4' then
EmitComment( vCmd, '[M4]')
@@ -1665,7 +1733,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- accentro (Y2+T) e (Y1)
dY1a = TabI.MyMinY1V1
dY2a = TabI.MaxY2V2
dTa = ( dY2a - TabI.dY2PosI) + dTa
dTa = ( dY2a - TabI.dY2PosI) + dTa
end
--
table.insert( vCmd, { 3, 'Y1', dY1a, 'Y2', dY2a, 'T', dTa, EMC.CNT})
@@ -1953,7 +2021,7 @@ local function PosY1Y2B( TabI, vCmd)
PosY2FromY1B( TabI, vCmd)
end
end
bXW = false
bXW = false
-- se posso posizionare 'direttamente' Y2 all'interno dell'intervallo I2 (casi [rp] o [ri])
else
-- |POSIZIONO MORSA 2| e poi MORSA 1
@@ -1964,7 +2032,7 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
PosY2FromY1A( TabI, vCmd)
PosY1FromY2B( TabI, vCmd)
bXW = false
bXW = false
end
-- in **accentramento**
else
@@ -1973,9 +2041,9 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI <= TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
PosY2FromY1B( TabI, vCmd)
PosY1FromY2B( TabI, vCmd)
bXW = false
end
end
bXW = false
end
end
end
if bXW then
-- Massimo trascinamento della trave in direzione positiva (casi **[xw]** )
@@ -1985,10 +2053,10 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
-- allontanamento morse, trascinamento trave con Y1
MaxDispl( TabI, vCmd, 'M1')
else
else
-- accentramento morse, trascinamento trave con Y2
MaxDispl( TabI, vCmd, 'M4')
end
end
end
nCnt = nCnt + 1
if nCnt > 10 then return end
+2 -1
View File
@@ -5,7 +5,7 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1a2_DEV1'
PP_VER = '3.1a2_DEV3'
PP_NVER = '3.1.1.2'
MIN_MACH_VER = '2.7d2'
MACH_NAME = EgtGetCurrMachineName()
@@ -173,6 +173,7 @@ EstimationRapidMultiplier = 1
DistZClampToTable = 5 -- distanza tra la tavola e il punto più basso della morsa
ClampingCoeffMin = nil -- coefficiente di fissaggio, se 0 o nil non fa controllo, per il momento da inizializzare da Ts3Data
MinBeamLenUnloadInLine = 2400 -- se lo scarico è su una linea deve scaricare il pezzo al massimo e deve essere maggiore del valore della variabile
UnloadOnLoadPos = nil
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PF1250-3T_5Ax.data"