Compare commits

..

2 Commits

Author SHA1 Message Date
daniele.nicoli 64d0a46970 Aggiunto Clamp di sicurezza per lettura dei parametri MinJoin da Ts3Data 2026-04-23 12:22:39 +02:00
daniele.nicoli 58db14bc02 Merge remote-tracking branch 'origin/master' into develop 2026-04-23 12:21:55 +02:00
15 changed files with 200 additions and 743 deletions
+2 -2
View File
@@ -121,8 +121,8 @@ if EgtExistsFile( sData) then
if Machine.Offsets.MAX_ANGLE_DRILL_CUT then BeamData.MAX_ANGLE_DRILL_CUT = EgtClamp( Machine.Offsets.MAX_ANGLE_DRILL_CUT, 1, 89) end
if Machine.Offsets.ROT90 ~= nil then BeamData.ROT90 = ( Machine.Offsets.ROT90 == 1) end
if Machine.Offsets.CUT_SIC then BeamData.CUT_SIC = EgtClamp( Machine.Offsets.CUT_SIC, 15, 50) end
if Machine.Offsets.MIN_JOIN_S then BeamData.MIN_JOIN_S = Machine.Offsets.MIN_JOIN_S end
if Machine.Offsets.MIN_JOIN_L then BeamData.MIN_JOIN_L = Machine.Offsets.MIN_JOIN_L end
if Machine.Offsets.MIN_JOIN_S then BeamData.MIN_JOIN_S = EgtClamp( Machine.Offsets.MIN_JOIN_S, 80, 150) end
if Machine.Offsets.MIN_JOIN_L then BeamData.MIN_JOIN_L = EgtClamp( Machine.Offsets.MIN_JOIN_L, 300, 450) end
end
if Machine.Trave then
BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH
-3
View File
@@ -49,6 +49,3 @@
[Sawing]
1=Sawing
[Probing]
1=DTMortise
-11
View File
@@ -1,11 +0,0 @@
-- Probingata.lua by Egaltech s.r.l. 20/06/2025
-- Gestione dati lavorazioni per Travi
-- Tabella per definizione modulo
local ProbingData = {
{ On = true, Name = 'Probing_H1', Type = 'DTMortise'},
{ On = true, Name = 'Probing_H2', Type = 'DTMortise'}
}
---------------------------------------------------------------------
return ProbingData
+167 -329
View File
@@ -27,7 +27,7 @@ function OnStart()
--EMT.LINEINC = 1 -- incremento numerazione linee
--EMT.Ft = 'F' -- token per feed
--EMT.St = 'S' -- token per speed
EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 20000, 155000) -- feed massima pinze
EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 20000, 102000) -- feed massima pinze
EMT.MAXACC = MaxAcc or ( EMT.FMAXPINZE / ( 60 * 0.3)) -- accelerazione massima pinze
EMT.MINACC = MinAcc or ( EMT.FMAXPINZE / ( 60 * 4)) -- accelerazione minima pinze
@@ -421,7 +421,6 @@ function OnToolSelect()
if MCH_TP.DIST then EMT.TDIST = EgtTdbGetCurrToolParam( MCH_TP.DIST) end
if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
EMT.ISPROBING = HeadIsProbe( EMT.HEAD)
end
end
@@ -455,7 +454,6 @@ function OnMachiningStart()
local MyParkCSawC2 = GetChainSawCHomeFromVirtualAxis( dPosA)
EmtModifyAxisHome( 'C2', MyParkCSawC2)
end
-- gestione eventuale lavorazione in doppio
local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i')
if nDouType == 2 or nDouType == 3 then
@@ -823,8 +821,8 @@ function OnRapid()
EMT.IPLGL = false
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2
EmtResetPrev()
@@ -834,101 +832,6 @@ function OnRapid()
EMT.L3 = EMT.L3s
end
end
-- se tastatore
if EMT.ISPROBING then
local nSetHead = GetHeadSet( EMT.HEAD)
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
local idProbeMachining = EMT.MCHID
local bFound = false
local nProbeHead = GetHeadSet( EMT.HEAD)
local idProbeNextMachining = EgtGetNextActiveOperation( idProbeMachining)
while not bFound do
if idProbeNextMachining then
EgtSetCurrMachining( idProbeNextMachining)
local sToolNameNextProbe = EgtGetMachiningParam( MCH_MP.TOOL)
if sToolNameNextProbe then
local sToolHeadNextProbe, sToolTcPosNextProbe = GetToolHead( sToolNameNextProbe)
local nToolHead = GetHeadSet( sToolHeadNextProbe)
-- se sono sulla stessa testa
if bIsFirstHead and nProbeHead == 11 then
EMT.PROBENEXTTOOL_H1 = sToolNameNextProbe
EMT.PROBENEXTHEAD_H1 = sToolHeadNextProbe
EMT.PROBENEXTTCPOS_H1 = sToolTcPosNextProbe
bFound = true
elseif not bIsFirstHead and nProbeHead == 21 then
EMT.PROBENEXTTOOL_H2 = sToolNameNextProbe
EMT.PROBENEXTHEAD_H2 = sToolHeadNextProbe
EMT.PROBENEXTTCPOS_H2 = sToolTcPosNextProbe
bFound = true
end
end
else
break
end
idProbeNextMachining = EgtGetNextActiveOperation( idProbeNextMachining)
end
-- ripristino lavorazione corrente
EgtSetCurrMachining( EMT.MCHID)
local bChanged = true
if bIsFirstHead then
-- se prossimo utensile compatibile, lo prelevo
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1, EMT.TOOL) then
EMT.TCPOS = EMT.PROBENEXTTCPOS_H1
EMT.HEAD = EMT.PROBENEXTHEAD_H1
EMT.TOOL = EMT.PROBENEXTTOOL_H1
else
-- se vecchio utensile compatibile, tengo quello caricato
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL) then
bChanged = false
EMT.TCPOS = EMT.PREVTCPOS_H1
EMT.HEAD = EMT.PREVHEAD_H1
EMT.TOOL = EMT.PREVTOOL_H1
-- altrimenti si seleziona utensile di default
else
ExecMoveZmax( EMT.MCHSPLIT, true)
EMT.TCPOS = DefTcPos1
EMT.TOOL = GetToolNameFromTcPos( DefTcPos1)
EMT.HEAD, _ = GetToolHead( EMT.TOOL)
end
end
-- se cambiato utensile, si setta subito nome precedente
if bChanged then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
end
else
-- se prossimo utensile compatibile, lo prelevo
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2, EMT.TOOL) then
EMT.TCPOS = EMT.PROBENEXTTCPOS_H2
EMT.HEAD = EMT.PROBENEXTHEAD_H2
EMT.TOOL = EMT.PROBENEXTTOOL_H2
else
-- se vecchio utensile compatibile, tengo quello caricato
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL) then
bChanged = false
EMT.TCPOS = EMT.PREVTCPOS_H2
EMT.HEAD = EMT.PREVHEAD_H2
EMT.TOOL = EMT.PREVTOOL_H2
-- altrimenti si seleziona utensile di default
else
ExecMoveZmax( EMT.MCHSPLIT, true)
EMT.TCPOS = DefTcPos2
EMT.TOOL = GetToolNameFromTcPos( DefTcPos2)
EMT.HEAD, _ = GetToolHead( EMT.TOOL)
end
end
-- se cambiato utensile, si setta subito nome precedente
if bChanged then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
end
end
end
-- se prima lavorazione
if EMT.LOAD then
EMT.V2POS = ParkV2
@@ -1286,8 +1189,8 @@ function OnRapid()
EMT.TO_XHOME = nil
EMT.L1pp = nil
EMT.L3pp = nil
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
end
-- calcolo Movimento Pinze (potrebbe richiedere movimento testa in Home)
for i = 1, #EMT.AUXCMD do
@@ -1302,7 +1205,7 @@ function OnRapid()
local nPrevHSet = GetHeadSet( EMT.PREVHEAD)
-- vado in parcheggio sempre con utensile precedente
if not HeadIsChainSaw( EMT.PREVHEAD) then
if nPrevHSet == 1 or nPrevHSet == 11 then
if nPrevHSet == 1 then
local HomeX1 = EgtGetAxisHomePos( 'X1')
EmitMoveDataHead( 1, { X=-EMT.PREVHOMEX_H1, Z=MaxZ1, B=EMT.PREVHOMEB_H1, C=EMT.PREVHOMEC_H1, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H1)})
EmitMoveStartHead( 1, 'EA1')
@@ -1677,89 +1580,81 @@ function OnRapid()
EMT.ZMAX = false
-- se standard
elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
if EMT.ISPROBING then
-- emetto movimenti in Zero macchina
EmitMoveDataHead( GetHeadSet( EMT.HEAD), { X=-EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( GetHeadSet( EMT.HEAD))
EmitMoveWaitHead( GetHeadSet( EMT.HEAD))
else
local sPostMove = ''
if EMT.MCHFIRST then
local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '['), '%)', ']')
if EMT.DOU_TYPE then sOut = sOut .. ' Double' end
EmtOutput( '( *** '..sOut..' *** )')
-- gestione comandi rulli
local sPreMove = ''
if GetV1ToCloseNum( true) then
sPostMove = ' EC-3'
else
sPreMove = ' EC3'
end
if GetV2ToCloseNum( true) then
sPostMove = sPostMove .. ' ED-3'
else
sPreMove = sPreMove .. ' ED3'
end
-- comandi rulli prima di movimento (aperture)
if #sPreMove > 0 then
EmtOutput( 'G157 EA2' .. sPreMove)
end
-- se taglio di coda senza residuo da scaricare, emetto M175 per accelerare il carico della barra successiva
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
EmtOutput( 'M175')
end
EMT.MCHFIRST = false
EMT.PLANEACTIVE = true
end
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
-- aggiusto assi
EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina
local Speed = EMT.S * EgtIf( EMT.HEAD ~= 'H12', 1, 1.65)
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
local dX2 = - ( Delta2TabY - EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 - EMT.TLEN + EgtIf( BD.RIGHT_LOAD, -EMT.HB, EMT.HB)))
local dZ2 = -Head2Z + MillOffs - Mill2Offs + EMT.L3
local dC2 = -EMT.R1
local dB2 = -EMT.R2
EmitMoveDataHead( 2, { X=dX2, Z=dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2 e 1
EmitMoveWaitHead( 2)
EmitMoveWaitHead( 1)
-- ripristino assi
EMT.L2 = -EMT.L2
end
-- calcolo per piano generico
CalcInterpPlane()
EMT.REFLOC = 1
-- trasformo i punti nel piano
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '')
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR
..EgtIf( nHSet~=2 and nHSet~=22, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
-- forzo successiva emissione assi rotanti
EMT.R1p = nil
EMT.R2p = nil
local sPostMove = ''
if EMT.MCHFIRST then
local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '['), '%)', ']')
if EMT.DOU_TYPE then sOut = sOut .. ' Double' end
EmtOutput( '( *** '..sOut..' *** )')
-- gestione comandi rulli
local sPreMove = ''
if GetV1ToCloseNum( true) then
sPostMove = ' EC-3'
else
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
sPreMove = ' EC3'
end
-- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
-- comandi rulli dopo movimento (chiusure)
EmtOutput( sOut)
if #sPostMove > 0 then
EmtOutput( 'G157 EA2' .. sPostMove)
if GetV2ToCloseNum( true) then
sPostMove = sPostMove .. ' ED-3'
else
sPreMove = sPreMove .. ' ED3'
end
-- comandi rulli prima di movimento (aperture)
if #sPreMove > 0 then
EmtOutput( 'G157 EA2' .. sPreMove)
end
-- se taglio di coda senza residuo da scaricare, emetto M175 per accelerare il carico della barra successiva
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
EmtOutput( 'M175')
end
EMT.MCHFIRST = false
EMT.PLANEACTIVE = true
end
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
-- aggiusto assi
EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina
local Speed = EMT.S * EgtIf( EMT.HEAD ~= 'H12', 1, 1.65)
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
local dX2 = - ( Delta2TabY - EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 - EMT.TLEN + EgtIf( BD.RIGHT_LOAD, -EMT.HB, EMT.HB)))
local dZ2 = -Head2Z + MillOffs - Mill2Offs + EMT.L3
local dC2 = -EMT.R1
local dB2 = -EMT.R2
EmitMoveDataHead( 2, { X=dX2, Z=dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2 e 1
EmitMoveWaitHead( 2)
EmitMoveWaitHead( 1)
-- ripristino assi
EMT.L2 = -EMT.L2
end
-- calcolo per piano generico
CalcInterpPlane()
EMT.REFLOC = 1
-- trasformo i punti nel piano
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '')
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR..EgtIf( nHSet~=2, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
-- forzo successiva emissione assi rotanti
EMT.R1p = nil
EMT.R2p = nil
else
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
end
-- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
-- comandi rulli dopo movimento (chiusure)
EmtOutput( sOut)
if #sPostMove > 0 then
EmtOutput( 'G157 EA2' .. sPostMove)
end
-- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then
@@ -1774,15 +1669,12 @@ function OnRapid()
( EMT.HEAD == 'H12' and EMT.TOOL ~= sNextTool ) or ( EMT.HEAD == 'H22' and EMT.TOOL ~= sNextTool) or EMT.MCHSPLIT
local CurrL3o = EMT.L3o
EMT.L3o = EMT.L3op
local bZMax = EmitZmax( true, true, bToXhome, EMT.R1p, EMT.R2p, EMT.MCHSPLIT)
EmitZmax( true, true, bToXhome, EMT.R1p, EMT.R2p, EMT.MCHSPLIT)
EMT.L3o = CurrL3o
-- aggiorno quota finale trave dopo Zmax
EMT.L1o = EMT.TPOS
if bZMax then
EMT.ZMAX = true
ToolPreSelectionSingleHead( EMT.MCHID)
end
EMT.ZMAX = true
ToolPreSelectionSingleHead( EMT.MCHID)
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- non previsto
@@ -1797,111 +1689,86 @@ end
---------------------------------------------------------------------
function OnLinear()
-- se tastatore
if EMT.ISPROBING then
if not EMT.PROBE then
local p3FirstPoint = Point3d( EMT.L1, EMT.L2, EMT.L3)
local p3SecondPoint = Point3d( EMT.L1p, EMT.L2p, EMT.L3p)
local dProbingDist = dist( p3FirstPoint, p3SecondPoint) * 2
local vtE = Vector3d( EMT.EXTR)
local sFace, ProbePosZ
if AreSameVectorApprox( vtE, Y_AX()) then
sFace = EgtIf( BD.RIGHT_LOAD, 4, 2)
elseif AreSameVectorApprox( vtE, -Y_AX()) then
sFace = EgtIf( BD.RIGHT_LOAD, 2, 4)
elseif AreSameVectorApprox( vtE, Z_AX()) then
sFace = 3
else
error( "PROBING DIRECTION NOT MANAGED")
end
local sProbeHead = ' ET' .. GetHeadSet( EMT.HEAD)
EmtOutput( 'G145 Z-'.. EgtNumToString( dProbingDist).. ' EF'..sFace..sProbeHead)
-- tastatura attivata
EMT.PROBE = true
end
else
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
-- calcolo per piano generico
CalcInterpPlane()
EMT.REFLOC = 1
-- salvo posizione attuale
local OldL1 = EMT.L1
local OldL2 = EMT.L2
local OldL3 = EMT.L3
-- imposto posizione precedente (non contiene l'offset in X per sovramateriale di testa EMT.X_OFF)
EMT.L1 = EMT.L1o
EMT.L2 = EMT.L2o
EMT.L3 = EMT.L3o
-- trasformo i punti nel piano
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '')
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR
..EgtIf( nHSet~=2 and nHSet~=22, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
-- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
EmtOutput( sOut)
-- aggiorno precedenti
EMT.MOVE = 0
EmtUpdatePrev()
EMT.MOVE = 1
-- ripristino posizione attuale
EMT.L1 = OldL1
EMT.L2 = OldL2
EMT.L3 = OldL3
end
-- aggiustamento valori
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
-- calcolo per piano generico
CalcInterpPlane()
EMT.REFLOC = 1
-- salvo posizione attuale
local OldL1 = EMT.L1
local OldL2 = EMT.L2
local OldL3 = EMT.L3
-- imposto posizione precedente (non contiene l'offset in X per sovramateriale di testa EMT.X_OFF)
EMT.L1 = EMT.L1o
EMT.L2 = EMT.L2o
EMT.L3 = EMT.L3o
-- trasformo i punti nel piano
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- se lavorazione in doppio e fondo foro, inverto movimento punta doppia
local bDouHoleBott = ( EMT.MCHTYPE == MCH_MY.DRILLING and EMT.DOU_TYPE == 2 and EMT.FLAG == 101)
if bDouHoleBott then
EmtOutput( "G157 EE-1")
end
-- valori degli assi
local sL1, bL1 = EmtGetAxis( 'L1')
local sL2, bL2 = EmtGetAxis( 'L2')
local sL3, bL3 = EmtGetAxis( 'L3')
local sR1, bR1 = EmtGetAxis( 'R1')
local sR2, bR2 = EmtGetAxis( 'R2')
local sAxes = sL1 .. sL2 .. sL3 .. sR2 .. sR1
-- se nulla da emettere, esco
if #sAxes == 0 then return end
-- arresto preciso in angoli di fresature per utensili (non penne) di piccolo diametro
local sSlowDown = ''
if EMT.MCHTYPE == MCH_MY.MILLING and EMT.TTOTDIAM < 15 and abs( EMT.S) > 1000 and ( bL1 or bL2) and not bL3 then
sSlowDown = ' G9'
end
-- aggiungo feed
local sFeed = EmtGetFeed()
-- emetto linea
EmtOutput( "G1"..sSlowDown..sAxes..sFeed)
-- se lavorazione in doppio e fondo foro, muovo punta 2 e poi ripristino movimento standard punta doppia
if bDouHoleBott then
if EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3 then
local dZ = 2 * EMT.L3p - EMT.L3
EmtOutput( "G1 Z" .. EgtNumToString( dZ, 3))
EmtOutput( "G1 Z" .. EgtNumToString( EMT.L3p, 3))
end
EmtOutput( "G157 EE1")
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '')
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR..EgtIf( nHSet~=2, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
EMT.PLANEACTIVE = true
-- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
EmtOutput( sOut)
-- aggiorno precedenti
EMT.MOVE = 0
EmtUpdatePrev()
EMT.MOVE = 1
-- ripristino posizione attuale
EMT.L1 = OldL1
EMT.L2 = OldL2
EMT.L3 = OldL3
end
-- aggiustamento valori
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
-- se lavorazione in doppio e fondo foro, inverto movimento punta doppia
local bDouHoleBott = ( EMT.MCHTYPE == MCH_MY.DRILLING and EMT.DOU_TYPE == 2 and EMT.FLAG == 101)
if bDouHoleBott then
EmtOutput( "G157 EE-1")
end
-- valori degli assi
local sL1, bL1 = EmtGetAxis( 'L1')
local sL2, bL2 = EmtGetAxis( 'L2')
local sL3, bL3 = EmtGetAxis( 'L3')
local sR1, bR1 = EmtGetAxis( 'R1')
local sR2, bR2 = EmtGetAxis( 'R2')
local sAxes = sL1 .. sL2 .. sL3 .. sR2 .. sR1
-- se nulla da emettere, esco
if #sAxes == 0 then return end
-- arresto preciso in angoli di fresature per utensili (non penne) di piccolo diametro
local sSlowDown = ''
if EMT.MCHTYPE == MCH_MY.MILLING and EMT.TTOTDIAM < 15 and abs( EMT.S) > 1000 and ( bL1 or bL2) and not bL3 then
sSlowDown = ' G9'
end
-- aggiungo feed
local sFeed = EmtGetFeed()
-- emetto linea
EmtOutput( "G1"..sSlowDown..sAxes..sFeed)
-- se lavorazione in doppio e fondo foro, muovo punta 2 e poi ripristino movimento standard punta doppia
if bDouHoleBott then
if EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3 then
local dZ = 2 * EMT.L3p - EMT.L3
EmtOutput( "G1 Z" .. EgtNumToString( dZ, 3))
EmtOutput( "G1 Z" .. EgtNumToString( EMT.L3p, 3))
end
EmtOutput( "G157 EE1")
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
EmtUpdatePrev()
end
---------------------------------------------------------------------
@@ -1928,8 +1795,8 @@ function OnArc()
EMT.L2p = nil
EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '')
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR
..EgtIf( nHSet~=2 and nHSet~=22, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR..EgtIf( nHSet~=2, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
EMT.PLANEACTIVE = true
-- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
@@ -2649,13 +2516,12 @@ end
---------------------------------------------------------------------
function GetDiffRotAxAtStart( R1, R2)
local nHSet = GetHeadSet( EMT.HEAD)
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
if not R1 or not PrevR1 or abs( R1 - PrevR1) > 0.1 then
return true
end
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2
if not R2 or not PrevR2 or abs( R2 - PrevR2) > 0.1 then
return true
@@ -2671,12 +2537,12 @@ function MyAdjustLinearAxes()
if EMT.REFLOC then
local vtE
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H19' then
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' then
local dAddLen = EgtIf( EMT.HEAD == 'H12', -SawOffsZ, 0)
local Len = EMT.TLEN + dAddLen + MillOffs
local LenRef = MillOffs
vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef
elseif EMT.HEAD == 'H21' or EMT.HEAD == 'H22' or EMT.HEAD == 'H29' then
elseif EMT.HEAD == 'H21' or EMT.HEAD == 'H22' then
local dAddLen = EgtIf( EMT.HEAD == 'H22', -Saw2OffsZ, 0)
local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs
@@ -2697,7 +2563,7 @@ function MyAdjustLinearAxes()
else
EmtSetLastError( 1211, 'Head not defined ' .. ( EMT.HEAD or ''))
end
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H15' or sHead == 'H17' or EMT.HEAD == 'H19' then
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H15' or sHead == 'H17' then
EMT.L1 = EMT.L1 - vtE:getX()
EMT.L2 = EMT.L2 - DeltaTabY - vtE:getY()
EMT.L3 = EMT.L3 - DeltaTabZ - vtE:getZ()
@@ -2906,40 +2772,13 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
if bReset then
EmitResetMachining()
end
if EMT.ISPROBING then
-- se lavorazione successiva con stessa testa non si va a Z massima
local nSetHead = GetHeadSet( EMT.HEAD)
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
local sToolNameNextProbe
local idProbeNextMachining = EgtGetNextActiveOperation( EMT.MCHID)
if idProbeNextMachining then
EgtSetCurrMachining( idProbeNextMachining)
sToolNameNextProbe = EgtGetMachiningParam( MCH_MP.TOOL)
EgtSetCurrMachining( EMT.MCHID)
end
if sToolNameNextProbe and bIsFirstHead and EMT.PREVTOOL_H1 == sToolNameNextProbe then
return false
elseif sToolNameNextProbe and not bIsFirstHead and EMT.PREVTOOL_H2 == sToolNameNextProbe then
return false
end
end
-- se tastatura attiva, si disabilita la tastatura
-- gestione eventuale tastatura
local bStopProbing = EgtGetValInNotes( EMT.MCHUSERNOTES, 'PROBE', 'b') or EgtGetValInNotes( EMT.MCHUSERNOTES, 'END-PROBE', 'b')
if bStopProbing then
EmtOutput( 'G145 Z-10 EF0')
end
EMT.PROBE = nil
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
local dXPos = EgtIf( bUsePrevDelta, EMT.L2pp or EMT.L2o, EMT.L2o)
-- reset stato di testa in home
EMT.XHOME = nil
-- se testa 1
if nHSet == 1 or nHSet == 11 then
if nHSet == 1 then
-- posizioni sicure
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1')
@@ -3139,7 +2978,6 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
EmitMoveWaitHead( 2)
end
end
return true
end
---------------------------------------------------------------------
@@ -3169,7 +3007,7 @@ function EmitXhome()
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
-- se testa 1
if nHSet == 1 or nHSet == 11 then
if nHSet == 1 then
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1')
local dSafeZ1 = EgtGetAxisHomePos( 'Z1')
@@ -3201,7 +3039,7 @@ end
---------------------------------------------------------------------
function EmitResetMachining()
if EMT.PLANEACTIVE and not EMT.ISPROBING then
if EMT.PLANEACTIVE then
-- se non sono a Z massima e operatore deve entrare in cabina spango sempre
if not EMT.ZMAX and ( GetSpecUnloading( EMT.PATHID) or GetFall( EMT.PATHID)) then
EmtOutput( 'M05')
+17 -183
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'})
@@ -518,11 +513,9 @@ function OnSimulToolSelect( dPosA)
EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
local nSetHead = GetHeadSet( EMT.HEAD)
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
EMT.ISPROBING = HeadIsProbe( EMT.HEAD)
-- se ho due teste, verifico che l'altra sia dalla parte opposta
if EgtGetHeadId( 'H21') then
if bIsFirstHead then
if nSetHead == 1 then
EgtSetAxisPos( 'X2', MinX2)
else
EgtSetAxisPos( 'X1', MaxX1)
@@ -558,75 +551,6 @@ function OnSimulToolSelect( dPosA)
-- Imposto visualizzazione
EgtSetMode( EgtGetHeadId( EMT.HEAD) or GDB_ID.NULL, GDB_MD.STD)
end
-- se tastatore
if HeadIsProbe( EMT.HEAD) then
local bChanged = true
if bIsFirstHead then
-- se prossimo utensile compatibile, lo prelevo
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H1, EMT.TOOL) then
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
EgtLoadTool( EMT.PROBENEXTHEAD_H1, 1, EMT.PROBENEXTTOOL_H1)
EMT.TCPOS = EMT.PROBENEXTTCPOS_H1
EMT.HEAD = EMT.PROBENEXTHEAD_H1
EMT.TOOL = EMT.PROBENEXTTOOL_H1
else
-- se vecchio utensile compatibile, tengo quello caricato
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL) then
bChanged = false
EMT.TCPOS = EMT.PREVTCPOS_H1
EMT.TOOL = EMT.PREVTOOL_H1
EMT.HEAD = EMT.PREVHEAD_H1
-- altrimenti si seleziona utensile di default
else
ExecMoveZmax( EMT.MCHSPLIT, true)
EMT.TCPOS = DefTcPos1
EMT.TOOL = GetToolNameFromTcPos( DefTcPos1)
EMT.HEAD, _ = GetToolHead( EMT.TOOL)
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
EgtLoadTool( EMT.HEAD, 1, EMT.TOOL)
end
end
-- se cambiato utensile, si setta subito nome precedente
if bChanged then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
end
else
-- se prossimo utensile compatibile, lo prelevo
if IsToolCompatibleWithProbe( EMT.PROBENEXTTOOL_H2, EMT.TOOL) then
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
EgtLoadTool( EMT.PROBENEXTHEAD_H2, 1, EMT.PROBENEXTTOOL_H2)
EMT.TCPOS = EMT.PROBENEXTTCPOS_H2
EMT.HEAD = EMT.PROBENEXTHEAD_H2
EMT.TOOL = EMT.PROBENEXTTOOL_H2
else
-- se vecchio utensile compatibile, tengo quello caricato
if IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL) then
bChanged = false
EMT.TCPOS = EMT.PREVTCPOS_H2
EMT.TOOL = EMT.PREVTOOL_H2
EMT.HEAD = EMT.PREVHEAD_H2
-- altrimenti si seleziona utensile di default
else
ExecMoveZmax( EMT.MCHSPLIT, true)
EMT.TCPOS = DefTcPos2
EMT.TOOL = GetToolNameFromTcPos( DefTcPos2)
EMT.HEAD, _ = GetToolHead( EMT.TOOL)
ShowToolInTcPos( EMT.PREVTCPOS_H2, true)
EgtLoadTool( EMT.HEAD, 1, EMT.TOOL)
end
end
-- se cambiato utensile, si setta subito nome precedente
if bChanged then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
end
end
end
-- carico utensile, con breve pausa
EgtPause( 100)
EgtOutText( '')
@@ -695,57 +619,10 @@ function OnSimulToolDeselect( dPrevA)
LoadNextTool( 2, DefTcPos2)
end
end
-- se presenti, nascondo i tastatori
DeactivateProbeTool()
local bSkipToolChange = false
-- se prossima lavorazione è tastatura, si controlla compatibilità con utensile successivo
if HeadIsProbe( EMT.NEXTHEAD) then
local idProbeMachining = EgtGetNextActiveOperation( EMT.MCHID)
local bFound = false
local nProbeHead = GetHeadSet( EMT.NEXTHEAD)
local idProbeNextMachining = EgtGetNextActiveOperation( idProbeMachining)
while not bFound do
if idProbeNextMachining then
EgtSetCurrMachining( idProbeNextMachining)
local sToolNameNextProbe = EgtGetMachiningParam( MCH_MP.TOOL)
if sToolNameNextProbe then
local sToolHeadNextProbe, sToolTcPosNextProbe = GetToolHead( sToolNameNextProbe)
local nToolHead = GetHeadSet( sToolHeadNextProbe)
-- se sono sulla stessa testa
if nToolHead == 1 and nProbeHead == 11 then
EMT.PROBENEXTTOOL_H1 = sToolNameNextProbe
EMT.PROBENEXTHEAD_H1 = sToolHeadNextProbe
EMT.PROBENEXTTCPOS_H1 = sToolTcPosNextProbe
bFound = true
elseif nToolHead == 2 and nProbeHead == 21 then
EMT.PROBENEXTTOOL_H2 = sToolNameNextProbe
EMT.PROBENEXTHEAD_H2 = sToolHeadNextProbe
EMT.PROBENEXTTCPOS_H2 = sToolTcPosNextProbe
bFound = true
end
end
else
break
end
idProbeNextMachining = EgtGetNextActiveOperation( idProbeNextMachining)
end
-- ripristino lavorazione corrente
EgtSetCurrMachining( EMT.MCHID)
if nProbeHead == 11 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H1, EMT.TOOL)) then
;
elseif nProbeHead == 21 and not( IsToolCompatibleWithProbe( EMT.PREVTOOL_H2, EMT.TOOL)) then
;
else
bSkipToolChange = true
end
end
-- reset flag sega a catena già depositata
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
@@ -754,7 +631,7 @@ function OnSimulToolDeselect( dPrevA)
-- se ci sono due teste
if EgtGetHeadId( 'H21') then
local nSetHead = GetHeadSet( EMT.NEXTHEAD)
if nSetHead == 1 or nSetHead == 11 then
if nSetHead == 1 then
-- porto in home testa 1
SimulMoveAxis( 'X1', MaxX1, MCH_SIM_STEP.RAPID)
-- deposito utensile fresa
@@ -810,7 +687,7 @@ function OnSimulToolDeselect( dPrevA)
if nSetHead == 1 and EMT.PREVHEAD_H1 then
local MyParkX1 = EgtIf( GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1', ParkX1, ParkFrnX1)
SimulMoveAxis( 'X1', MyParkX1, MCH_SIM_STEP.RAPID)
elseif nSetHead == 2 and EMT.PREVHEAD_H2 then
elseif EMT.PREVHEAD_H2 then
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
end
end
@@ -841,7 +718,7 @@ function OnSimulToolDeselect( dPrevA)
SimulMoveAxis( 'Z2', ParkCSawZ2, MCH_SIM_STEP.RAPID)
end
-- per prossima testa gruppo 1
elseif nNextSetHead == 1 then
else
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa
@@ -974,7 +851,6 @@ function OnSimulMachiningEnd()
EMT.DOU_TOOL = nil
-- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD)
-- se non ho già tolto la sega a catena, aggiorno valori
if not EMT.CHSAW_OUT then
-- per gruppo testa 1
@@ -1781,50 +1657,16 @@ function ExecMoveZmax( bMchSplit, btoXHome)
-- set della testa
local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead == 0 then return end
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
if EMT.ISPROBING then
-- se lavorazione successiva con stessa testa non si va a Z massima
local sToolNameNextProbe
local idProbeNextMachining = EgtGetNextActiveOperation( EMT.MCHID)
if idProbeNextMachining then
EgtSetCurrMachining( idProbeNextMachining)
sToolNameNextProbe = EgtGetMachiningParam( MCH_MP.TOOL)
EgtSetCurrMachining( EMT.MCHID)
end
local bMoveToZMax = true
if sToolNameNextProbe and bIsFirstHead and EMT.PREVTOOL_H1 == sToolNameNextProbe then
bMoveToZMax = false
elseif sToolNameNextProbe and not bIsFirstHead and EMT.PREVTOOL_H2 == sToolNameNextProbe then
bMoveToZMax = false
end
-- se non serve alzarsi
if not bMoveToZMax then
local vtE = Vector3d( EMT.EXTR)
local ProbePosZ
-- ci si riporta in posizione fuori ingombro pezzo
if AreSameVectorApprox( vtE, Y_AX()) or AreSameVectorApprox( vtE, -Y_AX()) then
ProbePosZ = EMT.TABORI1[3] + EMT.SB
if nSetHead == 1 then
SimulMoveAxis( 'Z1', ProbePosZ, MCH_SIM_STEP.RAPID)
else
SimulMoveAxis( 'Z2', ProbePosZ, MCH_SIM_STEP.RAPID)
end
end
return
end
end
-- posizioni correnti degli assi testa
local CurrX = EgtGetAxisPos( EgtIf( bIsFirstHead, 'X1', 'X2'))
local CurrZ = EgtGetAxisPos( EgtIf( bIsFirstHead, 'Z1', 'Z2'))
local CurrC = EgtGetAxisPos( EgtIf( bIsFirstHead, 'C1', 'C2'))
local CurrB = EgtGetAxisPos( EgtIf( bIsFirstHead, 'B1', 'B2'))
local CurrX = EgtGetAxisPos( EgtIf( nSetHead == 1, 'X1', 'X2'))
local CurrZ = EgtGetAxisPos( EgtIf( nSetHead == 1, 'Z1', 'Z2'))
local CurrC = EgtGetAxisPos( EgtIf( nSetHead == 1, 'C1', 'C2'))
local CurrB = EgtGetAxisPos( EgtIf( nSetHead == 1, 'B1', 'B2'))
-- posizioni home degli assi testa
local HomeX = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'X1', 'X2'))
local HomeZ = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'Z1', 'Z2'))
local HomeC = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'C1', 'C2'))
local HomeB = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'B1', 'B2'))
local HomeX = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'X1', 'X2'))
local HomeZ = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'Z1', 'Z2'))
local HomeC = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'C1', 'C2'))
local HomeB = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'B1', 'B2'))
-- verifico se necessario ruotare la testa
local bRot = ( abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1)
-- se necessario ruotare la testa, allargo i carrelli
@@ -1835,7 +1677,7 @@ function ExecMoveZmax( bMchSplit, btoXHome)
ExecParkRoller( nil, nil, nil, nil, bMchSplit, bAgg)
end
-- se testa 1
if bIsFirstHead then
if nSetHead == 1 then
-- se fresa o lama
if GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1' then
if not HeadIsChainSaw( EMT.HEAD) then
@@ -2678,14 +2520,6 @@ function LoadNextTool( nHSet, sTcPosDef, bFirst)
return sTool
end
---------------------------------------------------------------------
function DeactivateProbeTool()
if Probe then
EgtSetMode( EgtGetHeadId( 'H19') or GDB_ID.NULL, GDB_MD.HIDDEN)
EgtSetMode( EgtGetHeadId( 'H29') or GDB_ID.NULL, GDB_MD.HIDDEN)
end
end
---------------------------------------------------------------------
-- *** ESTIMATION T&L ***
---------------------------------------------------------------------
@@ -3110,7 +2944,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'}
@@ -3118,7 +2952,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
+4 -68
View File
@@ -4,12 +4,6 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- Carico libreria
local BD = require( 'BeamData')
@@ -273,13 +267,6 @@ function OnSpecialMoveZup()
EMC.MODIF = true
end
end
elseif HeadIsChainSaw( EMC.HEAD) then
EMC.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if EMC.TDIR[3] < -0.15 and EMC.L3 > - EMC.TTOTLEN then
EMC.L3 = EMC.TTOTLEN * EMC.TDIR[3]
-- dichiaro modificato
EMC.MODIF = true
end
end
end
@@ -749,49 +736,9 @@ function OnSpecialApplyMachining()
-- Inizializzo codice di errore
EMC.ERR = 0
-- Recupero la 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
local nPrevOpeId = EgtGetPrevActiveOperation( EMC.MCHID)
-- se precedente operazione non esiste, errore
if not nPrevOpeId then
EMC.ERR = 1
@@ -949,6 +896,7 @@ function OnSpecialApplyMachining()
local vAxes = EmtGetAxesPos( nLastEntId)
if #vAxes > 0 then EMC.TPOS = vAxes[1] end
end
end
---------------------------------------------------------------------
@@ -1226,17 +1174,6 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
end
-- Recupero testa
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local sToolName = EgtTdbGetCurrToolParam( MCH_TP.NAME)
local nSetHead = GetHeadSet( sHead)
local bIsFirstHead = ( nSetHead == 1 or nSetHead == 11)
-- se lavorazione di tastatura, si considera montato utensile di default
if HeadIsProbe( sHead) then
local sOtherToolName = GetToolNameFromTcPos( EgtIf( bIsFirstHead, DefTcPos1, DefTcPos2))
local sOtherHeadTool, _ = GetToolHead( sOtherToolName)
EgtLoadTool( sOtherHeadTool, 1, sOtherToolName)
end
-- Recupero valore assi macchina
local nSecId = EgtGetNext( EgtGetFirstInGroup( nPathId))
local vAxes = EmtGetAxesPos( nSecId)
@@ -1247,8 +1184,8 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
end
-- Calcolo dell'ingombro della testa rispetto allo Zero Macchina
local b3Enc
if bIsFirstHead then
if sHead ~= 'H21' and sHead ~= 'H22' and sHead ~= 'H23' then
EgtSetAxisPos( 'C1', vAxes[4])
EgtSetAxisPos( 'B1', vAxes[5])
if sHead == 'H13' or sHead == 'H15' then
@@ -1282,7 +1219,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
BIN
View File
Binary file not shown.
-11
View File
@@ -91,13 +91,11 @@ Language1=Italiano,Ita.txt
Language2=English,Eng.txt
[Tools]
Probe=1
Drillbit=1
Sawblade=1
Mill=1
Mortise=1
Chisel=0
ProbeMaker=MakeProbe.lua
DrillMaker=MakeWoodDrill.lua
SawbladeMaker=MakeSawblade.lua
MillMaker=MakeWoodCylMill.lua
@@ -116,7 +114,6 @@ H21.1:MILL_NOTIP=MillNoTip.nge
H22.1=Saw.nge
[Machinings]
Probing=1
Drilling=1
Sawing=1
Milling=1
@@ -129,8 +126,6 @@ SawFinishing=0
[Machining]
InitScript=InitMach.lua
ExitScript=ExitMach.lua
[Probing]
PrbScript1=StdProbe
[Disposition]
;InitScript=InitDisp.lua
@@ -144,14 +139,10 @@ H12=6615
H13=6616
; Angular transmission
H17=6617
; Probe
H19=6618
; Second 5 axis head
H21=6620
; Second 5 axis saw
H22=6623
; Probe
H29=6618
[SetUp]
Default=Standard
@@ -164,5 +155,3 @@ WinPlace=0,514,138,628,810
Enable=1
Save=0
[ToolTrace]
Enable=1
+6 -112
View File
@@ -42,9 +42,9 @@
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( true)
EgtEnableDebug( false)
PP_VER = '3.1c1_DEV1'
PP_VER = '3.1c1'
PP_NVER = '3.1.3.1'
MIN_MACH_VER = '2.5k1'
MACH_NAME = EgtGetCurrMachineName()
@@ -178,7 +178,6 @@ OptimizedLoadBeam = true
AutoRotMinLen = 0
EstimationRapidMultiplier = 1
ForceToCloseRollersGate = false
Probe = nil
AggreBlockHaus = false
DistZClampToTable = 5 -- distanza tra la tavola e il punto più basso della morsa
ClampingCoeffMin = nil -- coefficiente di fissaggio, se 0 o nil non fa controllo, per il momento da inizializzare da Ts3Data
@@ -272,12 +271,8 @@ if EgtExistsFile( sData) then
if Machine.Offsets.MAXACC then MaxAcc = Machine.Offsets.MAXACC end
if Machine.Offsets.MINACC then MinAcc = Machine.Offsets.MINACC end
if Machine.Offsets.COEFF_STIMATEMPI and Machine.Offsets.COEFF_STIMATEMPI > 0 then EstimationRapidMultiplier = Machine.Offsets.COEFF_STIMATEMPI end
if Machine.Offsets.MAXFEEDPINZE then MaxFeedPinze = Machine.Offsets.MAXFEEDPINZE end
if Machine.Offsets.MAXACC then MaxAcc = Machine.Offsets.MAXACC end
if Machine.Offsets.MINACC then MinAcc = Machine.Offsets.MINACC end
if Machine.Offsets.CHIUDI_PINZE_2_3_SCAMBIO then ForceToCloseRollersGate = Machine.Offsets.CHIUDI_PINZE_2_3_SCAMBIO == 1 end
if Machine.Offsets.WOOD_DENSITY then WoodDensity = Machine.Offsets.WOOD_DENSITY end
if Machine.Offsets.PROBE then Probe = Machine.Offsets.PROBE end -- Tastatore su entrembe le teste. 1 = solo testa 1, 2 = solo testa 2, 3 = entrambe le teste
if Machine.Offsets.AGGRE_BH then AggreBlockHaus = ( Machine.Offsets.AGGRE_BH == 1) end
AngTrBHOffs = Machine.Offsets.OFFSETZ_RINV_BH or AngTrBHOffs
AngTrBHLen = Machine.Offsets.OFFSETX_RINV_BH or AngTrBHLen
@@ -354,13 +349,6 @@ EmtAxis {
Home = ParkC1,
Geo = 'C1_AXIS/GEO',
Aux = {'C1_AXIS/SOLID', 'C1_AXIS/COLLISION'}}
-- se tastatore presente
local sBAxisAuxGeom
if Probe == 1 or Probe == 3 then
sBAxisAuxGeom = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION', 'PROBE_B1/SOLID_PROBE', 'PROBE_B1/COLLISION_PROBE'}
else
sBAxisAuxGeom = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION'}
end
EmtAxis {
Name = 'B1',
Parent = 'C1',
@@ -371,7 +359,7 @@ EmtAxis {
Stroke = {MinB1, MaxB1},
Home = ParkB1,
Geo = 'B1_AXIS/GEO',
Aux = sBAxisAuxGeom }
Aux = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION'}}
-- Frese
local H11Id = EmtHead {
Name = 'H11',
@@ -399,22 +387,6 @@ local H12Id = EmtHead {
OthColl = {'B1/SOLID', 'C1/SOLID'},
Geo = 'H12_HEAD/GEO'}
--EgtSetInfo( H12Id, 'ZMAXONROT', '1,190')
-- Tastatore su testa 1
local H19Id
if Probe == 1 or Probe == 3 then
H19Id = EmtHead {
Name = 'H19',
Parent = 'B1',
HSet = 'H19',
Type = MCH_HT.STD,
Pos = Point3d( -60, -81, 0),
TDir = Z_AX(),
ADir = -Y_AX(),
Rot1W = 0.2,
Rot2Stroke = { MinB1, MaxB1},
OthColl = {'B1/SOLID', 'C1/SOLID'},
Geo = 'H19_HEAD/GEO'}
end
-- Sega a catena
EmtAxis {
Name = 'A',
@@ -494,12 +466,6 @@ local C2Id = EmtAxis {
Home = ParkC2,
Geo = 'C2_AXIS/GEO',
Aux = {'C2_AXIS/SOLID', 'C2_AXIS/COLLISION'}}
-- se presente tastatore
if Probe == 2 or Probe == 3 then
sBAxisAuxGeom = {'B2_AXIS/SOLID', 'B2_AXIS/COLLISION', 'PROBE_B2/SOLID_PROBE', 'PROBE_B2/COLLISION_PROBE'}
else
sBAxisAuxGeom = {'B2_AXIS/SOLID', 'B2_AXIS/COLLISION'}
end
local B2Id = EmtAxis {
Name = 'B2',
Parent = 'C2',
@@ -510,7 +476,7 @@ local B2Id = EmtAxis {
Stroke = {MinB2, MaxB2},
Home = ParkB2,
Geo = 'B2_AXIS/GEO',
Aux = sBAxisAuxGeom}
Aux = {'B2_AXIS/SOLID', 'B2_AXIS/COLLISION'}}
local vtMove2 = Vector3d( 0, Head2Y, Head2Z)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'SOLID'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'COLLISION'), vtMove2, GDB_RT.GLOB)
@@ -520,10 +486,6 @@ EgtMove( EgtGetFirstNameInGroup( C2Id, 'SOLID'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( C2Id, 'COLLISION'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( B2Id, 'SOLID'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( B2Id, 'COLLISION'), vtMove2, GDB_RT.GLOB)
if Probe == 2 or Probe == 3 then
EgtMove( EgtGetFirstNameInGroup( B2Id, 'SOLID_PROBE'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( B2Id, 'COLLISION_PROBE'), vtMove2, GDB_RT.GLOB)
end
-- Frese
local H21Id = EmtHead {
Name = 'H21',
@@ -552,22 +514,6 @@ if SecondSaw then
Geo = 'H22_HEAD/GEO'}
--EgtSetInfo( H22Id, 'ZMAXONROT', '1,190')
end
-- Tastatore su testa 2
local H29Id
if Probe == 2 or Probe == 3 then
H29Id = EmtHead {
Name = 'H29',
Parent = 'B2',
HSet = 'H29',
Type = MCH_HT.STD,
Pos = Point3d( Head2X - 60, Head2Y - 81, Head2Z + 0),
TDir = Z_AX(),
ADir = -Y_AX(),
Rot1W = 0.2,
Rot2Stroke = { MinB2, MaxB2},
OthColl = {'B2/SOLID', 'C2/SOLID'},
Geo = 'H29_HEAD/GEO'}
end
-- *** Carrelli ***
-- Morse
local Y1Id = EmtAxis {
@@ -999,12 +945,8 @@ end
function GetHeadSet( sHead)
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' then
elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then
return 2
elseif sHead == 'H29' then
return 21
else
return 0
end
@@ -1052,54 +994,6 @@ function HeadIsChainSaw( sHead)
return ( sHead == 'H13')
end
---------------------------------------------------------------------
-- Funzione che riconosce testa per tastatore
function HeadIsProbe( sHead)
return ( sHead == 'H19' or sHead == 'H29')
end
---------------------------------------------------------------------
function IsToolCompatibleWithProbe( sToolName, sCurrTool)
local bToolIsCompatible = false
if sToolName then
EgtTdbSetCurrTool( sToolName)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
local dToolLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if dToolDiam < 100 and dToolLen < 160 then
bToolIsCompatible = true
end
EgtTdbSetCurrTool( sCurrTool)
end
return bToolIsCompatible
end
---------------------------------------------------------------------
function GetToolNameFromTcPos( sTcPos)
local sToolName
-- Carico gli utensili sulle barre portautensili
local vTcPos = EgtGetAllTcPosNames()
if vTcPos then
for i = 1, #vTcPos do
if vTcPos[i] == sTcPos then
local sToolsName = EgtGetToolsInCurrSetupPos( vTcPos[i])
sToolName = sToolsName[1]
end
end
end
return sToolName
end
---------------------------------------------------------------------
function GetToolHead( sToolName)
local sHead
local sCurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
EgtTdbSetCurrTool( sToolName)
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
EgtTdbSetCurrTool( sCurrTool)
return sHead, sTcPos
end
---------------------------------------------------------------------
-- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale
function GetChainSawZHomeFromVirtualAxis( dPosA)
@@ -1154,7 +1048,6 @@ function GetZExtra( sHead, dAngV)
return 0
end
end
return 0
end
---------------------------------------------------------------------
@@ -1195,6 +1088,7 @@ function GetPY2Light()
return ( EgtGetInfo( PY2LightId, 'On') == '1')
end
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
function OnResetMachine()
-6
View File
@@ -2,9 +2,6 @@
;Index = Type, Description, Default Value
; Type : b=boolean, d=double, l=lenght, s=string
[Probing]
0=s,Type,Head
[Drilling]
[Sawing]
@@ -16,9 +13,6 @@
3=d,TrimExt,0
4=s,VtFaceUse,0,0,0
5=s,EdgesFaceUse,0
6=b,PROBE,0
7=b,START-PROBE,0
8=b,END-PROBE,0
[Pocketing]
0=l,MaxElev,0
+1 -13
View File
@@ -31,8 +31,6 @@ local GS = {}
local PositionTable = {}
local SecondSaw = ( EgtGetHeadId( 'H22') ~= nil)
local AggreBH = ( EgtGetHeadId( 'H17') ~= nil)
local ProbeFirstHead = ( EgtGetHeadId( 'H19') ~= nil)
local ProbeSecondHead = ( EgtGetHeadId( 'H29') ~= nil)
if SecondSaw then
PositionTable = {{Pos = "Pos1", TcPos = "T1", Head = "H12", Group = "G1"},
{Pos = "Pos2", TcPos = "T3", Head = "H11", Group = "G1"},
@@ -81,17 +79,7 @@ else
table.insert( PositionTable, {Pos = "Pos21", TcPos = "T201", Head = "H13", Group = "G2"})
end
end
-- aggiunta tastatori
if ProbeFirstHead then
local sIndex = EgtNumToString( #PositionTable + 1)
table.insert( PositionTable, {Pos = "Pos"..sIndex, TcPos = "T501", Head = "H19", Group = "G4"})
end
if ProbeSecondHead then
local sIndex = EgtNumToString( #PositionTable + 1)
table.insert( PositionTable, {Pos = "Pos"..sIndex, TcPos = "T502", Head = "H29", Group = "G4"})
end
local UsePositionHead = true
local UsePositionHead = false
local function IsInGeomSet( ToolHead, PosHead)
for GsIndex = 1, #GS do
Binary file not shown.
Binary file not shown.
+3 -4
View File
@@ -36,7 +36,6 @@
4=s,DOUBLE
[MORTISE_STD]
0=th,TH,
1=b,MORTISE
2=d,STEP
3=d,SIDESTEP
0=b,MORTISE
1=d,STEP
2=d,SIDESTEP
-1
View File
@@ -75,7 +75,6 @@ Versione 2.7g1 (01/07/2025)
Versione 2.7f1 (04/06/2025)
- (SIM) Aggiunta gestione qualità VMILL da impostazioni macchina. Tolto parametro 'CoeffVM'.
- (GEN) Prima versione gestione tastatore
- (GEN) Aggiunti parametri FMAXPINZE, MAXACC, MINACC configurabili da TS3. Ticket#2052
Versione 2.7e1 (28/05/2025)