Migliorata gestione movimenti per portare testa vicino a cambio utensile se trave alta.

This commit is contained in:
andrea.villa
2024-09-25 13:22:18 +02:00
parent fbfe8187b9
commit d23a9c6fa9
5 changed files with 159 additions and 1 deletions
+52
View File
@@ -3,6 +3,7 @@
-- carico librerie
local INFO_STD_PP = require( 'Version')
local BD = require( 'BeamData')
-- Variabili di modulo
local CSP_INFO = INFO_STD_PP.NAME..' ver.'..INFO_STD_PP.VERSION..' by EgalWare s.r.l.'
@@ -602,6 +603,8 @@ end
---------------------------------------------------------------------
function OnRapid()
-- recupero prossimo utensile
EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTTCPOS = FindNextTool()
MyBackupAxes()
-- se primo movimento della lavorazione, gestione speciale
if EMT.MCHFIRST and not EMT.OPEISDISP then
@@ -833,6 +836,26 @@ function OnRapid()
EmtAdjustRotaryAxes()
EmitZmax()
EMT.ZMAX = true
-- se pezzi alti e devo cambiare utensile su testa con CU, porto la testa vicino al cambio utensile
if EMT.ST > BeamHeightForFixRot and EMT.HEAD == 'H1' and EMT.TOOL ~= EMT.NEXTTOOL and EMT.NEXTHEAD ~= 'H2' then
local dBAxis = 90
local dCAxis = EgtIf( BD.RIGHT_LOAD, 90, -90)
local sEE = ' EE3'
local sEL = ' EL' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TLEN, ( EMT.TDIST or ChSawLen)), 3)
local sER = ' ER' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TDIAM / 2, EMT.TLEN), 3)
local sET = GetET( EMT.HEAD, EMT.TCPOS, EMT.R3)
local sES = ' ES'..EgtNumToString( EMT.S, 0)
local sOut = 'G101' .. EmtGetAxis( 'L2') .. EmtGetAxis( 'L3') ..' B=' .. EgtNumToString( dBAxis, 3) ..
' C=' .. EgtNumToString( dCAxis, 3) .. sEE .. sEL .. sER .. sET .. sES
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
sOut = 'G101' .. ' X' .. EmtLenToString( -SafeXRotAxes, 3) .. EmtGetAxis( 'L3') ..' B=' .. EgtNumToString( dBAxis, 3) ..
' C=' .. EgtNumToString( dCAxis, 3) .. sEE .. sEL .. sER .. sET .. sES
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
end
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- non previsto
@@ -956,6 +979,35 @@ function OnArc()
EmtUpdatePrev()
end
---------------------------------------------------------------------
function FindNextTool()
-- salvo stato iniziale
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos
local OpId = EgtGetNextActiveOperation( CurrMachId or EMT.MCHID)
while OpId do
local nType = EgtGetOperationType( OpId)
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
if EgtSetCurrMachining( OpId) then
sTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sTool) then
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
break
end
end
end
OpId = EgtGetNextActiveOperation( OpId)
end
-- ripristino stato iniziale
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato
return sTool, sHead, sTcPos
end
---------------------------------------------------------------------
function CalcCharStatus( sCmd, bSkipPress)
-- aperto
+52
View File
@@ -3,6 +3,7 @@
-- carico librerie
local INFO_STD_PP = require( 'Version')
local BD = require( 'BeamData')
-- Variabili di modulo
local CSP_INFO = INFO_STD_PP.NAME..' ver.'..INFO_STD_PP.VERSION..' by EgalWare s.r.l.'
@@ -642,6 +643,8 @@ end
---------------------------------------------------------------------
function OnRapid()
-- recupero prossimo utensile
EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTTCPOS = FindNextTool()
MyBackupAxes()
-- se primo movimento della lavorazione, gestione speciale
if EMT.MCHFIRST and not EMT.OPEISDISP then
@@ -907,6 +910,26 @@ function OnRapid()
EmtAdjustRotaryAxes()
EmitZmax( false)
EMT.ZMAX = true
-- se pezzi alti e devo cambiare utensile su testa con CU, porto la testa vicino al cambio utensile
if EMT.ST > BeamHeightForFixRot and EMT.HEAD == 'H1' and EMT.TOOL ~= EMT.NEXTTOOL and EMT.NEXTHEAD ~= 'H2' then
local dBAxis = 90
local dCAxis = EgtIf( BD.RIGHT_LOAD, 90, -90)
local sEE = ' EE3'
local sEL = ' EL' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TLEN, ( EMT.TDIST or ChSawLen)), 3)
local sER = ' ER' .. EmtLenToString( EgtIf( EMT.HEAD ~= 'H3', EMT.TDIAM / 2, EMT.TLEN), 3)
local sET = GetET( EMT.HEAD, EMT.TCPOS, EMT.R3)
local sES = ' ES'..EgtNumToString( EMT.S, 0)
local sOut = 'G101' .. EmtGetAxis( 'L2') .. EmtGetAxis( 'L3') ..' B=' .. EgtNumToString( dBAxis, 3) ..
' C=' .. EgtNumToString( dCAxis, 3) .. sEE .. sEL .. sER .. sET .. sES
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
sOut = 'G101' .. ' X' .. EmtLenToString( -SafeXRotAxes, 3) .. EmtGetAxis( 'L3') ..' B=' .. EgtNumToString( dBAxis, 3) ..
' C=' .. EgtNumToString( dCAxis, 3) .. sEE .. sEL .. sER .. sET .. sES
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
end
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- non previsto
@@ -1035,6 +1058,35 @@ function OnArc()
EmtUpdatePrev()
end
---------------------------------------------------------------------
function FindNextTool()
-- salvo stato iniziale
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos
local OpId = EgtGetNextActiveOperation( CurrMachId or EMT.MCHID)
while OpId do
local nType = EgtGetOperationType( OpId)
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
if EgtSetCurrMachining( OpId) then
sTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sTool) then
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
break
end
end
end
OpId = EgtGetNextActiveOperation( OpId)
end
-- ripristino stato iniziale
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato
return sTool, sHead, sTcPos
end
---------------------------------------------------------------------
function CalcDinamicaPinze( dH, dS, dL)
local MinTempoAcc = 0.3 -- [s]
+51
View File
@@ -3,6 +3,7 @@
-- carico librerie
local INFO_STD_PP = require( 'Version')
local BD = require( 'BeamData')
-- Variabili di modulo
local CSP_INFO = INFO_STD_PP.NAME..' ver.'..INFO_STD_PP.VERSION..' by EgalWare s.r.l.'
@@ -625,6 +626,8 @@ end
---------------------------------------------------------------------
function OnRapid()
-- recupero prossimo utensile
EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTTCPOS = FindNextTool()
MyBackupAxes()
-- se primo movimento della lavorazione, gestione speciale
if EMT.MCHFIRST and not EMT.OPEISDISP then
@@ -849,6 +852,25 @@ function OnRapid()
EmtAdjustRotaryAxes()
EmitZmax( true)
EMT.ZMAX = true
-- se pezzi alti e devo cambiare utensile su testa con CU, porto la testa vicino al cambio utensile
if EMT.ST > BeamHeightForFixRot and EMT.HEAD == 'H1' and EMT.TOOL ~= EMT.NEXTTOOL and EMT.NEXTHEAD ~= 'H2' then
local dBAxis = 90
local dCAxis = EgtIf( BD.RIGHT_LOAD, 90, -90)
local sOut = 'M101 P1=1' .. ' P2=' .. EmtLenToString( EMT.L2, 3) .. ' P3=' .. EmtLenToString( EMT.L3, 3) ..
' P4=' .. EgtNumToString( dBAxis, 3) .. ' P5=' .. EgtNumToString( dCAxis, 3) ..
' P6=' .. AdjustTcPos( false) .. ' P7=' .. EgtNumToString( EMT.S, 0) ..
' P8=0' .. ' P9=0' .. ' P10=3'
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
sOut = 'M101 P1=1' .. ' P2=' .. EmtLenToString( -SafeXRotAxes, 3) .. ' P3=' .. EmtLenToString( EMT.L3, 3) ..
' P4=' .. EgtNumToString( dBAxis, 3) .. ' P5=' .. EgtNumToString( dCAxis, 3) ..
' P6=' .. AdjustTcPos( false) .. ' P7=' .. EgtNumToString( EMT.S, 0) ..
' P8=0' .. ' P9=0' .. ' P10=3'
EmtOutput( sOut)
EmtOutput( 'M101 P1=2')
EmtOutput( 'M101 P1=3')
end
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- non previsto
@@ -992,6 +1014,35 @@ function OnArc()
EmtUpdatePrev()
end
---------------------------------------------------------------------
function FindNextTool()
-- salvo stato iniziale
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos
local OpId = EgtGetNextActiveOperation( CurrMachId or EMT.MCHID)
while OpId do
local nType = EgtGetOperationType( OpId)
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
if EgtSetCurrMachining( OpId) then
sTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sTool) then
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
break
end
end
end
OpId = EgtGetNextActiveOperation( OpId)
end
-- ripristino stato iniziale
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato
return sTool, sHead, sTcPos
end
---------------------------------------------------------------------
function CalcDinamicaPinze( dH, dS, dL)
local MinTempoAcc = 0.3 -- [s]
+3
View File
@@ -1,5 +1,8 @@
==== Common_FAST Update Log ====
Versione 2.6i6 (25/09/2024)
- (GEN) Migliorata gestione movimenti per portare testa vicino a cambio utensile se trave alta. Ticket#2066
Versione 2.6i5 (24/09/2024)
- (SIM-GEN) Tolto controllo su lunghezza maggiore di 200mm introdotto con 2.6i2 perchè non completamente funzionante
- (GEN) Gestione in OnRapid() di EMT.FLAG=5 (rotazione a Z max per lavorazione successiva). Ora allineata alla simulazione
+1 -1
View File
@@ -3,7 +3,7 @@
local InfoCommon_STD_PP = {
NAME = 'Common_FAST', -- nome script PP standard
VERSION = '2.6i5', -- versione script
VERSION = '2.6i6', -- versione script
MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel
}