Compare commits

...

10 Commits

Author SHA1 Message Date
andrea.villa 418a649d59 Corretto errore scrittura variabile per testa 2 2026-07-10 12:37:25 +02:00
andrea.villa 0b11fb0c60 - In simulazione, corretta gestione scarico motosega in caso di cambio pinze dopo che utensile già caricato
- Migliorati movimenti lama e motosega.
2026-07-10 11:56:42 +02:00
andrea.villa c11a835b98 Non si legge il nome utensile da tabella EMT, ma si utilizza quello corrente salvato in precedenza 2026-07-08 16:03:14 +02:00
andrea.villa 60c3293429 Merge remote-tracking branch 'origin/main' into develop 2026-07-08 16:01:33 +02:00
andrea.villa 9d135a9d44 Corretta gestione cambio utensile con motosega 2026-07-07 14:33:15 +02:00
andrea.villa 79ad98276c Merge branch 'develop' 2026-07-07 08:47:19 +02:00
andrea.villa c907fd4439 Merge branch 'NEW_LINK' into develop 2026-07-07 08:41:16 +02:00
andrea.villa 7e60cd35bc Se tasca con motosega in faccia sopra e pezzo alto, si ruota in sicurezza 2026-06-26 12:57:22 +02:00
andrea.villa fbae1a4ce1 Corretta preselezione in caso di testa in lavoro troppo vicina a quella che sta preselezionando 2026-06-17 08:42:41 +02:00
andrea.villa ee90ea7376 M77 viene ora eseguita, prima era commentata 2026-06-08 14:25:22 +02:00
4 changed files with 116 additions and 60 deletions
+84 -50
View File
@@ -608,64 +608,77 @@ function OnSimulToolSelect( dPosA)
end
---------------------------------------------------------------------
function OnSimulToolDeselect( dPrevA)
-- se utensile corrente è sega a catena, devo depositarla
if HeadIsChainSaw( EMT.PREVHEAD_H1) then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- 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
local sTool, sHead, sTcPos = FindNextToolOnHeadSet( 1, false)
if not dPrevA or not sTool then
function OnSimulToolDeselect( dPrevA, bLastRise)
-- se ToolDeselect chiamata da MLPE, bisogna scaricare perchè è ultimo movimento di rise e poi si cambia utensile
if dPrevA then
local dHeadSet = GetHeadSet( EMT.HEAD)
-- se utensile corrente è sega a catena, devo depositarla
if dHeadSet == 1 and HeadIsChainSaw( EMT.HEAD) then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
-- si cerca prossimo utensile
local sTool, sHead, sTcPos, bCarrMove = FindNextToolOnHeadSet( 1, false)
-- imposto correttamente i dati di testa
local OrigEMC = EMC
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTDIAM = 0}
EMC = { HEAD = sHead or 'H11', TOOL = sTool, TCPOS = sTcPos, TOTDIAM = 0}
OnSetHead()
EMC = OrigEMC
local dHomeX1 = EgtGetAxisHomePos( 'X1')
local dHomeC1 = EgtGetAxisHomePos( 'C1')
local dHomeB1 = EgtGetAxisHomePos( 'B1')
-- se c'è prossimo utensile, oppure se non c'è e c'è un movimento carrelli
if sTool or ( not sTool and bCarrMove) or not bLastRise then
-- cambio utensile
EgtSetAxisPos( 'C1', dHomeC1)
EgtSetAxisPos( 'B1', dHomeB1)
EgtSetAxisPos( 'Z1', MaxZ1)
SimulMoveAxis( 'X1', dHomeX1, MCH_SIM_STEP.RAPID)
if sTcPos then
LoadNextTool( 1, DefTcPos1)
local dHomeX1 = EgtGetAxisHomePos( 'X1')
local dHomeC1 = EgtGetAxisHomePos( 'C1')
local dHomeB1 = EgtGetAxisHomePos( 'B1')
-- cambio utensile
EgtSetAxisPos( 'C1', dHomeC1)
EgtSetAxisPos( 'B1', dHomeB1)
EgtSetAxisPos( 'Z1', MaxZ1)
SimulMoveAxis( 'X1', dHomeX1, MCH_SIM_STEP.RAPID)
if sTcPos then
LoadNextTool( 1, sTcPos)
end
end
EMT.CHSAW_OUT = nil
end
elseif HeadIsChainSaw( EMT.PREVHEAD_H2) then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
-- 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
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)
elseif dHeadSet == 2 and HeadIsChainSaw( EMT.HEAD) then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
-- imposto correttamente i dati di testa
local sTool, sHead, sTcPos, bCarrMove = 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)
-- se c'è prossimo utensile, oppure se non c'è e c'è un movimento carrelli
if sTool or ( not sTool and bCarrMove) or not bLastRise then
local dHomeX2 = EgtGetAxisHomePos( 'X2')
local dHomeC2 = EgtGetAxisHomePos( 'C2')
local dHomeB2 = EgtGetAxisHomePos( 'B2')
-- cambio utensile
EgtSetAxisPos( 'C2', dHomeC2)
EgtSetAxisPos( 'B2', dHomeB2)
EgtSetAxisPos( 'Z2', MaxZ2)
SimulMoveAxis( 'X2', dHomeX2, MCH_SIM_STEP.RAPID)
if sTcPos then
LoadNextTool( 2, sTcPos)
end
end
EMT.CHSAW_OUT = nil
end
return
end
EMT.CHSAW_OUT = nil
-- 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
-- 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
local dHeadSet = GetHeadSet( EMT.PREVHEAD)
@@ -678,12 +691,14 @@ function OnSimulToolDeselect( dPrevA)
'B2', EgtGetAxisHomePos( 'B2'), MCH_SIM_STEP.COLLROT, 'C2', EgtGetAxisHomePos( 'C2'), MCH_SIM_STEP.COLLROT)
end
if dHeadSet == 1 then
local dNextHeadSet = GetHeadSet( EMT.NEXTHEAD)
if dNextHeadSet == 1 then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
else
elseif dNextHeadSet == 2 then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
-- nascondo l'utensile sulla testa
@@ -1218,7 +1233,7 @@ function OnSimulMoveEnd()
local bLastRise = EgtGetInfo( EMT.MOVEID, 'LastRise', 'b')
-- se ultimo rapido e motosega, si va in home
if bLastRise and HeadIsChainSaw( EMT.HEAD) then
OnSimulToolDeselect( EMT.R3)
OnSimulToolDeselect( EMT.R3, true)
EMT.CHSAW_OUT = true
end
end
@@ -1427,6 +1442,13 @@ end
function ExecMoveHome( bNearV)
-- se richiesto, avvicino i rulli
if bNearV then
-- se ho motosega, devo scaricare
if HeadIsChainSaw( EMT.HEAD) then
-- recupero il valore dell'asse virtuale bloccato A
local dPosA = GetCurrChainSawingVirtualAxis()
OnSimulToolDeselect( dPosA)
EMT.CHSAW_OUT = true
end
-- sistemo i rulli
ExecOpenRoller( 1)
ExecOpenRoller( 2)
@@ -2614,7 +2636,7 @@ function FindNextToolOnHeadSet( nHSet, bFirst)
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos
local sTool, sHead, sTcPos, bCarrMove
local OpId
if bFirst then
OpId = EgtGetFirstActiveOperation()
@@ -2627,12 +2649,20 @@ function FindNextToolOnHeadSet( nHSet, bFirst)
if EgtSetCurrMachining( OpId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
local nClId = EgtGetFirstNameInGroup( OpId, '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)
if GetHeadSet( sNextHead) == nHSet and EMT.TOOL ~= sNextTool then
if not HeadIsChainSaw( sNextHead) then
sHead = sNextHead
sTool = sNextTool
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
if GetHeadSet( sNextHead) == nHSet then
if CurrTool ~= sNextTool then
if not HeadIsChainSaw( sNextHead) then
sHead = sNextHead
sTool = sNextTool
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
end
end
break
end
@@ -2641,11 +2671,15 @@ function FindNextToolOnHeadSet( nHSet, bFirst)
end
OpId = EgtGetNextActiveOperation( OpId)
end
-- se non c'è un operazione, significa che è fine pezzo, quindi si forza movimento carrelli perchè avverrà uno scarico
if not OpId then
bCarrMove = true
end
-- ripristino stato iniziale
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato
return sTool, sHead, sTcPos
return sTool, sHead, sTcPos, bCarrMove
end
---------------------------------------------------------------------
+14 -9
View File
@@ -279,11 +279,10 @@ 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, ParkCSaw0Z1, EMC.R1, EMC.R2, EMC.R3}, 31, 2, 2, 'LastClimb=1;')
else
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2, EMC.R3}, 30, 2, 2)
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2, EMC.R3}, 31, 2, 2, 'LastClimb=1;')
end
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3}, 31, 2, 2, 'LastClimb=1;')
-- se fine lavorazione con deposito utensile
elseif EMC.LINKTYPE == 2 then
@@ -400,9 +399,12 @@ function OnSpecialLink()
EmtRemoveClimb( EMC.NEXTMCHID, EMC.NEXTMAIN)
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2p, EMC.L3p, EMC.R1p, EMC.R2p}, 30, 2, 2, 'FirstClimb=1;')
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1p, EMC.R2p}, 30, 2, 2)
-- se assi cambiano di molto
if abs( EMC.R1 - EMC.R1p) > 10 or abs( EMC.R2 - EMC.R2p) > 90 then
-- se asse B cambia di molto
if abs( 0 - EMC.R2p) > 1 then
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1p, 0}, 30, 2, 2)
end
-- se assi cambiano di molto
if abs( EMC.R1 - EMC.R1p) > 10 then
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, 0}, 30, 2, 2)
end
@@ -417,7 +419,10 @@ function OnSpecialLink()
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)
-- se assi cambiano di molto
if abs( EMC.R1 - EMC.R1p) > 10 then
EmtAddRise( EMC.PREVMCHID, EMC.PREVMAIN, { EMC.L1p, EMC.L2p, EMC.L3, EMC.R1, 0}, 30, 3, 2)
end
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;', '')..'FirstRise=1;')
@@ -455,6 +460,7 @@ function OnSpecialLink()
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3, EMC.R1, EMC.R2}, 30, 2, 2, 'LastClimb=1;')
end
end
-- se sega a catena su testa 2
elseif EMC.HEAD == 'H23' then
-- recupero se split da note utente di lavorazione precedente
@@ -466,11 +472,10 @@ 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, ParkCSaw0Z2, 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}, 31, 2, 2, 'LastClimb=1;')
else
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2, EMC.R3}, 30, 2, 2)
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3p, EMC.R1, EMC.R2, EMC.R3}, 31, 2, 2, 'LastClimb=1;')
end
EmtAddClimb( EMC.NEXTMCHID, EMC.NEXTMAIN, { EMC.L1, EMC.L2, EMC.L3, EMC.R1, EMC.R2, EMC.R3}, 31, 2, 2, 'LastClimb=1;')
-- se fine lavorazione con deposito utensile
elseif EMC.LINKTYPE == 2 then
+17
View File
@@ -1,11 +1,28 @@
==== Common_ONE-PF Update Log ====
Versione 3.1-- (--/--/2026)
- (SIM) Non si legge il nome utensile da tabella EMT, ma si utilizza quello corrente salvato in precedenza
- (SIM) Corretta gestione scarico motosega in caso di cambio pinze dopo che utensile già caricato. In generazione era corretto perchè selezione utensile avviene già dopo posizionamento carrelli
- (SIM-GEN) Migliorati movimenti lama e motosega. Ultimo punto climb motosega è in alto in quota parcheggio.
Versione 3.1g2 (07/07/2026)
- (SIM) Corretta gestione cambio utensile con motosega
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
+1 -1
View File
@@ -3,7 +3,7 @@
local InfoCommon_STD_PP = {
NAME = 'Common_ONE-PF', -- nome script PP standard
VERSION = '3.1g1', -- versione script
VERSION = '3.1--', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1f1' -- versione minima kernel
}