diff --git a/Beam/BeamData.lua b/Beam/BeamData.lua index 544a09e..748468c 100644 --- a/Beam/BeamData.lua +++ b/Beam/BeamData.lua @@ -102,8 +102,8 @@ if EgtExistsFile( sData) then if Machine.Offsets.PRECUT_HEAD_DISABLE then BeamData.PRECUT_HEAD = ( Machine.Offsets.PRECUT_HEAD_DISABLE == 0) end if Machine.Offsets.PRECUT_TAIL_DISABLE then BeamData.PRECUT_TAIL = ( Machine.Offsets.PRECUT_TAIL_DISABLE == 0) end if Machine.Offsets.MIN_HEIGHT_ADDED_CUTS then BeamData.MIN_HEIGHT_ADDED_CUTS = min( Machine.Offsets.MIN_HEIGHT_ADDED_CUTS, BeamData.MIN_HEIGHT_ADDED_CUTS) end - if Machine.Offsets.NEWCLAMPING ~= nil then BeamData.NEWCLAMPING = Machine.Offsets.NEWCLAMPING end - if Machine.Offsets.FASTCLAMPING ~= nil then BeamData.FASTCLAMPING = Machine.Offsets.FASTCLAMPING end + if Machine.Offsets.NEWCLAMPING ~= nil then BeamData.NEWCLAMPING = ( Machine.Offsets.NEWCLAMPING == 1) end + if Machine.Offsets.FASTCLAMPING ~= nil then BeamData.FASTCLAMPING = ( Machine.Offsets.FASTCLAMPING == 1) end end if Machine.Trave then BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH diff --git a/Common_FAST.NUM.mlpe b/Common_FAST.NUM.mlpe index 07d2cf4..6f857d9 100644 --- a/Common_FAST.NUM.mlpe +++ b/Common_FAST.NUM.mlpe @@ -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 diff --git a/Common_FAST.NUM_PLUS.mlpe b/Common_FAST.NUM_PLUS.mlpe index 205957f..d035f7a 100644 --- a/Common_FAST.NUM_PLUS.mlpe +++ b/Common_FAST.NUM_PLUS.mlpe @@ -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] diff --git a/Common_FAST.TPA.mlpe b/Common_FAST.TPA.mlpe index e683a67..21a1020 100644 --- a/Common_FAST.TPA.mlpe +++ b/Common_FAST.TPA.mlpe @@ -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]