Compare commits

...

13 Commits

Author SHA1 Message Date
andrea.villa 9e00046400 Merge branch 'develop' 2026-07-07 09:20:49 +02:00
andrea.villa 9e8c67fcb8 Merge branch 'NewLink' into develop 2026-07-07 08:56:11 +02:00
andrea.villa 3c8ef31433 Allineamento con common ver. 3.1g1 2026-07-07 08:55:48 +02:00
andrea.villa b89e384dbc Corretta generazione M77 (Scarica spezzone in entrata) durante scarico speciale 2026-07-06 14:49:13 +02:00
andrea.villa 612929dca8 Apertura pinze anche in LOAD 2026-06-26 12:43:32 +02:00
andrea.villa 7ec47d6ac2 Corretta simulazione scarico motosega
sistemato errore in MLDE
2026-06-26 10:18:17 +02:00
andrea.villa cd01e1a07e Corretta gestione motosega sotto traversa 2026-06-26 08:31:09 +02:00
andrea.villa 4eb9669e1a Corretta gestione pinze 2026-06-23 15:00:10 +02:00
andrea.villa 393fd10524 - Corretta gestione motosega in caso di mafcchina 2 teste
- Corretta simulazione
2026-06-22 15:38:54 +02:00
andrea.villa d3aac014b7 Allineamento con common ver. 3.1f3 2026-06-08 14:41:56 +02:00
andrea.villa 87ebd3a20d Aggiunta lettura quote parcheggio 2026-06-03 12:15:44 +02:00
andrea.villa 8e46749ecd HOTFIX problema simulazione 2026-06-03 11:54:12 +02:00
andrea.villa c083e04e59 Allineamento a common 3.1f1 2026-06-03 09:47:59 +02:00
6 changed files with 237 additions and 102 deletions
+125 -51
View File
@@ -315,7 +315,7 @@ function OnDispositionEnd()
if #EMT.MDCHAR > 0 then
MyOutputNoNum( '(PART UNLOAD)')
-- movimento intermedio di apertura pinza-rulli per evitare di trovare delle collisioni
EmitParkRoller( EMT.TPOS, false, false)
EmitParkRoller( EMT.TPOS, false)
for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i])
if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end
@@ -530,7 +530,7 @@ function OnMachiningEnd()
elseif EMT.AUXTYPE == 'U' then
EmtOutput( '(PART UNLOAD)')
-- movimento intermedio di apertura pinza-rulli per evitare di trovare delle collisioni
EmitParkRoller( EMT.TPOS, false, false)
EmitParkRoller( EMT.TPOS, false)
EMT.V1POS = EMT.V1NEXTPOS
EMT.V2POS = EMT.V2NEXTPOS
elseif EMT.AUXTYPE == 'P' then
@@ -599,7 +599,7 @@ function OnMachiningEnd()
local sOut = 'G156 EA'..tostring( EMT.PRODID)..' EB'..tostring( EMT.PATTID)..' EC'..tostring( EMT.CUTID)..' ED2'
EmtOutput( sOut)
end
elseif not EMT.PREROT then
elseif not EMT.PREROT and not EMT.SPECSPLIT then
EmtOutput( 'M77')
end
end
@@ -862,6 +862,33 @@ function OnRapid()
if EMT.MDCHAR[i].MovType ~= 1 then bOnlyCharY = false end
end
EMT.MDCHAR = {}
local bParkV = false
-- verifica se serve aprire i carrelli
local bCondBase = EMT.MCHFIRST or EMT.MOVE == 0
local bCondPosition = EMT.V1POS < EMT.V1NEXTPOS - 1 or
EMT.V2POS > EMT.V2NEXTPOS + 1 or
RollerParkingNeeded( EMT.HEAD, EMT.R1, EMT.R2, EMT.R1, EMT.R2)
if bCondBase and bCondPosition then
bParkV = true
end
local bNlhParkV = ( EMT.MOVE == 0 and ( EMT.FLAG2 == 1 or EMT.FLAG2 == 2))
if bNlhParkV then
bParkV = ( EMT.FLAG == 2 and bParkV) or ( not EMT.MCHSPLIT or bSplit)
end
if bParkV or bNlhParkV then
local bMchSplit = ( bNlhParkV and EMT.MCHSPLIT and bSplit)
local bAgg = EgtExistsInfo( EMT.PATHID, 'CNT')
if EMT.SPLIT_Y1DELTA and not EMT.MCHSPLIT then EMT.Y1DELTA = EMT.SPLIT_Y1DELTA end
local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bMchSplit, bAgg)
end
if EMT.SPLIT_Y1DELTA then EMT.Y1DELTA = EMT.SPLIT_Y1DELTA end
EmitMoveStartChars( EgtIf( bOnlyCharY, 1, 3))
EmtOutput( '( *** '..EMT.MCHNAME..'/'..EMT.TOOL..' *** )')
@@ -927,6 +954,11 @@ function OnRapid()
-- eventuale movimento carrelli
for i = 1, #EMT.AUXCMD do
ProcessPathStartAux( EMT.AUXCMD[i], i)
-- se ultimo comando e lavorazione di split, sgancio il carro Y1
if i == #EMT.AUXCMD and EMT.MCHSPLIT and not EMT.TO_SPECSPLIT and not EMT.TO_FALL then
EMT.SPLIT_Y1DELTA = EMT.Y1DELTA
EMT.Y1DELTA = nil
end
end
EMT.AUXCMD = {}
-- se Split lascio agganciata solo la pinza Y2 alla fine dei movimenti
@@ -962,14 +994,17 @@ function OnRapid()
local bNlhParkV = ( EMT.MOVE == 0 and ( EMT.FLAG2 == 1 or EMT.FLAG2 == 2))
if bNlhParkV then
bParkV = ( EMT.FLAG == 2 and bParkV) or not bSplitMach
bParkV = ( EMT.FLAG == 2 and bParkV) or ( not EMT.MCHSPLIT or bSplit)
end
if bParkV then
local bMchSplit = bNlhParkV and bSplitMach
if bParkV or bNlhParkV then
local bMchSplit = ( bNlhParkV and EMT.MCHSPLIT and bSplit)
local bAgg = EgtExistsInfo( EMT.PATHID, 'CNT')
if EMT.SPLIT_Y1DELTA and not EMT.MCHSPLIT then EMT.Y1DELTA = EMT.SPLIT_Y1DELTA end
local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bMchSplit)
EmitParkRoller( dPosT, bMchSplit, bAgg)
end
if EMT.SPLIT_Y1DELTA then EMT.Y1DELTA = EMT.SPLIT_Y1DELTA end
-- se era stato lanciata la preselezione di un utensile, prima di muovere la testa asopetto che sia finito
if EMT.START_PRESEL then
@@ -1180,6 +1215,7 @@ function OnRapid()
EMT.POSTROT = false
EMT.RELOAD = false
EMT.RELOAD2 = nil
EMT.SPLIT_Y1DELTA = nil
end
-- se taglio di coda senza residuo da scaricare, emetto M175 per accelerare il carico della barra successiva
@@ -1304,6 +1340,13 @@ function OnLinear()
EMT.DBLHEADPARA = true
end
-- se testa accoppiata in parallelo, in uscita si disaccoppia per tornare ad accoppiamento speculare
if EMT.DBLHEADPARA and
( ( EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 104) or ( EMT.MCHTYPE == MCH_MY.POCKETING and EMT.FLAG == 404)) then
EmtOutput( "G157 EE1")
EMT.DBLHEADPARA = nil
end
-- valori degli assi
local sL1, bL1 = EmtGetAxis( 'L1')
local sL2, bL2 = EmtGetAxis( 'L2')
@@ -1323,13 +1366,6 @@ function OnLinear()
-- emetto linea
EmtOutput( "G1"..sSlowDown..sAxes..sFeed)
-- se testa accoppiata in parallelo, in uscita si disaccoppia per tornare ad accoppiamento speculare
if EMT.DBLHEADPARA and
( ( EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 104) or ( EMT.MCHTYPE == MCH_MY.POCKETING and EMT.FLAG == 404)) then
EmtOutput( "G157 EE1")
EMT.DBLHEADPARA = nil
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
EmtUpdatePrev()
@@ -2092,11 +2128,11 @@ function MyAdjustLinearAxes()
local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs
vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef
elseif EMT.HEAD == 'H13' then
elseif EMT.HEAD == 'H13' or EMT.HEAD == 'H15' then
local Len = ( EMT.TDIST or ChSawLen) + MillOffs
local LenRef = MillOffs
vtE = Vector3d( EMT.ADIR) * Len - Z_AX() * LenRef
elseif EMT.HEAD == 'H15' or EMT.HEAD == 'H23' then
elseif EMT.HEAD == 'H23' then
local Len = ( EMT.TDIST or ChSawLen) + Mill2Offs
local LenRef = Mill2Offs
vtE = Vector3d( EMT.ADIR) * Len - Z_AX() * LenRef
@@ -2358,14 +2394,14 @@ function EmitResetMachining( bNextTool)
end
---------------------------------------------------------------------
function EmitParkRoller( dPosT, bSplitCut, bUsePrevDelta)
function EmitParkRoller( dPosT, bSplitCut, bAgg)
-- se entrambe già parcheggiate, non devo fare alcunché
if ( EMT.V1POS - ParkV1) > -0.1 and ( EMT.V2POS - ParkV2) < 0.1 then return end
-- Assegno quote pinze correnti
local dY1Delta = EgtIf( bUsePrevDelta, EMT.Y1PREVDELTA, EMT.Y1DELTA)
local dY2Delta = EgtIf( bUsePrevDelta, EMT.Y2PREVDELTA, EMT.Y2DELTA)
local dY1Delta = EMT.Y1DELTA
local dY2Delta = EMT.Y2DELTA
-- Parcheggi pinze
local MyParkY1 = ParkY1 + AggLoad
local MyParkY1 = ParkY1 + EgtIf( bAgg, AggLoad, 0)
local MyParkY2 = ParkY2
-- le parcheggio
local MDChar = {}
@@ -2438,6 +2474,9 @@ function EmitParkRoller( dPosT, bSplitCut, bUsePrevDelta)
MDChar.IniStatV2 = 3
MDChar.MovType = MDChar.MovType | 2
end
if EMT.SPLIT_Y1DELTA and EMT.SPLIT_Y1DELTA + dPosT < MyParkY1 then
MDChar.Y1 = MyParkY1
end
EmitMoveDataChars( MDChar)
EmitMoveStartChars( MDChar.MovType)
EmitMoveWaitChars( MDChar.MovType)
@@ -2449,11 +2488,14 @@ end
---------------------------------------------------------------------
-- preselezione utensile su stessa testa (per C.U. mascherato in caso di cambio morse)
function ToolPreSelectionSingleHead( nMchId)
-- se macchina con due teste, preselezione già fatta
if EgtGetHeadId( 'H21') then
-- se macchina con due teste, devo preselezionare stessa testa quando ho motosega, altrimenti già fatta
if EgtGetHeadId( 'H21') and not HeadIsChainSaw( EMT.HEAD) then
return
end
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
-- nome utensile
local sToolChange = nil
local sToolChangePos = nil
@@ -2466,22 +2508,27 @@ function ToolPreSelectionSingleHead( nMchId)
if EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
if EMT.TOOL ~= sNextTool then
local nClId = EgtGetFirstNameInGroup( nNextMchId, 'CL') -- recupero Id del gruppo CL della lavorazione corrente
local nPathId = EgtGetFirstInGroup( nClId or GDB_ID.NULL) -- Id del primo gruppo nella lavorazione (P1)
local dAuxMoveCount = EgtGetInfo( nPathId, 'AS#', 'd') or 0 -- numero di movimenti ausiliari
if dAuxMoveCount > 3 then
bCarrMove = true
end
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
-- motosega non può essere preselezionata
if not HeadIsChainSaw( sNextHead) then
sToolChange = sNextTool
sToolChangePos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
sToolChangeHead = sNextHead
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
-- se stessa testa
if nNextHSet == nHSet then
if EMT.TOOL ~= sNextTool then
local nClId = EgtGetFirstNameInGroup( nNextMchId, 'CL') -- recupero Id del gruppo CL della lavorazione corrente
local nPathId = EgtGetFirstInGroup( nClId or GDB_ID.NULL) -- Id del primo gruppo nella lavorazione (P1)
local dAuxMoveCount = EgtGetInfo( nPathId, 'AS#', 'd') or 0 -- numero di movimenti ausiliari
if dAuxMoveCount > 3 then
bCarrMove = true
end
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
-- motosega non può essere preselezionata
if not HeadIsChainSaw( sNextHead) then
sToolChange = sNextTool
sToolChangePos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
sToolChangeHead = sNextHead
end
end
break
end
break
end
end
end
@@ -2492,29 +2539,36 @@ function ToolPreSelectionSingleHead( nMchId)
EgtSetCurrMachining( EMT.MCHID)
EgtTdbSetCurrTool( EMT.TOOL)
if bCarrMove then
if bCarrMove or EgtGetHeadId( 'H21') then
-- se è stato trovato utensile, emetto preselezione
if sToolChangePos and sToolChange and sToolChangeHead then
local MyParkX1, MyParkB1, MyParkC1
if GetHeadTCSet( sToolChangeHead, sToolChangePos) == 'Head1_TC2' then
MyParkX1 = ParkFrnX1
MyParkB1 = ParkFrnB1
MyParkC1 = ParkFrnC1
local MyParkX, MyParkB, MyParkC
if GetHeadTCSet( sToolChangeHead, sToolChangePos) == 'Head2_TC2' then
MyParkX = ParkX2
MyParkZ = MaxZ2
MyParkB = ParkB2
MyParkC = ParkC2
elseif GetHeadTCSet( sToolChangeHead, sToolChangePos) == 'Head1_TC2' then
MyParkX = ParkFrnX1
MyParkZ = MaxZ1
MyParkB = ParkFrnB1
MyParkC = ParkFrnC1
else
MyParkX1 = ParkX1
MyParkB1 = ParkB1
MyParkC1 = ParkC1
MyParkX = ParkX1
MyParkZ = MaxZ1
MyParkB = ParkB1
MyParkC = ParkC1
end
EmtOutput( '( *** TOOL PRE-SEL *** )')
EmitMoveDataHead( 1, { X=-MyParkX1, Z=MaxZ1, B=MyParkB1, C=MyParkC1, TPos=AdjustTcPos( false, sToolChangePos)})
EmitMoveDataHead( nHSet, { X=-MyParkX, Z=MyParkZ, B=MyParkB, C=MyParkC, TPos=AdjustTcPos( false, sToolChangePos)})
-- comincio i movimenti di preselezione
EmitMoveStartHead( 1)
EmitMoveStartHead( nHSet)
-- se preselezione e c'era montata motosega, si aspetta fine della preselezione prima di andare avanti
if HeadIsChainSaw( EMT.HEAD) then
EmitMoveWaitHead( 1)
EmitMoveWaitHead( nHSet)
else
EMT.START_PRESEL = 1
EMT.START_PRESEL = nHSet
end
-- se non ho trovato utensile da preselezionare, e c'è motosetga montata, si scarica
elseif HeadIsChainSaw( EMT.HEAD) then
@@ -2522,8 +2576,8 @@ function ToolPreSelectionSingleHead( nMchId)
EmitUnmountChainSaw()
end
else
-- se ultima lavorazione e ho motosega, scarico
if not nNextMchId and HeadIsChainSaw( EMT.HEAD) then
-- se ho motosega, scarico
if HeadIsChainSaw( EMT.HEAD) then
EmtOutput( '( *** UNMOUNT CHAIN-SAW *** )')
EmitUnmountChainSaw()
end
@@ -2553,6 +2607,8 @@ function PreselectNextDiffHead( nMchId, sHead)
-- flag preselezione eseguita
local bPresel = false
local bDoubleTool = false
local sDoubleTool = ''
if bVerifyPresel then
-- recupero lavorazione successiva
@@ -2566,6 +2622,20 @@ function PreselectNextDiffHead( nMchId, sHead)
local nNextHSet = GetHeadSet( sNextHead)
if nNextHSet ~= nHSet then
break
else
local sMachUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
local nDouType = EgtGetValInNotes( sMachUserNotes, 'DOUBLE', 'i')
if nDouType == 2 then
local sToolUserNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
local sOtherTool = EgtGetValInNotes( sMachUserNotes, 'TOOLDOUBLE', 's') or EgtGetValInNotes( sToolUserNotes, 'DOUBLE', 's') or ''
local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if EgtTdbSetCurrTool( sOtherTool) and EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
sDoubleTool = sOtherTool
bDoubleTool = true
end
EgtTdbSetCurrTool( sOldTool)
break
end
end
end
end
@@ -2575,6 +2645,10 @@ function PreselectNextDiffHead( nMchId, sHead)
-- se esiste ed appartiene a gruppo diverso
if nNextMchId and EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
-- se è una lavorazione in doppio, selezione altro utensile
if bDoubleTool then
sNextTool = sDoubleTool
end
if EgtTdbSetCurrTool( sNextTool) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
+21 -19
View File
@@ -96,6 +96,10 @@ function OnSimulStart()
if DefTcPos2 then
LoadFirstTool( 2, DefTcPos2)
end
-- se presenti, nascondo i tastatori
DeactivateProbeTool()
ExecStartHome()
-- Se reset o home, esco
if EMT.SIM1ST then return end
@@ -130,7 +134,8 @@ function OnSimulStart()
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC1'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC2'},
{ Grp = 'Base', Sub = 'BELT', Name = 'COLLISION'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM'}}
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM2'}}
if EgtGetHeadId( 'H21') then
table.insert( McdData, { Grp = 'X2', Sub = 'COLLISION', Name = 'STM'})
@@ -537,14 +542,6 @@ function OnSimulToolSelect( dPosA)
end
end
-- se ho due teste, verifico che l'altra sia dalla parte opposta
--if EgtGetHeadId( 'H21') then
-- if nSetHead == 1 then
-- EgtSetAxisPos( 'X2', MinX2)
-- else
-- EgtSetAxisPos( 'X1', MaxX1)
-- end
--end
-- se sega a catena, imposto subito angolo scelto per asse virtuale A
if HeadIsChainSaw( EMT.HEAD) then
-- apro le paratie
@@ -624,8 +621,8 @@ function OnSimulToolDeselect( dPrevA)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
-- se non è chiamata per cambio angolo di presa della sega a catena
if not dPrevA then
local sTool, sHead, sTcPos = FindNextToolOnHeadSet( 1, false)
local sTool, sHead, sTcPos = FindNextToolOnHeadSet( 1, false)
if not dPrevA or not sTool then
-- imposto correttamente i dati di testa
local OrigEMC = EMC
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTDIAM = 0}
@@ -651,13 +648,17 @@ function OnSimulToolDeselect( dPrevA)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
-- se non è chiamata per cambio angolo di presa della sega a catena
if not dPrevA then
local sTool, sHead, sTcPos = FindNextToolOnHeadSet( 2, false)
if not dPrevA or not sTool then
-- cambio utensile
EgtSetAxisPos( 'C2', ParkC2)
EgtSetAxisPos( 'B2', ParkB2)
EgtSetAxisPos( 'Z2', MaxZ2)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
local sTool, sHead, sTcPos = FindNextToolOnHeadSet( 2, false)
local OrigEMC = EMC
EMC = { HEAD = sHead or 'H21', TOOL = sTool, TCPOS = sTcPos, TOTDIAM = 0}
OnSetHead()
EMC = OrigEMC
if sTcPos then
LoadNextTool( 2, DefTcPos2)
end
@@ -666,7 +667,7 @@ function OnSimulToolDeselect( dPrevA)
end
-- se utensile non cambia e non è sega a catena, esco
if ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and not HeadIsChainSaw( EMT.NEXTHEAD) then return end
if bSkipToolChange or ( ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and not HeadIsChainSaw( EMT.NEXTHEAD)) then return end
-- deposito utensile
EgtOutText( 'Tool change in progress...')
-- se prossimo utensile sega a catena, devo mettere in home testa 1 e depositare l'utensile sulla testa 2 o viceversa
@@ -2573,7 +2574,7 @@ function GetHeadSetFromTcPos( sTcPos)
local TCPOS_2A = {}
local TCPOS_2B = {}
if EgtGetHeadId( 'H21') then
TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'}
TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', '501'}
TCPOS_1B = { 'T101'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
TCPOS_2B = { 'T111'}
@@ -2581,7 +2582,7 @@ function GetHeadSetFromTcPos( sTcPos)
TCPOS_1A = { 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'}
TCPOS_1B = { 'T101', 'T201'}
TCPOS_1C = { 'T301'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20', '502'}
end
for _, sVal in ipairs( TCPOS_1A) do
if sVal == sTcPos then return 1, 1 end
@@ -2631,9 +2632,10 @@ function FindNextToolOnHeadSet( nHSet, bFirst)
if EgtSetCurrMachining( OpId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if GetHeadSet( sHead) == nHSet and EMT.TOOL ~= sNextTool then
if not HeadIsChainSaw( sHead) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if GetHeadSet( sNextHead) == nHSet and EMT.TOOL ~= sNextTool then
if not HeadIsChainSaw( sNextHead) then
sHead = sNextHead
sTool = sNextTool
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
end
+50 -16
View File
@@ -4,6 +4,12 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- Carico libreria
local BD = require( 'BeamData')
@@ -290,7 +296,6 @@ function OnSpecialLink()
-- retrazione
EmtRemoveRise( EMC.PREVMCHID, EMC.PREVMAIN)
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1p, EMC.R2, EMC.R3p}, 30, 3, 2, EgtIf( bSplit, 'Split=1;', '')..'FirstRise=1;')
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3p}, 30, 3, 2)
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3p}, 30, 3, 2, 'LastRise=1;')
-- altrimenti collegamento tra due lavorazioni (3)
else
@@ -321,6 +326,8 @@ function OnSpecialLink()
else
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3}, 30, 3, 2, 'UniqueRise=1;')
end
-- altrimenti collegamento tra due lavorazioni (3)
else
end
-- se fresa su testa 2
@@ -423,19 +430,6 @@ function OnSpecialLink()
end
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2}, 30, 3, 2, 'LastRise=1;')
-- se fine lavorazione con deposito utensile
elseif EMC.LINKTYPE == 2 then
-- retrazione
EmtRemoveRise( EMC.PREVMCHID, EMC.PREVMAIN)
if abs( EMC.R1 - EMC.R1p) > 1 or abs( EMC.R2 - EMC.R2p) > 1 then
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1p, 0}, 30, 3, 2, EgtIf( bSplit, 'Split=1;', '')..'FirstRise=1;')
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1, 0}, 30, 3, 2)
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1, EMC.R2}, 30, 3, 2)
else
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1p, EMC.R2p}, 30, 3, 2, EgtIf( bSplit, 'Split=1;', ''))
end
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2}, 30, 3, 2, 'LastRise=1;')
-- altrimenti collegamento tra due lavorazioni (3)
else
-- recupero quota massima di collegamento
@@ -478,7 +472,7 @@ function OnSpecialLink()
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2p, EMC.L3p, EMC.R1p, EMC.R2p, EMC.R3}, 30, 2, 2, 'FirstClimb=1;')
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2p, EMC.R3}, 30, 2, 2)
if abs( EMC.R3) < 0.1 then
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, ParkCSaw0Z1, EMC.R1, EMC.R2, EMC.R3}, 30, 2, 2)
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, ParkCSaw0Z2, EMC.R1, EMC.R2, EMC.R3}, 30, 2, 2)
else
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2, EMC.R3}, 30, 2, 2)
end
@@ -489,7 +483,6 @@ function OnSpecialLink()
-- retrazione
EmtRemoveRise( EMC.PREVMCHID, EMC.PREVMAIN)
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1p, EMC.R2, EMC.R3p}, 30, 3, 2, EgtIf( bSplit, 'Split=1;', '')..'FirstRise=1;')
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3p}, 30, 3, 2)
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3p}, 30, 3, 2, 'LastRise=1;')
-- altrimenti collegamento tra due lavorazioni (3)
else
@@ -981,6 +974,46 @@ function OnSpecialApplyMachining()
-- Recupero la posizione della trave e dei carrelli al termine della precedente operazione
local nPrevOpeId = EgtGetPrevActiveOperation( EMC.MCHID)
-- Se esiste lavorazione precedente ed è una tastatura
if nPrevOpeId and EgtGetOperationType( nPrevOpeId) == MCH_OY.PROBING then
-- se stessa testa e montato già utensile corretto
-- recupero valori assi alla fine della lavorazione precedente e all'inizio della corrente
local vPrevAxes = EmtGetFinalAxesPos( nPrevOpeId, true)
local vCurrAxes = EmtGetInitialAxesPos( EMC.MCHID, true)
-- info lavorazione precedente
EgtSetCurrMachining( nPrevOpeId)
local sPrevTool = EgtGetMachiningParam( MCH_MP.TOOL)
local sPrevHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nSetHead = GetHeadSet( sPrevHead)
local bPrevIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
-- info lavorazione corrente
EgtSetCurrMachining( EMC.MCHID)
local sCurrTool = EgtGetMachiningParam( MCH_MP.TOOL)
local sCurrHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
nSetHead = GetHeadSet( sCurrHead)
local bCurrIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
-- se utensile corrente è compatibile (significa che è già stato precaricato) se stessa testa e con stessa configurazioen assi rotanti, annullo risalita
if IsToolCompatibleWithProbe( sCurrTool, sPrevTool) and bPrevIsFirstHead == bCurrIsFirstHead and abs( vCurrAxes[4] - vPrevAxes[4]) < 1 and abs( vCurrAxes[5] - vPrevAxes[5]) < 1 then
-- in lavorazione precedente elimino eventuale retrazione a Zmax
EmtRemoveRise( nPrevOpeId)
-- in lavorazione corrente elimino eventuale approccio da Zmax
EmtRemoveClimb( EMC.MCHID)
-- prendo sempre la Z massima tra le due
local vClimbPoint
if vCurrAxes[3] - 1.0 < vPrevAxes[3] then
vClimbPoint = vCurrAxes
vCurrAxes[3] = vPrevAxes[3]
elseif vPrevAxes[3] - 1.0 < vCurrAxes[3] then
vClimbPoint = vPrevAxes
vPrevAxes[3] = vCurrAxes[3]
end
EmtAddClimb( EMC.MCHID, vClimbPoint, 4, 1, 0)
end
end
-- Recupero la posizione della trave e dei carrelli al termine della precedente operazione
-- se precedente operazione non esiste, errore
if not nPrevOpeId then
EMC.ERR = 1
@@ -1507,6 +1540,7 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
local dDistFront = - ptMax:getX() - LoadT - dHeadFront
local dDistBack = ptMin:getX() + LoadT + EMC.LB - dHeadBack
EgtOutLog( ' DistFront = ' .. EgtNumToString( dDistFront, 1) .. ' DistBack = ' .. EgtNumToString( dDistBack, 1), 3)
return dDistFront, dDistBack, dRollFront, dRollBack
end
+18 -13
View File
@@ -32,9 +32,9 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1f1_CR5'
PP_NVER = '3.1.6.1'
MIN_MACH_VER = '2.5k1'
PP_VER = '3.1g1'
PP_NVER = '3.1.7.1'
MIN_MACH_VER = '3.1f1'
MACH_NAME = EgtGetCurrMachineName()
-- Carico i dati globali
@@ -224,7 +224,7 @@ if EgtExistsFile( sData) then
-- aggiustamenti
MinY1 = MinV1 + MinDeltaYV
MaxY1 = MaxMchY1
ParkV1 = MaxV1
ParkV1 = MaxV1
ParkY1 = ParkV1 + MinDeltaYV
MinY2 = MinMchY2
MaxY2 = MaxV2 - MinDeltaYV
@@ -836,13 +836,10 @@ function OnSetHead()
EmtModifyAxisHome( 'B1', MyHomeB1)
end
-- se testa H13 (sega a catena)
elseif EMC.HEAD == 'H13' then
elseif EMC.HEAD == 'H13' or EMC.HEAD == 'H15' then
-- aggiustamenti per distanza
local dDist = EgtIf( EMC.DIST and abs( EMC.DIST) > 1, EMC.DIST, ChSawLen)
EmtModifyExitPosition( EMC.HEAD, EMC.EXIT, Point3d( 0, 0, -dDist))
local vtMove = Point3d( 0, 0, -dDist) - Point3d( EMC.EXITPOS)
local ExitId = EgtGetFirstNameInGroup( EgtGetHeadId( EMC.HEAD), 'T'..tostring( EMC.EXIT))
EgtMove( ExitId, vtMove)
-- recupero valore asse A bloccato
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
local CSawPosA = tonumber( sVal:sub( 3) or '')
@@ -851,19 +848,20 @@ function OnSetHead()
EmtModifyAxisHome( 'C1', GetChainSawCHomeFromVirtualAxis( CSawPosA))
EmtModifyAxisHome( 'B1', ParkCSawB1)
EmtModifyAxisDirection( 'B1', X_AX())
-- se testa H15 (mortasatrice di One)
elseif EMC.HEAD == 'H15' then
error( 'Error : Mortiser not yet managed')
end
end
---------------------------------------------------------------------
-------------------------- Testa utilizzata -------------------------
function GetHeadSet( sHead)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' then
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' or sHead == 'H17' then
return 1
elseif sHead == 'H19' then
return 11
elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then
return 2
elseif sHead == 'H29' then
return 21
else
return 0
end
@@ -892,6 +890,7 @@ function GetHeadTCSet( sHead, sTcPos)
return 0
end
end
---------------------------------------------------------------------
-- Funzione che restituisce l'altezza del pezzo in lavorazione
function GetRawHeight()
@@ -911,6 +910,12 @@ function HeadIsChainSaw( sHead)
return ( sHead == 'H13' or sHead == 'H15')
end
---------------------------------------------------------------------
-- Funzione che riconosce testa per tastatore
function HeadIsProbe( sHead)
return ( sHead == 'H19' or sHead == 'H29')
end
---------------------------------------------------------------------
-- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale
function GetChainSawZHomeFromVirtualAxis( dPosA)
@@ -974,7 +979,7 @@ end
-- Funzione per impostare spia stato morsa carrello Y1
function SetPY1Light( bClosed)
if not PY1LightId then return end
EgtSetColor( PY1LightId, EgtIf( bClosed, 'RED', 'LIME'))
EgtSetColor( PY1LightId, EgtIf( bClosed, 'RED', 'LIME'))
if bClosed then
EgtSetInfo( PY1LightId, 'On', '1')
else
+21 -1
View File
@@ -1,10 +1,30 @@
==== Common_ONE-PF Update Log ====
Versione 3.1g1 (07/07/2026)
- (ALL) Prima versione con gestione nuovi link (no tastatore)
- Gestione lavorazioni in doppio
- Preselezione utensile gestibile da parametri TS3
- Gestione Drilling e Pocketing NT
Versione 3.1f5 (26/06/2026)
- (SIM-GEN) Se tasca con motosega in faccia sopra e pezzo alto, si ruota in sicurezza.
Versione 3.1f4 (17/06/2026)
- (MLDE-GEN) Corretta preselezione in caso di testa in lavoro troppo vicina a quella che sta preselezionando. Da aggiungere in MLDE parametri 'Limit_T1_Presel_T2' e 'Limit_T2_Presel_T1'
Versione 3.1f3 (08/06/2026)
- (GEN) M77 viene ora eseguita, prima era commentata.
Versione 3.1f2 (05/06/2026)
- (MLDE-GEN) Aggiunti parametri di limite asse X per decidere se fare preselezione su altra testa. Serve modifica MLDE
Versione 3.1f1 (03/06/2026)
- (NGE-MLDE-GEN-SIM) Versione unificata con predisposizione per gestione tastatori. Serve modificare anche la macchina, per ora gestione completa solo su PFrl.
Versione 3.1c2 (17/03/2026)
- (SIM-GEN) Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito
- Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente. ATT: MIN_MACH -> 3.1b2
Versione 3.1c1 (04/03/2026)
- (GEN) Corretta chiamata di una variabile insesistente in caso di ONE
- (SIM) Allineata simulazione a generazione
+2 -2
View File
@@ -3,8 +3,8 @@
local InfoCommon_STD_PP = {
NAME = 'Common_ONE-PF', -- nome script PP standard
VERSION = '3.1c2', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel
VERSION = '3.1g1', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1f1' -- versione minima kernel
}
return InfoCommon_STD_PP