Compare commits

..

4 Commits

Author SHA1 Message Date
andrea.villa d3aac014b7 Allineamento con common ver. 3.1f3 2026-06-08 14:41:56 +02:00
andrea.villa 87ebd3a20d Aggiunta lettura quote parcheggio 2026-06-03 12:15:44 +02:00
andrea.villa 8e46749ecd HOTFIX problema simulazione 2026-06-03 11:54:12 +02:00
andrea.villa c083e04e59 Allineamento a common 3.1f1 2026-06-03 09:47:59 +02:00
7 changed files with 680 additions and 255 deletions
+2 -2
View File
@@ -110,8 +110,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.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.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.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 = EgtClamp( Machine.Offsets.MIN_JOIN_S, 80, 150) 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 = EgtClamp( Machine.Offsets.MIN_JOIN_L, 300, 450) end if Machine.Offsets.MIN_JOIN_L then BeamData.MIN_JOIN_L = Machine.Offsets.MIN_JOIN_L end
end end
if Machine.Trave then if Machine.Trave then
BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH
+398 -221
View File
@@ -27,7 +27,7 @@ function OnStart()
--EMT.LINEINC = 1 -- incremento numerazione linee --EMT.LINEINC = 1 -- incremento numerazione linee
--EMT.Ft = 'F' -- token per feed --EMT.Ft = 'F' -- token per feed
--EMT.St = 'S' -- token per speed --EMT.St = 'S' -- token per speed
EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 20000, 102000) -- feed massima pinze EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 102000, 20000, 155000) -- feed massima pinze
EMT.MAXACC = MaxAcc or ( EMT.FMAXPINZE / ( 60 * 0.3)) -- accelerazione 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 EMT.MINACC = MinAcc or ( EMT.FMAXPINZE / ( 60 * 4)) -- accelerazione minima pinze
@@ -421,6 +421,7 @@ function OnToolSelect()
if MCH_TP.DIST then EMT.TDIST = EgtTdbGetCurrToolParam( MCH_TP.DIST) end 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 if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
EMT.ISPROBING = HeadIsProbe( EMT.HEAD)
end end
end end
@@ -454,6 +455,7 @@ function OnMachiningStart()
local MyParkCSawC2 = GetChainSawCHomeFromVirtualAxis( dPosA) local MyParkCSawC2 = GetChainSawCHomeFromVirtualAxis( dPosA)
EmtModifyAxisHome( 'C2', MyParkCSawC2) EmtModifyAxisHome( 'C2', MyParkCSawC2)
end end
-- gestione eventuale lavorazione in doppio -- gestione eventuale lavorazione in doppio
local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i') local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i')
if nDouType == 2 or nDouType == 3 then if nDouType == 2 or nDouType == 3 then
@@ -595,7 +597,7 @@ function OnMachiningEnd()
EmtOutput( sOut) EmtOutput( sOut)
end end
elseif not EMT.PREROT then elseif not EMT.PREROT then
EmtOutput( '(M77)') EmtOutput( 'M77')
end end
end end
end end
@@ -821,8 +823,8 @@ function OnRapid()
EMT.IPLGL = false EMT.IPLGL = false
MyAdjustLinearAxes() MyAdjustLinearAxes()
EmtAdjustRotaryAxes() EmtAdjustRotaryAxes()
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2')) local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2')) local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1 local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2 local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2
EmtResetPrev() EmtResetPrev()
@@ -832,6 +834,101 @@ function OnRapid()
EMT.L3 = EMT.L3s EMT.L3 = EMT.L3s
end end
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 -- se prima lavorazione
if EMT.LOAD then if EMT.LOAD then
EMT.V2POS = ParkV2 EMT.V2POS = ParkV2
@@ -1189,8 +1286,8 @@ function OnRapid()
EMT.TO_XHOME = nil EMT.TO_XHOME = nil
EMT.L1pp = nil EMT.L1pp = nil
EMT.L3pp = nil EMT.L3pp = nil
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2')) PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2')) PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
end end
-- calcolo Movimento Pinze (potrebbe richiedere movimento testa in Home) -- calcolo Movimento Pinze (potrebbe richiedere movimento testa in Home)
for i = 1, #EMT.AUXCMD do for i = 1, #EMT.AUXCMD do
@@ -1205,7 +1302,7 @@ function OnRapid()
local nPrevHSet = GetHeadSet( EMT.PREVHEAD) local nPrevHSet = GetHeadSet( EMT.PREVHEAD)
-- vado in parcheggio sempre con utensile precedente -- vado in parcheggio sempre con utensile precedente
if not HeadIsChainSaw( EMT.PREVHEAD) then if not HeadIsChainSaw( EMT.PREVHEAD) then
if nPrevHSet == 1 then if nPrevHSet == 1 or nPrevHSet == 11 then
local HomeX1 = EgtGetAxisHomePos( 'X1') 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)}) 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') EmitMoveStartHead( 1, 'EA1')
@@ -1580,81 +1677,89 @@ function OnRapid()
EMT.ZMAX = false EMT.ZMAX = false
-- se standard -- se standard
elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
local sPostMove = '' if EMT.ISPROBING then
if EMT.MCHFIRST then -- emetto movimenti in Zero macchina
local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '['), '%)', ']') EmitMoveDataHead( GetHeadSet( EMT.HEAD), { X=-EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
if EMT.DOU_TYPE then sOut = sOut .. ' Double' end EmitMoveStartHead( GetHeadSet( EMT.HEAD))
EmtOutput( '( *** '..sOut..' *** )') EmitMoveWaitHead( GetHeadSet( EMT.HEAD))
-- 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, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
-- forzo successiva emissione assi rotanti
EMT.R1p = nil
EMT.R2p = nil
else else
MyAdjustLinearAxes() local sPostMove = ''
EmtAdjustRotaryAxes() 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 end
-- emissione movimento -- se necessario, impostazione riferimento locale
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. if EMT.REFLOC == 0 then
EmtGetAxis('R2')..EmtGetAxis('R1') -- se lavorazione in doppio
-- comandi rulli dopo movimento (chiusure) if EMT.DOU_TYPE == 2 then
EmtOutput( sOut) -- aggiusto assi
if #sPostMove > 0 then EMT.L2 = -EMT.L2
EmtOutput( 'G157 EA2' .. sPostMove) -- 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
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
end end
-- se altrimenti risalita a Z max a fine lavorazione -- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then elseif EMT.FLAG == 3 then
@@ -1669,12 +1774,15 @@ function OnRapid()
( EMT.HEAD == 'H12' and EMT.TOOL ~= sNextTool ) or ( EMT.HEAD == 'H22' and EMT.TOOL ~= sNextTool) or EMT.MCHSPLIT ( EMT.HEAD == 'H12' and EMT.TOOL ~= sNextTool ) or ( EMT.HEAD == 'H22' and EMT.TOOL ~= sNextTool) or EMT.MCHSPLIT
local CurrL3o = EMT.L3o local CurrL3o = EMT.L3o
EMT.L3o = EMT.L3op EMT.L3o = EMT.L3op
EmitZmax( true, true, bToXhome, EMT.R1p, EMT.R2p, EMT.MCHSPLIT) local bZMax = EmitZmax( true, true, bToXhome, EMT.R1p, EMT.R2p, EMT.MCHSPLIT)
EMT.L3o = CurrL3o EMT.L3o = CurrL3o
-- aggiorno quota finale trave dopo Zmax -- aggiorno quota finale trave dopo Zmax
EMT.L1o = EMT.TPOS EMT.L1o = EMT.TPOS
EMT.ZMAX = true if bZMax then
ToolPreSelectionSingleHead( EMT.MCHID) EMT.ZMAX = true
ToolPreSelectionSingleHead( EMT.MCHID)
end
-- se altrimenti movimento in Home -- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then elseif EMT.FLAG == 4 then
-- non previsto -- non previsto
@@ -1689,86 +1797,112 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnLinear() function OnLinear()
-- se necessario, impostazione riferimento locale -- se tastatore
if EMT.REFLOC == 0 then if EMT.ISPROBING then
-- gruppo della testa if not EMT.PROBE then
local nHSet = GetHeadSet( EMT.HEAD) local p3FirstPoint = Point3d( EMT.L1, EMT.L2, EMT.L3)
-- calcolo per piano generico local p3SecondPoint = Point3d( EMT.L1p, EMT.L2p, EMT.L3p)
CalcInterpPlane() local dProbingDist = dist( p3FirstPoint, p3SecondPoint) * 2
EMT.REFLOC = 1 local vtE = Vector3d( EMT.EXTR)
-- salvo posizione attuale local sFace, ProbePosZ
local OldL1 = EMT.L1 if AreSameVectorApprox( vtE, Y_AX()) then
local OldL2 = EMT.L2 sFace = EgtIf( BD.RIGHT_LOAD, 4, 2)
local OldL3 = EMT.L3 elseif AreSameVectorApprox( vtE, -Y_AX()) then
-- imposto posizione precedente (non contiene l'offset in X per sovramateriale di testa EMT.X_OFF) sFace = EgtIf( BD.RIGHT_LOAD, 2, 4)
EMT.L1 = EMT.L1o elseif AreSameVectorApprox( vtE, Z_AX()) then
EMT.L2 = EMT.L2o sFace = 3
EMT.L3 = EMT.L3o else
-- trasformo i punti nel piano 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())
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() MyAdjustLinearAxes()
EmtAdjustRotaryAxes() 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())
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 -- se lavorazione in doppio e fondo foro, inverto movimento punta doppia
MyAdjustLinearAxes() local bDouHoleBott = ( EMT.MCHTYPE == MCH_MY.DRILLING and EMT.DOU_TYPE == 2 and EMT.FLAG == 101)
EmtAdjustRotaryAxes() if bDouHoleBott then
EmtOutput( "G157 EE-1")
-- 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 end
EmtOutput( "G157 EE1")
end
-- aggiorno valori come precedenti -- valori degli assi
EMT.TPOS = EMT.L1o local sL1, bL1 = EmtGetAxis( 'L1')
EmtUpdatePrev() 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -1795,7 +1929,8 @@ function OnArc()
EMT.L2p = nil EMT.L2p = nil
EMT.L3p = nil EMT.L3p = nil
local sDouFlag = EgtIf( EMT.DOU_TYPE, ' EE1', '') 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()) EmtOutput( 'G142'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..EMT.IPLGLSTR
..EgtIf( nHSet~=2 and nHSet~=22, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
EMT.PLANEACTIVE = true EMT.PLANEACTIVE = true
-- emissione movimento -- emissione movimento
local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. local sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
@@ -2516,12 +2651,13 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function GetDiffRotAxAtStart( R1, R2) function GetDiffRotAxAtStart( R1, R2)
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2')) local nHSet = GetHeadSet( EMT.HEAD)
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1 local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
if not R1 or not PrevR1 or abs( R1 - PrevR1) > 0.1 then if not R1 or not PrevR1 or abs( R1 - PrevR1) > 0.1 then
return true return true
end end
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2')) local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2 local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2
if not R2 or not PrevR2 or abs( R2 - PrevR2) > 0.1 then if not R2 or not PrevR2 or abs( R2 - PrevR2) > 0.1 then
return true return true
@@ -2537,12 +2673,12 @@ function MyAdjustLinearAxes()
if EMT.REFLOC then if EMT.REFLOC then
local vtE local vtE
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' then if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H19' then
local dAddLen = EgtIf( EMT.HEAD == 'H12', -SawOffsZ, 0) local dAddLen = EgtIf( EMT.HEAD == 'H12', -SawOffsZ, 0)
local Len = EMT.TLEN + dAddLen + MillOffs local Len = EMT.TLEN + dAddLen + MillOffs
local LenRef = MillOffs local LenRef = MillOffs
vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef
elseif EMT.HEAD == 'H21' or EMT.HEAD == 'H22' then elseif EMT.HEAD == 'H21' or EMT.HEAD == 'H22' or EMT.HEAD == 'H29' then
local dAddLen = EgtIf( EMT.HEAD == 'H22', -Saw2OffsZ, 0) local dAddLen = EgtIf( EMT.HEAD == 'H22', -Saw2OffsZ, 0)
local Len = EMT.TLEN + dAddLen + Mill2Offs local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs local LenRef = Mill2Offs
@@ -2563,7 +2699,7 @@ function MyAdjustLinearAxes()
else else
EmtSetLastError( 1211, 'Head not defined ' .. ( EMT.HEAD or '')) EmtSetLastError( 1211, 'Head not defined ' .. ( EMT.HEAD or ''))
end end
if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H15' or sHead == 'H17' then if EMT.HEAD == 'H11' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H15' or sHead == 'H17' or EMT.HEAD == 'H19' then
EMT.L1 = EMT.L1 - vtE:getX() EMT.L1 = EMT.L1 - vtE:getX()
EMT.L2 = EMT.L2 - DeltaTabY - vtE:getY() EMT.L2 = EMT.L2 - DeltaTabY - vtE:getY()
EMT.L3 = EMT.L3 - DeltaTabZ - vtE:getZ() EMT.L3 = EMT.L3 - DeltaTabZ - vtE:getZ()
@@ -2772,13 +2908,40 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
if bReset then if bReset then
EmitResetMachining() EmitResetMachining()
end 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 EMT.PROBE and bStopProbing then
EmtOutput( 'G145 Z-10 EF0')
EMT.PROBE = nil
end
-- gruppo della testa -- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD) local nHSet = GetHeadSet( EMT.HEAD)
local dXPos = EgtIf( bUsePrevDelta, EMT.L2pp or EMT.L2o, EMT.L2o) local dXPos = EgtIf( bUsePrevDelta, EMT.L2pp or EMT.L2o, EMT.L2o)
-- reset stato di testa in home -- reset stato di testa in home
EMT.XHOME = nil EMT.XHOME = nil
-- se testa 1 -- se testa 1
if nHSet == 1 then if nHSet == 1 or nHSet == 11 then
-- posizioni sicure -- posizioni sicure
local dMaxZ1 = EgtGetAxisMax( 'Z1') local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1') local dSafeX1 = EgtGetAxisHomePos( 'X1')
@@ -2978,6 +3141,7 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
EmitMoveWaitHead( 2) EmitMoveWaitHead( 2)
end end
end end
return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -3007,7 +3171,7 @@ function EmitXhome()
-- gruppo della testa -- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD) local nHSet = GetHeadSet( EMT.HEAD)
-- se testa 1 -- se testa 1
if nHSet == 1 then if nHSet == 1 or nHSet == 11 then
local dMaxZ1 = EgtGetAxisMax( 'Z1') local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1') local dSafeX1 = EgtGetAxisHomePos( 'X1')
local dSafeZ1 = EgtGetAxisHomePos( 'Z1') local dSafeZ1 = EgtGetAxisHomePos( 'Z1')
@@ -3039,7 +3203,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function EmitResetMachining() function EmitResetMachining()
if EMT.PLANEACTIVE then if EMT.PLANEACTIVE and not EMT.ISPROBING then
-- se non sono a Z massima e operatore deve entrare in cabina spango sempre -- 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 if not EMT.ZMAX and ( GetSpecUnloading( EMT.PATHID) or GetFall( EMT.PATHID)) then
EmtOutput( 'M05') EmtOutput( 'M05')
@@ -3216,67 +3380,80 @@ function PreselectNextDiffHead( nMchId, sHead)
-- gruppo della testa -- gruppo della testa
local nHSet = GetHeadSet( sHead) local nHSet = GetHeadSet( sHead)
local bVerifyPresel = true
-- se lavorazione con testa 1 e sotto al limite massimo di preselezione della testa 2, allora non si fa preselezione
if nHSet == 1 and Limit_T1_Presel_T2 and EMT.MAXMIN[2] < Limit_T1_Presel_T2 then
bVerifyPresel = false
-- se lavorazione con testa 1 e sopra al limite minimo di preselezione della testa 1, allora non si fa preselezione
elseif nHSet == 2 and Limit_T2_Presel_T1 and EMT.MAXMIN[2] > Limit_T2_Presel_T1 then
bVerifyPresel = false
end
-- flag preselezione eseguita -- flag preselezione eseguita
local bPresel = false local bPresel = false
-- recupero lavorazione successiva
local nNextMchId = EgtGetNextActiveOperation( nMchId) if bVerifyPresel then
while nNextMchId do -- recupero lavorazione successiva
if EgtGetOperationType( nNextMchId) ~= MCH_OY.DISP then local nNextMchId = EgtGetNextActiveOperation( nMchId)
if EgtSetCurrMachining( nNextMchId) then while nNextMchId do
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL) if EgtGetOperationType( nNextMchId) ~= MCH_OY.DISP then
if EgtTdbSetCurrTool( sNextTool) then if EgtSetCurrMachining( nNextMchId) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
local nNextHSet = GetHeadSet( sNextHead) if EgtTdbSetCurrTool( sNextTool) then
if nNextHSet ~= nHSet then local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
break local nNextHSet = GetHeadSet( sNextHead)
if nNextHSet ~= nHSet then
break
end
end
end
end
nNextMchId = EgtGetNextActiveOperation( nNextMchId)
end
-- se esiste ed appartiene a gruppo diverso
if nNextMchId and EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
if nNextHSet ~= nHSet then
local sNextTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
-- se testa attuale da caricare è sega a catena, mando l'altra prima in HomeX (per evitare possibili collisioni) e poi lancio preselezione
if sHead == 'H13' and nHSet ~= GetHeadSet( EMT.PREVHEAD_H1) then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H2)})
EmitMoveStartHead( 2)
EmitMoveWaitHead( 2)
elseif sHead == 'H23' and nHSet ~= GetHeadSet( EMT.PREVHEAD_H2) then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H1)})
EmitMoveStartHead( 1)
EmitMoveWaitHead( 1)
end
-- Emetto preselezione (non ammessa per sega a catena H13 e H23 e aggregato BlockHaus H17)
if sNextHead == 'H11' then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 1)
bPresel = true
elseif sNextHead == 'H12' then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 1)
bPresel = true
elseif sNextHead == 'H21' then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 2)
bPresel = true
elseif sNextHead == 'H22' then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 2)
bPresel = true
end end
end end
end end
end end
nNextMchId = EgtGetNextActiveOperation( nNextMchId) -- ripristino stato corrente
EgtSetCurrMachining( EMT.MCHID)
EgtTdbSetCurrTool( EMT.TOOL)
end end
-- se esiste ed appartiene a gruppo diverso
if nNextMchId and EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
if nNextHSet ~= nHSet then
local sNextTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
-- se testa attuale da caricare è sega a catena, mando l'altra prima in HomeX (per evitare possibili collisioni) e poi lancio preselezione
if sHead == 'H13' and nHSet ~= GetHeadSet( EMT.PREVHEAD_H1) then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H2)})
EmitMoveStartHead( 2)
EmitMoveWaitHead( 2)
elseif sHead == 'H23' and nHSet ~= GetHeadSet( EMT.PREVHEAD_H2) then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H1)})
EmitMoveStartHead( 1)
EmitMoveWaitHead( 1)
end
-- Emetto preselezione (non ammessa per sega a catena H13 e H23 e aggregato BlockHaus H17)
if sNextHead == 'H11' then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 1)
bPresel = true
elseif sNextHead == 'H12' then
EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 1)
bPresel = true
elseif sNextHead == 'H21' then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 2)
bPresel = true
elseif sNextHead == 'H22' then
EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos)})
EmitMoveStartHead( 2)
bPresel = true
end
end
end
end
-- ripristino stato corrente
EgtSetCurrMachining( EMT.MCHID)
EgtTdbSetCurrTool( EMT.TOOL)
-- se non eseguita preselezione -- se non eseguita preselezione
if not bPresel then if not bPresel then
-- mi assicuro che l'altra testa sia in parcheggio -- mi assicuro che l'altra testa sia in parcheggio
+183 -20
View File
@@ -96,6 +96,10 @@ function OnSimulStart()
if DefTcPos2 then if DefTcPos2 then
LoadFirstTool( 2, DefTcPos2) LoadFirstTool( 2, DefTcPos2)
end end
-- se presenti, nascondo i tastatori
DeactivateProbeTool()
ExecStartHome() ExecStartHome()
-- Se reset o home, esco -- Se reset o home, esco
if EMT.SIM1ST then return end if EMT.SIM1ST then return end
@@ -130,7 +134,8 @@ function OnSimulStart()
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC1'}, { Grp = 'Base', Sub = 'COLLISION', Name = 'TC1'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC2'}, { Grp = 'Base', Sub = 'COLLISION', Name = 'TC2'},
{ Grp = 'Base', Sub = 'BELT', Name = 'COLLISION'}, { Grp = 'Base', Sub = 'BELT', Name = 'COLLISION'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM'}} { Grp = 'X1', Sub = 'COLLISION', Name = 'STM'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM2'}}
if EgtGetHeadId( 'H21') then if EgtGetHeadId( 'H21') then
table.insert( McdData, { Grp = 'X2', Sub = 'COLLISION', Name = 'STM'}) table.insert( McdData, { Grp = 'X2', Sub = 'COLLISION', Name = 'STM'})
@@ -513,9 +518,11 @@ function OnSimulToolSelect( dPosA)
EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM) EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
local nSetHead = GetHeadSet( EMT.HEAD) 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 -- se ho due teste, verifico che l'altra sia dalla parte opposta
if EgtGetHeadId( 'H21') then if EgtGetHeadId( 'H21') then
if nSetHead == 1 then if bIsFirstHead then
EgtSetAxisPos( 'X2', MinX2) EgtSetAxisPos( 'X2', MinX2)
else else
EgtSetAxisPos( 'X1', MaxX1) EgtSetAxisPos( 'X1', MaxX1)
@@ -551,6 +558,75 @@ function OnSimulToolSelect( dPosA)
-- Imposto visualizzazione -- Imposto visualizzazione
EgtSetMode( EgtGetHeadId( EMT.HEAD) or GDB_ID.NULL, GDB_MD.STD) EgtSetMode( EgtGetHeadId( EMT.HEAD) or GDB_ID.NULL, GDB_MD.STD)
end 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 -- carico utensile, con breve pausa
EgtPause( 100) EgtPause( 100)
EgtOutText( '') EgtOutText( '')
@@ -619,10 +695,57 @@ function OnSimulToolDeselect( dPrevA)
LoadNextTool( 2, DefTcPos2) LoadNextTool( 2, DefTcPos2)
end end
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 -- reset flag sega a catena già depositata
EMT.CHSAW_OUT = nil EMT.CHSAW_OUT = nil
-- se utensile non cambia e non è sega a catena, esco -- 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 if bSkipToolChange or ( ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and not HeadIsChainSaw( EMT.NEXTHEAD)) then return end
-- deposito utensile -- deposito utensile
EgtOutText( 'Tool change in progress...') 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 -- se prossimo utensile sega a catena, devo mettere in home testa 1 e depositare l'utensile sulla testa 2 o viceversa
@@ -631,7 +754,7 @@ function OnSimulToolDeselect( dPrevA)
-- se ci sono due teste -- se ci sono due teste
if EgtGetHeadId( 'H21') then if EgtGetHeadId( 'H21') then
local nSetHead = GetHeadSet( EMT.NEXTHEAD) local nSetHead = GetHeadSet( EMT.NEXTHEAD)
if nSetHead == 1 then if nSetHead == 1 or nSetHead == 11 then
-- porto in home testa 1 -- porto in home testa 1
SimulMoveAxis( 'X1', MaxX1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', MaxX1, MCH_SIM_STEP.RAPID)
-- deposito utensile fresa -- deposito utensile fresa
@@ -687,7 +810,7 @@ function OnSimulToolDeselect( dPrevA)
if nSetHead == 1 and EMT.PREVHEAD_H1 then if nSetHead == 1 and EMT.PREVHEAD_H1 then
local MyParkX1 = EgtIf( GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1', ParkX1, ParkFrnX1) local MyParkX1 = EgtIf( GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1', ParkX1, ParkFrnX1)
SimulMoveAxis( 'X1', MyParkX1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', MyParkX1, MCH_SIM_STEP.RAPID)
elseif EMT.PREVHEAD_H2 then elseif nSetHead == 2 and EMT.PREVHEAD_H2 then
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
end end
end end
@@ -718,7 +841,7 @@ function OnSimulToolDeselect( dPrevA)
SimulMoveAxis( 'Z2', ParkCSawZ2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z2', ParkCSawZ2, MCH_SIM_STEP.RAPID)
end end
-- per prossima testa gruppo 1 -- per prossima testa gruppo 1
else elseif nNextSetHead == 1 then
-- visualizzo utensile su TcPos -- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true) ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa -- nascondo l'utensile sulla testa
@@ -851,6 +974,7 @@ function OnSimulMachiningEnd()
EMT.DOU_TOOL = nil EMT.DOU_TOOL = nil
-- salvo dati utensile -- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD) local nSetHead = GetHeadSet( EMT.HEAD)
-- se non ho già tolto la sega a catena, aggiorno valori -- se non ho già tolto la sega a catena, aggiorno valori
if not EMT.CHSAW_OUT then if not EMT.CHSAW_OUT then
-- per gruppo testa 1 -- per gruppo testa 1
@@ -1657,16 +1781,50 @@ function ExecMoveZmax( bMchSplit, btoXHome)
-- set della testa -- set della testa
local nSetHead = GetHeadSet( EMT.HEAD) local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead == 0 then return end 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 -- posizioni correnti degli assi testa
local CurrX = EgtGetAxisPos( EgtIf( nSetHead == 1, 'X1', 'X2')) local CurrX = EgtGetAxisPos( EgtIf( bIsFirstHead, 'X1', 'X2'))
local CurrZ = EgtGetAxisPos( EgtIf( nSetHead == 1, 'Z1', 'Z2')) local CurrZ = EgtGetAxisPos( EgtIf( bIsFirstHead, 'Z1', 'Z2'))
local CurrC = EgtGetAxisPos( EgtIf( nSetHead == 1, 'C1', 'C2')) local CurrC = EgtGetAxisPos( EgtIf( bIsFirstHead, 'C1', 'C2'))
local CurrB = EgtGetAxisPos( EgtIf( nSetHead == 1, 'B1', 'B2')) local CurrB = EgtGetAxisPos( EgtIf( bIsFirstHead, 'B1', 'B2'))
-- posizioni home degli assi testa -- posizioni home degli assi testa
local HomeX = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'X1', 'X2')) local HomeX = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'X1', 'X2'))
local HomeZ = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'Z1', 'Z2')) local HomeZ = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'Z1', 'Z2'))
local HomeC = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'C1', 'C2')) local HomeC = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'C1', 'C2'))
local HomeB = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'B1', 'B2')) local HomeB = EgtGetAxisHomePos( EgtIf( bIsFirstHead, 'B1', 'B2'))
-- verifico se necessario ruotare la testa -- verifico se necessario ruotare la testa
local bRot = ( abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1) local bRot = ( abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1)
-- se necessario ruotare la testa, allargo i carrelli -- se necessario ruotare la testa, allargo i carrelli
@@ -1677,7 +1835,7 @@ function ExecMoveZmax( bMchSplit, btoXHome)
ExecParkRoller( nil, nil, nil, nil, bMchSplit, bAgg) ExecParkRoller( nil, nil, nil, nil, bMchSplit, bAgg)
end end
-- se testa 1 -- se testa 1
if nSetHead == 1 then if bIsFirstHead then
-- se fresa o lama -- se fresa o lama
if GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1' then if GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1' then
if not HeadIsChainSaw( EMT.HEAD) then if not HeadIsChainSaw( EMT.HEAD) then
@@ -1764,9 +1922,6 @@ function ExecMoveZmax( bMchSplit, btoXHome)
ShowToolInTcPos( EMT.TCPOS, true) ShowToolInTcPos( EMT.TCPOS, true)
-- nascondo l'utensile sulla testa -- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.HEAD or '') or GDB_ID.NULL, GDB_MD.HIDDEN) EgtSetMode( EgtGetHeadId( EMT.HEAD or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
EMT.PREVTOOL_H1 = nil
EMT.PREVHEAD_H1 = nil
EMT.PREVTCPOS_H1 = nil
EMT.CHSAW_OUT = true EMT.CHSAW_OUT = true
EMT.XHOME = true EMT.XHOME = true
end end
@@ -2520,6 +2675,14 @@ function LoadNextTool( nHSet, sTcPosDef, bFirst)
return sTool return sTool
end 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 *** -- *** ESTIMATION T&L ***
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -2944,7 +3107,7 @@ function GetHeadSetFromTcPos( sTcPos)
local TCPOS_2A = {} local TCPOS_2A = {}
local TCPOS_2B = {} local TCPOS_2B = {}
if EgtGetHeadId( 'H21') then if EgtGetHeadId( 'H21') then
TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'} TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', '501'}
TCPOS_1B = { 'T101'} TCPOS_1B = { 'T101'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'} TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
TCPOS_2B = { 'T111'} TCPOS_2B = { 'T111'}
@@ -2952,7 +3115,7 @@ function GetHeadSetFromTcPos( sTcPos)
TCPOS_1A = { 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'} TCPOS_1A = { 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10'}
TCPOS_1B = { 'T101', 'T201'} TCPOS_1B = { 'T101', 'T201'}
TCPOS_1C = { 'T301'} TCPOS_1C = { 'T301'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'} TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20', '502'}
end end
for _, sVal in ipairs( TCPOS_1A) do for _, sVal in ipairs( TCPOS_1A) do
if sVal == sTcPos then return 1, 1 end if sVal == sTcPos then return 1, 1 end
+67 -3
View File
@@ -4,6 +4,12 @@
require( 'EmtGenerator') require( 'EmtGenerator')
EgtEnableDebug( false) EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- Carico libreria -- Carico libreria
local BD = require( 'BeamData') local BD = require( 'BeamData')
@@ -267,6 +273,13 @@ function OnSpecialMoveZup()
EMC.MODIF = true EMC.MODIF = true
end end
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
end end
@@ -737,8 +750,48 @@ function OnSpecialApplyMachining()
-- Inizializzo codice di errore -- Inizializzo codice di errore
EMC.ERR = 0 EMC.ERR = 0
-- Recupero la posizione della trave e dei carrelli al termine della precedente operazione -- Recupero la precedente operazione
local nPrevOpeId = EgtGetPrevActiveOperation( EMC.MCHID) 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 -- se precedente operazione non esiste, errore
if not nPrevOpeId then if not nPrevOpeId then
EMC.ERR = 1 EMC.ERR = 1
@@ -896,7 +949,6 @@ function OnSpecialApplyMachining()
local vAxes = EmtGetAxesPos( nLastEntId) local vAxes = EmtGetAxesPos( nLastEntId)
if #vAxes > 0 then EMC.TPOS = vAxes[1] end if #vAxes > 0 then EMC.TPOS = vAxes[1] end
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -1174,6 +1226,17 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
end end
-- Recupero testa -- Recupero testa
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) 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 -- Recupero valore assi macchina
local nSecId = EgtGetNext( EgtGetFirstInGroup( nPathId)) local nSecId = EgtGetNext( EgtGetFirstInGroup( nPathId))
local vAxes = EmtGetAxesPos( nSecId) local vAxes = EmtGetAxesPos( nSecId)
@@ -1185,7 +1248,7 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
-- Calcolo dell'ingombro della testa rispetto allo Zero Macchina -- Calcolo dell'ingombro della testa rispetto allo Zero Macchina
local b3Enc local b3Enc
if sHead ~= 'H21' and sHead ~= 'H22' and sHead ~= 'H23' then if bIsFirstHead then
EgtSetAxisPos( 'C1', vAxes[4]) EgtSetAxisPos( 'C1', vAxes[4])
EgtSetAxisPos( 'B1', vAxes[5]) EgtSetAxisPos( 'B1', vAxes[5])
if sHead == 'H13' or sHead == 'H15' then if sHead == 'H13' or sHead == 'H15' then
@@ -1219,6 +1282,7 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
local dDistFront = - ptMax:getX() - LoadT - dHeadFront local dDistFront = - ptMax:getX() - LoadT - dHeadFront
local dDistBack = ptMin:getX() + LoadT + EMC.LB - dHeadBack local dDistBack = ptMin:getX() + LoadT + EMC.LB - dHeadBack
EgtOutLog( ' DistFront = ' .. EgtNumToString( dDistFront, 1) .. ' DistBack = ' .. EgtNumToString( dDistBack, 1), 3) EgtOutLog( ' DistFront = ' .. EgtNumToString( dDistFront, 1) .. ' DistBack = ' .. EgtNumToString( dDistBack, 1), 3)
return dDistFront, dDistBack, dRollFront, dRollBack return dDistFront, dDistBack, dRollFront, dRollBack
end end
+17 -4
View File
@@ -32,8 +32,8 @@
require( 'EmtGenerator') require( 'EmtGenerator')
EgtEnableDebug( false) EgtEnableDebug( false)
PP_VER = '3.1c2' PP_VER = '3.1f3'
PP_NVER = '3.1.3.2' PP_NVER = '3.1.6.3'
MIN_MACH_VER = '2.5k1' MIN_MACH_VER = '2.5k1'
MACH_NAME = EgtGetCurrMachineName() MACH_NAME = EgtGetCurrMachineName()
@@ -163,7 +163,8 @@ if EgtExistsFile( sData) then
end end
if Machine.Offsets.X1_POS then MinX1 = -Machine.Offsets.X1_POS end if Machine.Offsets.X1_POS then MinX1 = -Machine.Offsets.X1_POS end
if Machine.Offsets.X1_NEG then MaxX1 = -Machine.Offsets.X1_NEG end if Machine.Offsets.X1_NEG then MaxX1 = -Machine.Offsets.X1_NEG end
if Machine.Offsets.PARK_X1 then ParkX1 = -Machine.Offsets.PARK_X1 end if Machine.Offsets.PARK_X1POS then ParkFrnX1 = -Machine.Offsets.PARK_X1POS end
if Machine.Offsets.PARK_X1NEG then ParkX1 = -Machine.Offsets.PARK_X1NEG end
if Machine.Offsets.Z1_NEG then MinZ1 = Machine.Offsets.Z1_NEG end if Machine.Offsets.Z1_NEG then MinZ1 = Machine.Offsets.Z1_NEG end
if Machine.Offsets.Z1_POS then MaxZ1 = min( MaxZ1, Machine.Offsets.Z1_POS) end if Machine.Offsets.Z1_POS then MaxZ1 = min( MaxZ1, Machine.Offsets.Z1_POS) end
if Machine.Offsets.PARK_Z1 then ParkZ1 = Machine.Offsets.PARK_Z1 end if Machine.Offsets.PARK_Z1 then ParkZ1 = Machine.Offsets.PARK_Z1 end
@@ -227,6 +228,7 @@ if EgtExistsFile( sData) then
ParkV2 = MinV2 ParkV2 = MinV2
ParkY2 = ParkV2 - MinDeltaYV ParkY2 = ParkV2 - MinDeltaYV
ParkX1 = min( ParkX1, MaxX1) ParkX1 = min( ParkX1, MaxX1)
ParkFrnX1 = max( ParkFrnX1, MinX1)
ParkCSawZ1 = min( ParkCSawZ1, MaxZ1) ParkCSawZ1 = min( ParkCSawZ1, MaxZ1)
ParkCSaw0Z1 = min( ParkCSaw0Z1, MaxZ1) ParkCSaw0Z1 = min( ParkCSaw0Z1, MaxZ1)
Mortiser = ( Mortiser and not Progress) Mortiser = ( Mortiser and not Progress)
@@ -852,10 +854,14 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-------------------------- Testa utilizzata ------------------------- -------------------------- Testa utilizzata -------------------------
function GetHeadSet( sHead) function GetHeadSet( sHead)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' then if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' or sHead == 'H17' then
return 1 return 1
elseif sHead == 'H19' then
return 11
elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then
return 2 return 2
elseif sHead == 'H29' then
return 21
else else
return 0 return 0
end end
@@ -884,6 +890,7 @@ function GetHeadTCSet( sHead, sTcPos)
return 0 return 0
end end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Funzione che restituisce l'altezza del pezzo in lavorazione -- Funzione che restituisce l'altezza del pezzo in lavorazione
function GetRawHeight() function GetRawHeight()
@@ -903,6 +910,12 @@ function HeadIsChainSaw( sHead)
return ( sHead == 'H13' or sHead == 'H15') return ( sHead == 'H13' or sHead == 'H15')
end end
---------------------------------------------------------------------
-- Funzione che riconosce testa per tastatore
function HeadIsProbe( sHead)
return ( sHead == 'H19' or sHead == 'H29')
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale -- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale
function GetChainSawZHomeFromVirtualAxis( dPosA) function GetChainSawZHomeFromVirtualAxis( dPosA)
+9 -1
View File
@@ -1,10 +1,18 @@
==== Common_ONE-PF Update Log ==== ==== Common_ONE-PF Update Log ====
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
Versione 3.1f1 (03/06/2026)
- (NGE-MLDE-GEN-SIM) Versione unificata con predisposizione per gestione tastatori. Serve modificare anche la macchina, per ora gestione completa solo su PFrl.
Versione 3.1c2 (17/03/2026) Versione 3.1c2 (17/03/2026)
- (SIM-GEN) Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito - (SIM-GEN) Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito
- Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente. ATT: MIN_MACH -> 3.1b2 - Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente. ATT: MIN_MACH -> 3.1b2
Versione 3.1c1 (04/03/2026) Versione 3.1c1 (04/03/2026)
- (GEN) Corretta chiamata di una variabile insesistente in caso di ONE - (GEN) Corretta chiamata di una variabile insesistente in caso di ONE
- (SIM) Allineata simulazione a generazione - (SIM) Allineata simulazione a generazione
+1 -1
View File
@@ -3,7 +3,7 @@
local InfoCommon_STD_PP = { local InfoCommon_STD_PP = {
NAME = 'Common_ONE-PF', -- nome script PP standard NAME = 'Common_ONE-PF', -- nome script PP standard
VERSION = '3.1c2', -- versione script VERSION = '3.1f3', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel
} }