Merge branch 'develop'

This commit is contained in:
andrea.villa
2026-07-08 16:05:53 +02:00
6 changed files with 85 additions and 107 deletions
+79 -57
View File
@@ -96,10 +96,6 @@ 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
@@ -134,8 +130,7 @@ 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 = 'STM2'}}
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM'}}
if EgtGetHeadId( 'H21') then
table.insert( McdData, { Grp = 'X2', Sub = 'COLLISION', Name = 'STM'})
@@ -614,63 +609,76 @@ 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
-- 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) 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) 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 bSkipToolChange or ( ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and not HeadIsChainSaw( EMT.NEXTHEAD)) then return end
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)
@@ -683,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
@@ -2574,7 +2584,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', '501'}
TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'}
TCPOS_1B = { 'T101'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
TCPOS_2B = { 'T111'}
@@ -2582,7 +2592,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', '502'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
end
for _, sVal in ipairs( TCPOS_1A) do
if sVal == sTcPos then return 1, 1 end
@@ -2619,7 +2629,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()
@@ -2632,12 +2642,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 EMT.TOOL ~= sNextTool then
if not HeadIsChainSaw( sNextHead) then
sHead = sNextHead
sTool = sNextTool
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
end
end
break
end
@@ -2646,11 +2664,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
---------------------------------------------------------------------
-47
View File
@@ -4,12 +4,6 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- Carico libreria
local BD = require( 'BeamData')
@@ -974,46 +968,6 @@ 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
@@ -1540,7 +1494,6 @@ 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
+2 -2
View File
@@ -32,8 +32,8 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '3.1g1'
PP_NVER = '3.1.7.1'
PP_VER = '3.1g2'
PP_NVER = '3.1.7.2'
MIN_MACH_VER = '3.1f1'
MACH_NAME = EgtGetCurrMachineName()
BIN
View File
Binary file not shown.
+3
View File
@@ -1,5 +1,8 @@
==== Common_ONE-PF Update Log ====
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
+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.1g2', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1f1' -- versione minima kernel
}