Compare commits

...

70 Commits

Author SHA1 Message Date
andrea.villa 1ee22cf974 - Merge branch 'master' into ProbingWithTool
- Prima versione installata in macchina da cliente
2026-04-23 10:55:41 +02:00
andrea.villa 87d240b49f Merge remote-tracking branch 'origin/develop' 2026-03-17 15:22:53 +01:00
andrea.villa 14b225a4b0 Allineamento a common ver. 3.1c2 2026-03-17 15:22:40 +01:00
daniele.nicoli d7aa89fad5 Aggiunto info "PreviewShow" per anteprima utensile/testa nel MACH 2026-03-09 09:16:54 +01:00
daniele.nicoli 11459ac20b Aggiunto info "PreviewShow" per anteprima utensile/testa nel MACH 2026-03-09 08:45:06 +01:00
daniele.nicoli ecfae285f3 Aggiunti parametri letti da TS3Data.lua: MIN_JOIN_S, MIN_JOIN_L e MAX_ANGLE_DRILL_CUT 2026-03-05 14:58:47 +01:00
daniele.nicoli db78493a2a Merge remote-tracking branch 'origin/master' into develop 2026-03-05 14:55:54 +01:00
andrea.villa 88d53d6195 Merge remote-tracking branch 'origin/develop' 2026-02-20 09:16:45 +01:00
andrea.villa 81ee9426c1 Allineamento con common ver. 3.1b1 2026-02-20 09:16:32 +01:00
daniele.nicoli c578b2c03d Aggiunta la lettura da TS3Data.lua delle corse dell'asse W (MIN_W e MAX_W) 2026-02-03 11:10:19 +01:00
daniele.nicoli 8ccbe8263e Merge branch 'master' into develop 2026-02-03 11:09:54 +01:00
andrea.villa 1f9a271e7b Allineamento con common ver. 3.1a1 2026-01-16 15:49:36 +01:00
andrea.villa 72cf8717b2 Merge branch 'develop' 2025-12-18 16:17:03 +01:00
andrea.villa af58e92003 - Allineamento a common ver. 2.7l1
- Aggiunto parametro MAX_ANGLE_DRILL_CUT a BeamData
- Recupero nome macchina da funzione EGT
2025-12-18 16:16:47 +01:00
daniele.nicoli 232d5a36c7 Aggiornati mlde e nge in attesa di aggiornamento Common per Controllo Pinzaggio VMILL 2025-12-15 11:39:19 +01:00
daniele.nicoli 957942b623 Merge branch 'master' into develop 2025-12-15 10:57:37 +01:00
andrea.villa 5970cd61c1 Corretto disegno porta utensile 2025-12-11 09:29:16 +01:00
andrea.villa e6a6169f45 - Nuovo ToolHolder
- Allineamento con common ver. 2.7k3
2025-11-28 15:45:30 +01:00
andrea.villa 860e1fc5c1 Merge branch 'develop' 2025-11-20 17:01:24 +01:00
andrea.villa b4b11607e4 - Allineamento a common ver. 2.7k2
- Cambio versione per rilascio a cliente
2025-11-20 17:01:15 +01:00
daniele.nicoli eef2c16193 Aggiunta gestione CUT_SIC impostabile da TS3Data.lua 2025-11-13 12:39:22 +01:00
daniele.nicoli ce72052463 Merge branch 'master' into develop 2025-11-13 12:38:46 +01:00
andrea.villa f9b4eab0c9 Allineamento con common ver. 2.7k1 2025-11-05 13:27:09 +01:00
andrea.villa 7b4293688d Allineamento con common ver. 2.7j3 2025-10-23 07:54:10 +02:00
andrea.villa a2c3e80b5b Merge remote-tracking branch 'origin/master' into ProbingWithTool 2025-10-21 10:52:35 +02:00
andrea.villa 09baa44e02 #critical# Allineamento con common ver. 2.7j2 2025-10-21 10:51:45 +02:00
andrea.villa a280c0ea3d Merge branch 'master' into ProbingWithTool 2025-10-08 13:18:56 +02:00
andrea.villa 0dea456d13 Allineamento con common ver. 2.7j1 2025-10-08 13:17:42 +02:00
andrea.villa 9f3fbfe597 Merge branch 'master' into ProbingWithTool 2025-09-10 12:13:38 +02:00
andrea.villa 24d88cde41 Allineamento con common ver. 2.7i1, HOTFIX 2025-09-10 12:13:11 +02:00
andrea.villa eeb9a93132 Aggiornato NGE con Aggregato BH 2025-09-10 11:21:07 +02:00
andrea.villa 76c52eecce Merge branch 'master' into ProbingWithTool 2025-09-10 11:13:07 +02:00
andrea.villa e5ee956c8e Merge remote-tracking branch 'origin/develop' 2025-09-10 10:40:42 +02:00
andrea.villa 5e1c975ef7 - Allineamento common ver. 2.7i1
- Aggiunto solido collisione per tappeto
2025-09-10 10:40:28 +02:00
andrea.villa 842c491713 Merge branch 'NewAggregateBH' into develop 2025-09-10 10:38:33 +02:00
andrea.villa 09aacf8327 - Prima versione funzionante gestione motosega da sotto diretta verso l'alto
- Aggiunto solido collisione a NGE
2025-08-29 15:58:05 +02:00
andrea.villa 9c7e546e47 Merge branch 'develop' into ProbingWithTool 2025-08-28 15:26:00 +02:00
andrea.villa 321a91ae5e Merge remote-tracking branch 'origin/master' into ProbingWithTool 2025-07-23 12:29:53 +02:00
andrea.villa 449f03fb09 - IsToolCompatibleWithProbe spostata in MLDE
- in OnPostApplyMachining si salta risalita se tastatura e utensile già precaricato. NB: serve CAM5 2.7f3
2025-06-30 16:02:09 +02:00
andrea.villa 7c91df35fc - Spostate funzioni da MLPE a MLDE perchè servono anche a MLSE
- In MLSE su lavorazione tastatura, si seleziona utensile di default sul mandrino per calcoli ingombri per paratie
2025-06-27 16:38:57 +02:00
andrea.villa 0d99310258 Cambiati limiti feed massima pinze 2025-06-25 09:58:27 +02:00
andrea.villa 0b49335c8e Corretto calcolo accelerazioni massima/minima 2025-06-25 08:39:01 +02:00
andrea.villa 0d87a703ce Corretto nome file 2025-06-23 17:58:31 +02:00
andrea.villa 475b0a7ebf - Se si mantiene utensile vecchio, allora si ribadiscono i dati vecchi
- Aggiunta lista lavorazioni probing
2025-06-23 15:06:38 +02:00
andrea.villa c54ddd02e9 Disattivazione tastatura spostata prima della risalita a Z massima 2025-06-20 11:39:26 +02:00
andrea.villa fd9314ea5a Aggiunto aggregato BIG per motosega 2025-06-20 10:27:07 +02:00
andrea.villa d075af1a91 Corretta lettura posizione home testa 1 2025-06-18 18:20:59 +02:00
andrea.villa f229fae4d3 Corretto segni movimento pre e post tastatura 2025-06-18 16:58:20 +02:00
andrea.villa 5219330a4d Cambio versione per rilascio a Essetre 2025-06-18 15:26:14 +02:00
andrea.villa fd85570cfd Corretta disattivazione tastatura 2025-06-18 15:21:59 +02:00
andrea.villa 2adb157b28 - Corretto ingombro lavorazione in caso di tastatura
- Migliorie generazione
2025-06-17 18:20:13 +02:00
andrea.villa 5e6121703c - Se tastatura orizzontale, ci si alza sopra pezzo in sicurezza
- Prima versione scrittura macro tastatura
2025-06-17 12:14:34 +02:00
andrea.villa 5316abecf4 In generazione, si seleziona utensile compatibile per tastatura 2025-06-17 10:34:02 +02:00
andrea.villa f958dc8a0a Simulazione con movimenti corretti. 2025-06-16 10:45:48 +02:00
andrea.villa 4989ae5d99 Prima versione funzionante in simulazione 2025-06-13 16:50:55 +02:00
andrea.villa 9ac0aafea0 Aggiunta lavorazione e primi test 2025-06-11 17:30:59 +02:00
andrea.villa 1c047b1890 Aggiunto testa in TC e varie info 2025-06-11 12:37:59 +02:00
andrea.villa 7eea1439c4 Prima versione gestione Probe con utensile dedicato 2025-06-11 11:00:25 +02:00
andrea.villa 7b35cccaf5 Corretto indice faccia e legato al tipo di macchina, carico desto o sinistro. 2025-06-11 10:02:37 +02:00
andrea.villa da6d0bed2a Movimento tastatura aumentato a 20mm. Poi bisognerà metterlo a configurazione 2025-06-11 09:29:08 +02:00
andrea.villa 75ff61f3dc Cambio versione 2025-06-10 10:01:47 +02:00
andrea.villa dba8997045 Quando fa tastatura, si scrivono comandi di start del movimento 2025-06-10 10:01:06 +02:00
andrea.villa 263758a422 Dopo tastatura ci si sposta nel punto delle lavorazione o in Z sopra al pezzo 2025-06-06 12:36:14 +02:00
andrea.villa 1e6bc44019 Tastatore portato a 170 2025-06-06 10:25:09 +02:00
andrea.villa 0909656a6c Azzeramento tastatura con EF0 2025-06-06 10:23:08 +02:00
andrea.villa 23e17d9623 Prima della macro tastatura, si manda la testa nel punto dal quale azionare il tastatore. Per il momento si tasta sempre al centro della trave in altezza se facce verticali, o al centro in larghezza se faccia sopra. La posizione della trave invece è quella di lavorazione. 2025-06-06 09:17:32 +02:00
andrea.villa 7ba04b6e17 - Migliorata gestione presenza Probe
- Probe settato false per default
2025-06-04 15:55:16 +02:00
andrea.villa 67401b8799 Piccola correzione calcolo accelerazioni 2025-06-04 15:46:54 +02:00
andrea.villa 8b9a77cdaf - Allineamento con common ver. 2.7f1
- Gestione parametri accelerazioni pinze
2025-06-04 15:43:07 +02:00
andrea.villa 9662b22f03 Proma versione gestione PROBE 2025-06-04 11:48:35 +02:00
17 changed files with 1335 additions and 250 deletions
+5
View File
@@ -42,6 +42,7 @@ local BeamData = {
DRILL_TOL = 0.2, -- tolleranza tra diametro foro e diametro punta
DRILL_VZ_MIN = - 0.51, -- componente limite in Z del versore di un foro
DRILL_VX_MAX = 0.867, -- componente limite in X del versore di un foro sulle facce laterali
MAX_ANGLE_DRILL_CUT = 15, -- delta angolo massimo tra foro e taglio che lo attraversa
DRILL_OVERLAP = 5, -- sovrapposizione tra due mezze forature
MILL_OVERLAP = 5, -- sovrapposizione tra due mezze fresature
MAX_DIST_HTFEA = 50.0, -- massima distanza di feature da testa o coda per essere considerata tale
@@ -117,7 +118,11 @@ if EgtExistsFile( sData) then
BeamData.LEN_VERY_SHORT_PART = Machine.Offsets.LEN_VERY_SHORT_PART or BeamData.LEN_VERY_SHORT_PART
BeamData.LEN_SHORT_PART = Machine.Offsets.LEN_SHORT_PART or BeamData.LEN_SHORT_PART
BeamData.OVM_MID = Machine.Offsets.OVM_MID or BeamData.OVM_MID
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
end
if Machine.Trave then
BeamData.MIN_WIDTH = Machine.Trave.XMIN or BeamData.MIN_WIDTH
+4
View File
@@ -37,6 +37,7 @@
23=SmallToolContour
24=AntiSplintMillCut
25=Prof_end
26=SideMillAsBlade
[Pocketing]
1=Pocket
@@ -48,3 +49,6 @@
[Sawing]
1=Sawing
[Probing]
1=DTMortise
+11
View File
@@ -0,0 +1,11 @@
-- 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
+479 -196
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, 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.MINACC = MinAcc or ( EMT.FMAXPINZE / ( 60 * 4)) -- accelerazione minima pinze
@@ -314,6 +314,8 @@ function OnDispositionEnd()
else
if #EMT.MDCHAR > 0 then
MyOutputNoNum( '(PART UNLOAD)')
-- movimento intermedio di apertura pinza-rulli per evitare di trovare delle collisioni
EmitParkRoller( EMT.TPOS, false, false)
for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i])
if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end
@@ -419,6 +421,7 @@ 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
@@ -452,6 +455,7 @@ 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
@@ -680,7 +684,7 @@ function OnPathStart()
if EMT.TOOL == EMT.PREVTOOL and not EMT.ZMAX then
EMT.L1pp = EMT.L1op
EMT.L2pp = EMT.L2op
EMT.L3pp = EMT.L3op
EMT.L3pp = EMT.L3op or EMT.L3pp
EMT.R1pp = EMT.R1p or EMT.R1pp
EMT.R2pp = EMT.R2p or EMT.R2pp
else
@@ -819,8 +823,8 @@ function OnRapid()
EMT.IPLGL = false
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
local PrevR2 = EMT.R2p or EMT.R2pp or HomeR2
EmtResetPrev()
@@ -830,6 +834,101 @@ 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
@@ -909,7 +1008,16 @@ function OnRapid()
if EMT.HEAD == 'H12' and abs( PrevR1 - EMT.R1) > 1 and ( abs( HomeC1 - EMT.R1) > 30.1 or abs( HomeB1 - EMT.R2) > 30.1) then
EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 1, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
end
@@ -970,7 +1078,7 @@ function OnRapid()
local dTRad, dTLen = GetToolRadLen()
-- se fresa o lama
if not HeadIsChainSaw( EMT.HEAD) then
EmitMoveDataHead( 1, { X=-ParkX2, Z=MyMaxZ1, B=HomeB1, C=HomeC1, TRad=dTRad, TLen=dTLen, S=Speed})
EmitMoveDataHead( 1, { X=-ParkFrnX1, Z=MyMaxZ1, B=HomeB1, C=HomeC1, TRad=dTRad, TLen=dTLen, S=Speed})
EmitMoveStartHead( 1)
EmitMoveWaitHead( 1)
EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3))
@@ -993,7 +1101,15 @@ function OnRapid()
if EMT.HEAD == 'H12' and abs( PrevR1 - EMT.R1) > 1 and ( abs( HomeC1 - EMT.R1) > 30.1 or abs( HomeB1 - EMT.R2) > 30.1) then
EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 1, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
end
@@ -1063,7 +1179,15 @@ function OnRapid()
if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { B=0, S=Speed})
EmitMoveDataHead( 2, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 2, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 2, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 2, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 2, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 2, { Z=EMT.L3, S=Speed})
end
@@ -1149,7 +1273,7 @@ function OnRapid()
else
--EmtOutput( string.format( 'V1Pos=%.3f V2Pos=%.3f', EMT.V1POS, EMT.V2POS))
local bToPresel = true
if not EMT.RELOAD and not EMT.ZMAX and #EMT.AUXCMD > 0 and EMT.TO_ZMAX then
if not EMT.ZMAX and #EMT.AUXCMD > 0 and EMT.TO_ZMAX then
-- allontanamento o eventuale preselezione successiva testa differente
if not EMT.DOU_TYPE then
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
@@ -1162,8 +1286,8 @@ function OnRapid()
EMT.TO_XHOME = nil
EMT.L1pp = nil
EMT.L3pp = nil
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'C1', 'C2'))
PrevR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1 or nHSet == 11, 'B1', 'B2'))
end
-- calcolo Movimento Pinze (potrebbe richiedere movimento testa in Home)
for i = 1, #EMT.AUXCMD do
@@ -1178,7 +1302,7 @@ function OnRapid()
local nPrevHSet = GetHeadSet( EMT.PREVHEAD)
-- vado in parcheggio sempre con utensile precedente
if not HeadIsChainSaw( EMT.PREVHEAD) then
if nPrevHSet == 1 then
if nPrevHSet == 1 or nPrevHSet == 11 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')
@@ -1283,7 +1407,15 @@ function OnRapid()
if EMT.HEAD == 'H12' and abs( PrevR1 - EMT.R1) > 1 and ( abs( HomeC1 - EMT.R1) > 30.1 or abs( HomeB1 - EMT.R2) > 30.1) then
EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 1, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
end
@@ -1372,7 +1504,15 @@ function OnRapid()
if EMT.HEAD == 'H12' and abs( PrevR1 - EMT.R1) > 1 and ( abs( HomeC1 - EMT.R1) > 30.1 or abs( HomeB1 - EMT.R2) > 30.1) then
EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 1, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
end
@@ -1437,7 +1577,15 @@ function OnRapid()
if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { B=0, S=Speed})
EmitMoveDataHead( 2, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 2, { Z=dZref, B=EMT.R2, S=Speed})
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
EmitMoveDataHead( 2, { Z=dZref, B=dBref, S=Speed})
EmitMoveDataHead( 2, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 2, { Z=dZref, B=EMT.R2, S=Speed})
end
if bMoveZbeforeX then
EmitMoveDataHead( 2, { Z=EMT.L3, S=Speed})
end
@@ -1529,81 +1677,89 @@ function OnRapid()
EMT.ZMAX = false
-- se standard
elseif EMT.FLAG == 0 or EMT.FLAG == 1 or EMT.FLAG == 2 then
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, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
-- forzo successiva emissione assi rotanti
EMT.R1p = nil
EMT.R2p = nil
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
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
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
-- 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)
-- 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
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
-- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then
@@ -1618,11 +1774,15 @@ 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
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
-- aggiorno quota finale trave dopo Zmax
EMT.L1o = EMT.TPOS
EMT.ZMAX = true
if bZMax then
EMT.ZMAX = true
ToolPreSelectionSingleHead( EMT.MCHID)
end
-- se altrimenti movimento in Home
elseif EMT.FLAG == 4 then
-- non previsto
@@ -1637,86 +1797,111 @@ end
---------------------------------------------------------------------
function OnLinear()
-- 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
-- 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
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())
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))
-- 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
EmtOutput( "G157 EE1")
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
EmtUpdatePrev()
-- 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
end
---------------------------------------------------------------------
@@ -1743,8 +1928,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, ' EU1', ' EU2')..sDouFlag..' EF'..GetFmaxClamp())
EMT.PLANEACTIVE = true
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')
@@ -1792,24 +1977,6 @@ function OnArc()
EmtUpdatePrev()
end
---------------------------------------------------------------------
function CalcDinamicaPinze( dH, dS, dL)
local KgMtCubo= WoodDensity or 550 -- densità legno [Kg / metro cubo]
local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg]
local FMaxPinze = EMT.FMAXPINZE -- Feed massima pinze [mm/min]
local ForzaAttrito = 350 * 9.8 * 0.2 -- Forza chiusura pinze [Kgf] * g * Coeff_Attrito -> [N]
local TempoAcc = ( ( Massa * FMaxPinze) / ( 60 * ForzaAttrito) / 1000)
local AccMaxPinze = EMT.MAXACC
local AccPinze = EgtClamp( FMaxPinze / ( 60 * TempoAcc), EMT.MINACC, EMT.MAXACC)
local RidFeed = 100 / Massa * 100
if RidFeed > 100 then
RidFeed = 100
elseif RidFeed < 10 then
RidFeed = 10
end
return AccPinze, AccMaxPinze, RidFeed
end
---------------------------------------------------------------------
function CalcCharStatusN( sCmd)
-- aperto
@@ -2288,7 +2455,7 @@ function PreparePreRotation( sCmd, nInd)
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=86, FinStatY1=87, BeamVise=0}
elseif EMT.SPECSPLIT or EMT.SPLITROT then
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), V1=ParkV1, IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV1=3, BeamVise=EMT.BV}
EMT.V1POS = MDChar.V1
EMT.V1NEXTPOS = MDChar.V1
else
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV}
end
@@ -2482,12 +2649,13 @@ end
---------------------------------------------------------------------
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
if not R1 or not PrevR1 or abs( R1 - PrevR1) > 0.1 then
return true
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
if not R2 or not PrevR2 or abs( R2 - PrevR2) > 0.1 then
return true
@@ -2503,12 +2671,12 @@ function MyAdjustLinearAxes()
if EMT.REFLOC then
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 Len = EMT.TLEN + dAddLen + MillOffs
local LenRef = MillOffs
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 Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs
@@ -2529,7 +2697,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' 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.L2 = EMT.L2 - DeltaTabY - vtE:getY()
EMT.L3 = EMT.L3 - DeltaTabZ - vtE:getZ()
@@ -2666,7 +2834,7 @@ function CalcInterpPlane()
local _, dAngV, dAngO = SphericalFromVector( vtE)
local dAngO2 = EmtGetAngO2( EMT.IPLGLFR:getVersZ(), EMT.IPLGLFR:getVersX(), dAngV, dAngO)
dAngO = dAngO + 90
while dAngO >= 360 do
while dAngO + 100 * GEO.EPS_SMALL > 360 do
dAngO = dAngO - 360
end
EMT.IPLGLSTR = ' EX0 EY'..EmtLenToString( xS)..' EZ0'..
@@ -2738,13 +2906,40 @@ 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 then
if nHSet == 1 or nHSet == 11 then
-- posizioni sicure
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1')
@@ -2838,6 +3033,24 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
-- ribadisco movimento perchè in G141 si aspetta sempre tutti i valori
local MovH = { X = -dXPos, Z = EMT.L3o, B = PrevR2, C = PrevR1}
EmitMoveDataHead( 1, MovH)
-- controlla che l'ingombro della sega a catena non possa collidere durante il suo riposizionamento
local dChSawEncumbrance = sqrt( pow( EMT.TTOTLEN, 2) + pow( ChSawLen + MillOffs, 2))
if EMT.ADIR and EMT.TDIR then
-- direzione versore sega a catena X- (copre anche eventuali inclinazioni in Y)
if EMT.TDIR[1] <= 0 then
-- ingombro massimo di quota Z (senza pivot) + ingombro massimo sega + altezza pezzo + altezza sicurezza
local dEncumbranceTot = EMT.L3o + MillOffs - dChSawEncumbrance - EMT.SB - 30
-- nuova quota Z intermedia
local dZUp = EMT.L3o + ( DeltaTabZ - dEncumbranceTot)
-- se la nuova quota è minore della quota di parcheggio
if dZUp <= ParkCSawZ1 then
-- se B è oltre il punto di massimo ingombro (con l'inclinazione attuale non ha il massimo ingombro)
if asin( EMT.TDIR[3] / 1) > asin( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) / dChSawEncumbrance) and ( dEncumbranceTot < DeltaTabZ) then
EmitMoveDataHead( 1, { Z=dZUp})
end
end
end
end
EmitMoveDataHead( 1, { Z=dSafeZ1, B=dSafeB1})
if EMT.R3 and abs( EMT.R3) < 0.1 then
EmitMoveDataHead( 1, { Z=ParkCSawZ1})
@@ -2895,6 +3108,24 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
-- ribadisco movimento perchè in G141 si aspetta sempre tutti i valori
local MovH = { X = -dXPos, Z = EMT.L3o, B = PrevR2, C = PrevR1}
EmitMoveDataHead( 2, MovH)
-- controlla che l'ingombro della sega a catena non possa collidere durante il suo riposizionamento
local dChSawEncumbrance = sqrt( pow( EMT.TTOTLEN, 2) + pow( ChSawLen + Mill2Offs, 2))
if EMT.ADIR and EMT.TDIR then
-- direzione versore sega a catena X- (copre anche eventuali inclinazioni in Y)
if EMT.TDIR[1] <= 0 then
-- ingombro massimo di quota Z (senza pivot) + ingombro massimo sega + altezza pezzo + altezza sicurezza
local dEncumbranceTot = EMT.L3o + Mill2Offs - dChSawEncumbrance - EMT.SB - 30
-- nuova quota Z intermedia
local dZUp = EMT.L3o + ( DeltaTabZ - dEncumbranceTot)
-- se la nuova quota è minore della quota di parcheggio
if dZUp <= ParkCSawZ2 then
-- se B è oltre il punto di massimo ingombro (con l'inclinazione attuale non ha il massimo ingombro)
if asin( EMT.TDIR[3] / 1) > asin( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) / dChSawEncumbrance) and ( dEncumbranceTot < DeltaTabZ) then
EmitMoveDataHead( 2, { Z=dZUp})
end
end
end
end
EmitMoveDataHead( 2, { Z=dSafeZ2, B=dSafeB2})
if EMT.R3 and abs( EMT.R3) < 0.1 then
EmitMoveDataHead( 2, { Z=ParkCSawZ2})
@@ -2908,6 +3139,7 @@ function EmitZmax( bReset, bEnd, bXhome, PrevR1, PrevR2, bSplitCut, bUsePrevDelt
EmitMoveWaitHead( 2)
end
end
return true
end
---------------------------------------------------------------------
@@ -2937,7 +3169,7 @@ function EmitXhome()
-- gruppo della testa
local nHSet = GetHeadSet( EMT.HEAD)
-- se testa 1
if nHSet == 1 then
if nHSet == 1 or nHSet == 11 then
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dSafeX1 = EgtGetAxisHomePos( 'X1')
local dSafeZ1 = EgtGetAxisHomePos( 'Z1')
@@ -2969,7 +3201,7 @@ end
---------------------------------------------------------------------
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
if not EMT.ZMAX and ( GetSpecUnloading( EMT.PATHID) or GetFall( EMT.PATHID)) then
EmtOutput( 'M05')
@@ -3086,6 +3318,57 @@ function EmitParkRoller( dPosT, bSplitCut, bUsePrevDelta)
EMT.TPOS = dPosT
end
---------------------------------------------------------------------
-- Se la lavorazione segue una disposizione ha un utensile diverso da quello attuale lo cambia durante la disposizione
function ToolPreSelectionSingleHead( nMchId)
-- Se non sono nell'ultima lavorazione della fase o se è una macchina a doppia testa ritorna senza fare nulla
local bIsPhaseEnd = ( EgtGetNextActiveOperation( nMchId) and EgtGetInfo( EgtGetNextActiveOperation( nMchId), 'TYPE') == 'END')
if not bIsPhaseEnd or EgtGetHeadId( 'H21') then
return
end
-- nome utensile
local sToolChange
local sToolChangePos
local sToolChangeHead
-- recupero lavorazione successiva e se contiene un utensile diverso salva utensile e posizione utensile
local nNextMchId = EgtGetNextActiveOperation( nMchId)
while nNextMchId do
if EgtGetOperationType( nNextMchId) ~= MCH_OY.DISP then
if EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
if EMT.TOOL ~= sNextTool then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if not HeadIsChainSaw( sNextHead) then
sToolChange = sNextTool
sToolChangePos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
sToolChangeHead = sNextHead
end
end
break
end
end
end
nNextMchId = EgtGetNextActiveOperation( nNextMchId)
end
-- ripristino stato corrente
EgtSetCurrMachining( EMT.MCHID)
EgtTdbSetCurrTool( EMT.TOOL)
-- controlla se l'operazione successiva e quella ancora dopo esistono e sono disposizioni
local bNextOpIsDisp = ( EgtGetNextActiveOperation( nMchId)
and ( EgtGetOperationType( EgtGetNextActiveOperation( nMchId)) == MCH_OY.DISP)
and ( EgtGetNextActiveOperation( EgtGetNextActiveOperation( nMchId)))
and ( EgtGetOperationType( EgtGetNextActiveOperation( EgtGetNextActiveOperation( nMchId))) == MCH_OY.DISP))
-- emetto preselezione utensile
if bIsPhaseEnd and bNextOpIsDisp then
if ( EMT.TOOL and sToolChangePos and sToolChange and sToolChangeHead) and EMT.TOOL ~= sToolChangePos and not HeadIsChainSaw( sToolChangeHead) then
local MyParkX1 = EgtIf( GetHeadTCSet( sToolChangeHead, sToolChangePos) == 'Head1_TC2', ParkFrnX1, ParkX1)
EmitMoveDataHead( 1, { X=-MyParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sToolChangePos)})
EmitMoveStartHead( 1)
end
end
end
---------------------------------------------------------------------
function PreselectNextDiffHead( nMchId, sHead)
-- se non ho due teste, esco subito
@@ -3211,7 +3494,7 @@ function EmitTestProgramStart()
EmtOutput( 'M12 $START PER SVINCOLO TESTE')
EmtOutput( '(SVINCOLO TESTA 1)')
EmitMoveDataHead( 1, {Z=ParkZ1-100, TPos=0})
if Progress then
if Progress or SecondToolChanger then
EmtOutput( 'IF E80001<=10 THEN')
EmitMoveDataHead( 1, {C=ParkC1, TPos=0})
EmitMoveDataHead( 1, {Z=-150, B=ParkB1, TPos=0})
+479 -33
View File
@@ -79,6 +79,14 @@ function OnSimulStart()
if vTools and vTools[1] and #(vTools[1]) > 0 then
EgtLoadTool( vTcPos[i], 1, vTools[1])
ShowToolInTcPos( vTcPos[i], true)
-- Aggiunto controllo lunghezza lama minima * 0.9 per ricavare la tolleranza del VMILL
if EgtTdbSetCurrTool(vTools[1]) then -- set utensile corrente
if EgtTdbGetCurrToolParam( MCH_TP.TYPE) == MCH_TY.SAW_STD or EgtTdbGetCurrToolParam( MCH_TP.TYPE) == MCH_TY.SAW_FLAT then -- controllo tipo utensile sega
local dCurrSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) * 0.9
-- se non definito o minore del valore precedente aggiorna la tolleranza
EMT.VMILLTOL = EgtIf( not EMT.VMILLTOL or dCurrSawLen < EMT.VMILLTOL, dCurrSawLen, EMT.VMILLTOL)
end
end
end
end
end
@@ -88,6 +96,10 @@ 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
@@ -122,14 +134,15 @@ 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 = 'STM'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM2'}}
if EgtGetHeadId( 'H21') then
table.insert( McdData, { Grp = 'X2', Sub = 'COLLISION', Name = 'STM'})
end
-- gruppo CHSAW si attiva solo se progress, one con BIT mortiser o PF
if Progress or Mortiser or EgtGetHeadId( 'H21') then
if Progress or Mortiser or EgtGetHeadId( 'H21') or SecondToolChanger then
table.insert( McdData, { Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW'})
end
-- gruppo MORTISER si attiva solo se PF con BIT mortiser attivo
@@ -239,7 +252,7 @@ function OnSimulDispositionStart()
-- determino la risoluzione dello Zmap
local dTol = 4.71
if EmtGetVMillStep then
dTol = EmtGetVMillStep( b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), 4.71)
dTol = EmtGetVMillStep( b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), dTol)
else
local dArea = b3Raw:getDimX() * b3Raw:getDimY() + b3Raw:getDimX() * b3Raw:getDimZ() + b3Raw:getDimY() * b3Raw:getDimZ()
if dArea < 0.075e6 then
@@ -256,6 +269,7 @@ function OnSimulDispositionStart()
dTol = 3.77
end
end
dTol = min( dTol, EMT.VMILLTOL or dTol) -- imposto dTol al valore minore tra quello per volume e quello per spessore lama
-- creo lo Zmap
local VMillId = EgtVolZmapBox( nPartRawId, b3Raw:getMin(), b3Raw:getDimX(), b3Raw:getDimY(), b3Raw:getDimZ(), dTol, true, GDB_RT.GLOB)
if VMillId then
@@ -472,6 +486,7 @@ function OnSimulDispositionEnd()
EMT.UNLOADING = false
EMT.FALL = false
EMT.TO_FALL = false
EMT.Y2DELTA = nil
end
-- se disposizione intermedia
if IsMidPhase( EMT.PHASE) or IsEnd2Phase( EMT.PHASE) then
@@ -503,9 +518,11 @@ 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 nSetHead == 1 then
if bIsFirstHead then
EgtSetAxisPos( 'X2', MinX2)
else
EgtSetAxisPos( 'X1', MaxX1)
@@ -541,6 +558,75 @@ 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( '')
@@ -609,10 +695,57 @@ 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 ( 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
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
@@ -621,7 +754,7 @@ function OnSimulToolDeselect( dPrevA)
-- se ci sono due teste
if EgtGetHeadId( 'H21') then
local nSetHead = GetHeadSet( EMT.NEXTHEAD)
if nSetHead == 1 then
if nSetHead == 1 or nSetHead == 11 then
-- porto in home testa 1
SimulMoveAxis( 'X1', MaxX1, MCH_SIM_STEP.RAPID)
-- deposito utensile fresa
@@ -677,7 +810,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 EMT.PREVHEAD_H2 then
elseif nSetHead == 2 and EMT.PREVHEAD_H2 then
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
end
end
@@ -708,7 +841,7 @@ function OnSimulToolDeselect( dPrevA)
SimulMoveAxis( 'Z2', ParkCSawZ2, MCH_SIM_STEP.RAPID)
end
-- per prossima testa gruppo 1
else
elseif nNextSetHead == 1 then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa
@@ -719,7 +852,7 @@ function OnSimulToolDeselect( dPrevA)
local MyParkB1 = ParkB1
local MyParkC1 = ParkC1
-- se ho due teste oppure è progress, significa che ho CU verticale
if EgtGetHeadId('H21') or Progress then
if EgtGetHeadId('H21') or Progress or SecondToolChanger then
MyParkB1 = EgtIf( GetHeadTCSet( EMT.NEXTHEAD, EMT.NEXTTCPOS) == 'Head1_TC1', ParkB1, ParkFrnB1)
MyParkC1 = EgtIf( GetHeadTCSet( EMT.NEXTHEAD, EMT.NEXTTCPOS) == 'Head1_TC1', ParkC1, ParkFrnC1)
-- altrimenti su one CU speciale motosega-utensile lungo
@@ -841,6 +974,7 @@ 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
@@ -1041,7 +1175,15 @@ function OnSimulMoveStart()
if EMT.HEAD == 'H12' and abs( C1Pos - EMT.R1) > 1 and ( abs( C1Home - EMT.R1) > 30.1 or abs(B1Home - EMT.R2) > 30.1) then
SimulMoveAxis( 'B1', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', dBref, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
if bMoveZbeforeX then
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
end
@@ -1094,7 +1236,7 @@ function OnSimulMoveStart()
local bMoveZbeforeX = false
local dZref = EMT.L3
if EMT.HEAD == 'H12' and ( -EMT.L2 < -LimX1RotSaw or EMT.R2 > 91) then
if EMT.HEAD == 'H12' and ( EgtIf( BD.RIGHT_LOAD, -EMT.L2 < -LimX1RotSaw, -EMT.L2 > -LimX1RotSaw) or EMT.R2 > 91) then
dZref = Z1Home + GetZExtra( EMT.HEAD, EMT.R2) - 100
end
-- se la quota di lavoro è più in alta della posizione a ZHOME della testa, prima si va alla Z di lavoro e poi si approccia il pezzo
@@ -1110,7 +1252,15 @@ function OnSimulMoveStart()
if EMT.HEAD == 'H12' and abs( C1Pos - EMT.R1) > 1 and ( abs( C1Home - EMT.R1) > 30.1 or abs(B1Home - EMT.R2) > 30.1) then
SimulMoveAxis( 'B1', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', dBref, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'Z1', dZref, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
if bMoveZbeforeX then
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
end
@@ -1182,7 +1332,15 @@ function OnSimulMoveStart()
if EMT.HEAD == 'H22' then
SimulMoveAxis( 'B2', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C2', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'Z2', dZref, MCH_SIM_STEP.RAPID, 'B2', EMT.R2, MCH_SIM_STEP.COLLROT)
-- se movimento di B > di 90°, spezza il movimento in 2 arrivando alla quota Z con B+-90 e poi muove l'ultimo segmento
-- evita collisione con carro X
if EMT.R2 > 91 or EMT.R2 < -91 then
local dBref = EgtClamp( EMT.R2, -91, 91)
SimulMoveAxes( 'Z2', dZref, MCH_SIM_STEP.RAPID, 'B2', dBref, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B2', EMT.R2, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'Z2', dZref, MCH_SIM_STEP.RAPID, 'B2', EMT.R2, MCH_SIM_STEP.COLLROT)
end
if bMoveZbeforeX then
SimulMoveAxis( 'Z2', EMT.L3, MCH_SIM_STEP.RAPID)
end
@@ -1599,7 +1757,15 @@ function ExecMoveHome( bNearV, bMchSplit)
EMT.CHSAW_OUT = true
end
-- porto le teste in home
SimulMoveAxes( 'X1', ParkX1, MCH_SIM_STEP.RAPID, 'X2', ParkX2, MCH_SIM_STEP.RAPID)
if EgtGetHeadId( 'H21') then
SimulMoveAxes( 'X1', ParkX1, MCH_SIM_STEP.RAPID, 'X2', ParkX2, MCH_SIM_STEP.RAPID)
else
if GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1' then
SimulMoveAxes( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
else
SimulMoveAxes( 'X1', ParkFrnX1, MCH_SIM_STEP.RAPID)
end
end
-- sistemo i rulli
ExecOpenRoller( 1)
ExecOpenRoller( 2)
@@ -1615,16 +1781,50 @@ 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( 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'))
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'))
-- posizioni home degli assi testa
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'))
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'))
-- 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
@@ -1635,7 +1835,7 @@ function ExecMoveZmax( bMchSplit, btoXHome)
ExecParkRoller( nil, nil, nil, nil, bMchSplit, bAgg)
end
-- se testa 1
if nSetHead == 1 then
if bIsFirstHead then
-- se fresa o lama
if GetHeadTCSet( EMT.HEAD, EMT.TCPOS) == 'Head1_TC1' then
if not HeadIsChainSaw( EMT.HEAD) then
@@ -1691,10 +1891,28 @@ function ExecMoveZmax( bMchSplit, btoXHome)
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
if btoXHome then
EMT.XHOME = true
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'X1', HomeX, MCH_SIM_STEP.RAPID)
end
-- altrimenti sega a catena
else
-- controlla che l'ingombro della sega a catena non possa collidere durante il suo riposizionamento
local dChSawEncumbrance = sqrt( pow( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN), 2) + pow( ChSawLen + MillOffs, 2))
if EMT.ADIR and EMT.TDIR then
-- direzione versore sega a catena X- (copre anche eventuali inclinazioni in Y)
if EMT.TDIR[1] <= 0 then
-- ingombro massimo di quota Z (senza pivot) + ingombro massimo sega + altezza pezzo + altezza sicurezza
local dEncumbranceTot = EMT.L3p + MillOffs - dChSawEncumbrance - EMT.SB - 30
-- nuova quota Z intermedia
local dZUp = EMT.L3p + ( DeltaTabZ - dEncumbranceTot)
-- se la nuova quota è minore della quota di parcheggio
if dZUp <= ParkCSawZ1 then
-- se B è oltre il punto di massimo ingombro (con l'inclinazione attuale non ha il massimo ingombro)
if asin( EMT.TDIR[3] / 1) > asin( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) / dChSawEncumbrance) and ( dEncumbranceTot < DeltaTabZ) then
SimulMoveAxis( 'Z1', dZUp, MCH_SIM_STEP.RAPID)
end
end
end
end
SimulMoveAxes( 'Z1', HomeZ, MCH_SIM_STEP.RAPID, 'B1', HomeB, MCH_SIM_STEP.COLLROT)
if EMT.R3 and abs( EMT.R3) < 0.1 then
SimulMoveAxis( 'Z1', ParkCSawZ1, MCH_SIM_STEP.RAPID)
@@ -1702,6 +1920,8 @@ function ExecMoveZmax( bMchSplit, btoXHome)
if btoXHome then
EgtUnloadTool( EMT.HEAD, 1)
ShowToolInTcPos( EMT.TCPOS, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.HEAD or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
EMT.PREVTOOL_H1 = nil
EMT.PREVHEAD_H1 = nil
EMT.PREVTCPOS_H1 = nil
@@ -1732,6 +1952,24 @@ function ExecMoveZmax( bMchSplit, btoXHome)
end
-- altrimenti sega a catena
else
-- controlla che l'ingombro della sega a catena non possa collidere durante il suo riposizionamento
local dChSawEncumbrance = sqrt( pow( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN), 2) + pow( ChSawLen + Mill2Offs, 2))
if EMT.ADIR and EMT.TDIR then
-- direzione versore sega a catena X- (copre anche eventuali inclinazioni in Y)
if EMT.TDIR[1] <= 0 then
-- ingombro massimo di quota Z (senza pivot) + ingombro massimo sega + altezza pezzo + altezza sicurezza
local dEncumbranceTot = EMT.L3p + Mill2Offs - dChSawEncumbrance - EMT.SB - 30
-- nuova quota Z intermedia
local dZUp = EMT.L3p + ( DeltaTabZ - dEncumbranceTot)
-- se la nuova quota è minore della quota di parcheggio
if dZUp <= ParkCSawZ2 then
-- se B è oltre il punto di massimo ingombro (con l'inclinazione attuale non ha il massimo ingombro)
if asin( EMT.TDIR[3] / 1) > asin( EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) / dChSawEncumbrance) and ( dEncumbranceTot < DeltaTabZ) then
SimulMoveAxis( 'Z2', dZUp, MCH_SIM_STEP.RAPID)
end
end
end
end
SimulMoveAxes( 'Z2', HomeZ, MCH_SIM_STEP.RAPID, 'B2', HomeB, MCH_SIM_STEP.COLLROT)
if EMT.R3 and abs( EMT.R3) < 0.1 then
SimulMoveAxis( 'Z2', ParkCSawZ2, MCH_SIM_STEP.RAPID)
@@ -1811,16 +2049,163 @@ function ExecUnloading()
end
end
---------------------------------------------------------------------
function CheckClamping( sClampName)
nIndexClamp = EgtGetAxisId( sClampName)
local idClampPath = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nIndexClamp, 'CLAMP_CHECK') or GDB_ID.NULL)
local b3ClampingArea = EgtGetBBoxGlob( idClampPath or GDB_ID.NULL, GDB_BB.STANDARD)
-- se non trovo percorso area di clamping, esco subito
if not idClampPath or not EMT.VMILL or not ClampingCoeffMin then
return
end
local function GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
local idCurveList = {}
local vtIntersPlane
-- piano di interpolazione
if sIntersPlane == 'X' then
vtIntersPlane = X_AX()
elseif sIntersPlane == 'Y' then
vtIntersPlane = Y_AX()
elseif sIntersPlane == 'Z' then
vtIntersPlane = Z_AX()
end
for i = 1, #EMT.VMILL do
local b3VMill = EgtGetBBoxGlob( EMT.VMILL[i], GDB_BB.EXACT)
local ptPosIntersPlane
if sPosIntersPlane == 'MIN' then
ptPosIntersPlane = b3VMill:getMin() + dDepth * vtIntersPlane
elseif sPosIntersPlane == 'MAX' then
ptPosIntersPlane = b3VMill:getMax() - dDepth * vtIntersPlane
end
local idLoop, nLoopCnt = EgtPlaneVolZmapInters( ptPosIntersPlane, vtIntersPlane, EMT.VMILL[i], CLAMP_CHECK_INTERS, GDB_RT.GLOB)
-- se c'è almeno una curva
if idLoop then
for j = 1, nLoopCnt do
local idLoopTemp = idLoop + j - 1
table.insert( idCurveList, idLoopTemp)
end
end
end
return idCurveList
end
local function CalculateIntersectionArea( sPosIntersPlane, sIntersPlane, dDepth)
-- test piano frontale
local idCurveList = GetCurveListFromIntersection( sPosIntersPlane, sIntersPlane, dDepth)
-- si copia curva intersezione e curva pinza in gruppo di confronto
local idFlatSurf, nFlatSurfCnt = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idCurveList)
local idClampSurf = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idClampPath)
if idFlatSurf then
local dTotalArea = 0
local dTotalXLenght = 0
for k = 1, nFlatSurfCnt do
local idTempSurf = idFlatSurf + k - 1
EgtSurfFrIntersect( idTempSurf, idClampSurf)
if idTempSurf then
dTotalArea = dTotalArea + ceil( EgtSurfArea( idTempSurf) or 0)
local b3BoxIntersectionBox = EgtGetBBoxGlob( idTempSurf, GDB_BB.STANDARD)
if b3BoxIntersectionBox then
dTotalXLenght = dTotalXLenght + ceil( b3BoxIntersectionBox:getDimX()) -- somma lunghezze (x) delle aree pinzate
end
end
end
return dTotalArea, dTotalXLenght
end
return 0
end
-- minima area considerata per un corretto pinzaggio
DistZClampToTable = DistZClampToTable or 0
local MinJoin = BD.GetMinJoin( EMT.HB, EMT.SB, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
local MinZClamping = min( b3ClampingArea:getDimZ() + DistZClampToTable, EMT.SB) - DistZClampToTable
-- si moltiplica per un coefficiente minimo sotto al quale si da l'errore di pinzaggio
ClampingCoeffMin = EgtClamp( ClampingCoeffMin, 0.01, 1)
local dMinClampingAreaWarn = ( MinJoin * MinZClamping) * ClampingCoeffMin
local dMinClampingAreaErr = ( MinJoin * MinZClamping) * ( ClampingCoeffMin / 3)
local bError = true
local sWrn, sErr
local bWriteWarnMessage = false
local bWriteErrMessage = false
-- controllo faccia frontale
local dArea, dXClampedLenght = CalculateIntersectionArea( 'MIN', 'Y', 3)
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
if dArea and dArea < dMinClampingAreaErr then
-- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
bError = false
end
-- pinzaggio non fattibile, errore
if bError then
sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
bWriteErrMessage = true
end
end
-- WARNING: pinza meno del minimo richiesto
if dArea and dArea < dMinClampingAreaWarn and not bWriteErrMessage then
sWrn = 'WARNING CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
bWriteWarnMessage = true
end
EgtEmptyGroup( CLAMP_CHECK_GROUP)
EgtEmptyGroup( CLAMP_CHECK_INTERS)
-- controllo altro lato solo se non sono già in errore
if not bWriteErrMessage then
-- controllo faccia posteriore
dArea = CalculateIntersectionArea( 'MAX', 'Y', 3)
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
if dArea and dArea < dMinClampingAreaErr then
-- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
bError = false
end
-- pinzaggio non fattibile, errore
if bError then
sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
bWriteErrMessage = true
end
end
-- WARNING: pinza meno del minimo richiesto
if dArea and dArea < dMinClampingAreaWarn and not bWriteWarnMessage and not bWriteErrMessage then
sWrn = 'WARNING CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
bWriteWarnMessage = true
end
EgtEmptyGroup( CLAMP_CHECK_GROUP)
EgtEmptyGroup( CLAMP_CHECK_INTERS)
end
if bWriteErrMessage then
EmtSetLastError( 1213, sErr, EgtGetEnableUI())
EgtOutBox( sErr, 'CLAMPING', 'ERROR', 'OK')
EmtSetSimulPause()
elseif bWriteWarnMessage then
EgtOutLog( sWrn)
EgtOutBox( sWrn, 'CLAMPING', 'WARNING', 'OK')
EmtSetSimulPause()
end
end
---------------------------------------------------------------------
function ExecMovePY1( bClose)
SimulMoveAxis( 'PY1', EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY1Light( bClose)
if bClose then
CheckClamping( 'PY1')
end
end
---------------------------------------------------------------------
function ExecMovePY2( bClose)
SimulMoveAxis( 'PY2', EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY2Light( bClose)
if bClose then
CheckClamping( 'PY2')
end
end
---------------------------------------------------------------------
@@ -2256,7 +2641,7 @@ function LoadNextTool( nHSet, sTcPosDef, bFirst)
if vTools and vTools[1] and #(vTools[1]) > 0 then
sTool = vTools[1]
sTcPos = sTcPosDef
if Progress then
if Progress or SecondToolChanger then
sHead = EgtIf( sTcPos == 'T11', 'H12', 'H11')
elseif nHSet == 1 then
sHead = EgtIf( sTcPos == 'T1', 'H12', 'H11')
@@ -2293,6 +2678,14 @@ 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 ***
---------------------------------------------------------------------
@@ -2313,6 +2706,9 @@ local FALL_T = 2 * ESTIMATION_RAPID_COEFF -- s
---------------------------------------------------------------------
function OnEstimStart()
EMT.INCHES = not EgtUiUnitsAreMM() -- unità di misura mm/inches
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
end
---------------------------------------------------------------------
@@ -2398,6 +2794,15 @@ function OnEstimDispositionEnd()
EMT.OPEISDISP = false
end
---------------------------------------------------------------------
function OnEstimRawMoveData()
-- se start del pezzo
if IsStartOrRestPhase( EMT.PHASE) then
EMT.SPLIT = false
end
OnRawMoveData()
end
---------------------------------------------------------------------
function OnEstimToolSelect()
-- reset indice utensile in tabella lunghezze
@@ -2454,6 +2859,12 @@ function OnEstimMachiningEnd()
EMT.TLE_NAME = nil
EMT.TLE_TIME = nil
end
EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil)
if EMT.MCHSPLIT then
EMT.SPLIT = true
end
end
---------------------------------------------------------------------
@@ -2579,11 +2990,11 @@ function OnEstimRapid()
EMT.MCHEXTLEN = EMT.MCHEXTLEN + dLen
-- calcolo tempo
local dTime = RAPID_MIN_T
local dT1 = abs( dL1) / RAPID_X_FEED * 60
local dT1 = CalcMoveTime( abs( dL1), RAPID_X_FEED, EMT.SPLIT)
if dT1 > dTime then dTime = dT1 end
local dT2 = abs( dL2) / RAPID_Y_FEED * 60
local dT2 = CalcMoveTime( abs( dL2), EMT.FMAXPINZE, EMT.SPLIT)
if dT2 > dTime then dTime = dT2 end
local dT3 = abs( dL3) / RAPID_Z_FEED * 60
local dT3 = CalcMoveTime( abs( dL3), RAPID_Z_FEED, EMT.SPLIT)
if dT3 > dTime then dTime = dT3 end
local dT4 = abs( dR1) / RAPID_C_FEED * 60
if dT4 > dTime then dTime = dT4 end
@@ -2605,7 +3016,7 @@ function OnEstimLinear()
local dLen = sqrt( dL1 * dL1 + dL2 * dL2 + dL3 * dL3)
EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen
-- calcolo tempo
local dTime = dLen / EMT.F * 60
local dTime = CalcMoveTime( dLen, EMT.F, EMT.SPLIT)
EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime
EgtOutLog( string.format( ' G1 Len=%.0f Time=%.2f', dLen, dTime), 5)
-- aggiorno valori come precedenti
@@ -2699,7 +3110,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'}
TCPOS_1A = { 'T1', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', '501'}
TCPOS_1B = { 'T101'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20'}
TCPOS_2B = { 'T111'}
@@ -2707,7 +3118,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'}
TCPOS_2A = { 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T17', 'T18', 'T19', 'T20', '502'}
end
for _, sVal in ipairs( TCPOS_1A) do
if sVal == sTcPos then return 1, 1 end
@@ -2860,9 +3271,9 @@ end
---------------------------------------------------------------------
function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H17' or HeadIsChainSaw( sHead) then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1) % 180.0 > 1))
elseif sHead == 'H21' or sHead == 'H22' or HeadIsChainSaw( sHead) then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1) % 180.0 > 1))
end
end
@@ -2877,5 +3288,40 @@ function GetCmdAxMove( Cmd, sAx)
end
end
---------------------------------------------------------------------
function CalcDinamicaPinze( dH, dS, dL)
local KgMtCubo= WoodDensity or 550 -- densità legno [Kg / metro cubo]
local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg]
local FMaxPinze = EMT.FMAXPINZE -- Feed massima pinze [mm/min]
local ForzaAttrito = 350 * 9.8 * 0.2 -- Forza chiusura pinze [Kgf] * g * Coeff_Attrito -> [N]
local TempoAcc = ( ( Massa * FMaxPinze) / ( 60 * ForzaAttrito) / 1000)
local AccMaxPinze = EMT.MAXACC
local AccPinze = EgtClamp( FMaxPinze / ( 60 * TempoAcc), EMT.MINACC, EMT.MAXACC)
local RidFeed = 100 / Massa * 100
if RidFeed > 100 then
RidFeed = 100
elseif RidFeed < 10 then
RidFeed = 10
end
return AccPinze, AccMaxPinze, RidFeed
end
---------------------------------------------------------------------
function CalcMoveTime( dPathLen, dFeed, bIsSplitted)
local dTime
local dFeedInSec = dFeed / 60
local dAcc, _, _ = CalcDinamicaPinze( EMT.HB, EMT.SB, EgtIf( bIsSplitted, EMT.LT, EMT.LB))
-- Caso 1: dFeed raggiunta
if dPathLen >= ( dFeedInSec ^ 2) / dAcc then
dTime = ( dFeedInSec / dAcc) + ( dPathLen / dFeedInSec)
-- Caso 2: dFeed non raggiunta
else
dTime = 2 * sqrt( dPathLen / dAcc)
end
return dTime
end
---------------------------------------------------------------------
-- *** END GENERAL ***
+146 -5
View File
@@ -4,9 +4,74 @@
require( 'EmtGenerator')
EgtEnableDebug( false)
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- Carico libreria
local BD = require( 'BeamData')
---------------------------------------------------------------------
-- *** Generic Machinings ***
---------------------------------------------------------------------
require( 'EmtGenMachining')
---------------------------------------------------------------------
-- *** Special GetPrevMachiningOffset ***
---------------------------------------------------------------------
-----------------------------------------------------------------------------------------
function OnSpecialGetPrevMachiningOffset()
-- Aggiorno posizione della testa della trave a seguito di movimenti delle pinze non previsti tra le fasi
local function TPosUpdate()
local nClId = EgtGetFirstNameInGroup( EMC.CURRMCHID, 'CL') -- recupero Id del gruppo CL della lavorazione corrente
local nPathId = EgtGetFirstInGroup( nClId or GDB_ID.NULL) -- Id del primo gruppo nella lavorazione (P1)
if not nPathId then
EMC.ERR = 12
EMC.MSG = ' Error : CL group path not found'
return
end
local dAuxMoveCount = EgtGetInfo( nPathId, 'AS#', 'd') or 0 -- numero di movimenti ausiliari
local dTRepos = nil
-- controlla ogni gruppo di movimenti ausiliari
for i = 1, dAuxMoveCount do
local aAuxMove = EgtGetInfo( nPathId, 'AS' .. tostring( i), 'vs') or {} -- array contenete i parametri di ogni gruppo
-- controlla solo i movimenti della testa trave e salva l'ultimo
if aAuxMove[1] == '2' or aAuxMove[1] == '3' then
for j = 2, #aAuxMove do
if aAuxMove[j] == 'T' then
dTRepos = aAuxMove[j+1]
break
end
end
end
end
return dTRepos
end
-- default
EMC.ERR = 0
EMC.PREVOFFSX = 0
-- se c'è cambio di fase tra le lavorazioni (quindi la precedente è l'ultima della sua fase e la corrente la prima)
if EMC.PREVPHASE ~= EMC.CURRPHASE then
-- se la fase corrente è di inizio lavorazione di nuova trave
if IsStartOrRestPhase( EMC.CURRPHASE) then
-- recupero la posizione finale della lavorazione precedente
local vPrevAx = EmtGetFinalAxesPos( EMC.PREVMCHID)
-- ricava se e quanto la trave viene spostata tra le due fasi dai movimenti ausiliari e corregge l'offset di fine fase
local dNewTPos = TPosUpdate()
-- se ci sono dei movimenti della testa trave tra le due fasi ricava il delta tra la vecchia e la nuova posizione
if dNewTPos then
EMC.PREVOFFSX = dNewTPos - vPrevAx[1]
-- oppure la X (L1) di questa corrisponde alla posizione iniziale della nuova trave, se ne deduce l'offset
else
EMC.PREVOFFSX = ParkV1 - vPrevAx[1]
end
end
end
end
---------------------- OnSpecialGetMaxZ -----------------------------
---------------------------------------------------------------------
local function CalcExtraZ( vtTp, vtT, vMZ)
@@ -208,6 +273,13 @@ 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
@@ -654,14 +726,72 @@ end
---------------------------------------------------------------------
function OnPostApplyMachining()
-- Inizializzo codice di errore
EMC.ERR = 0
-- Verifico se ultima lavorazione della fase
local nNextOpeId = EgtGetNextActiveOperation( EMC.MCHID)
local bMchLast = ( not nNextOpeId or EgtGetOperationPhase( nNextOpeId) ~= EMC.PHASE) -- Agisco sui diversi percorsi della lavorazione
local nPathId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( EMC.MCHID, 'CL') or GDB_ID.NULL)
while nPathId do
-- recupero id del successivo
nPathId = EgtGetNext( nPathId)
-- verifico se ultimo percorso di ultima lavorazione della fase
local bLast = ( bMchLast and ( not nPathId))
-- se ultimo, elimino ritorno in home
if bLast then EgtRemoveOperationHome( EMC.MCHID) end
end
end
---------------------------------------------------------------------
function OnSpecialApplyMachining()
EgtOutLog( ' Lavorazione : ' .. EgtGetName( EMC.MCHID), 1)
-- 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
@@ -761,7 +891,7 @@ function OnPostApplyMachining()
-- verifico se ultimo percorso di ultima lavorazione della fase
local bLast = ( bMchLast and ( not nPathId))
-- se ultimo, elimino ritorno in home
if bLast then EgtRemoveOperationHome( EMC.MCHID) end
-- if bLast then EgtRemoveOperationHome( EMC.MCHID) end
-- salvo lo stato dei carrelli
local OriTPos = EMC.TPOS
local OriY1Delta = EMC.Y1DELTA
@@ -819,7 +949,6 @@ function OnPostApplyMachining()
local vAxes = EmtGetAxesPos( nLastEntId)
if #vAxes > 0 then EMC.TPOS = vAxes[1] end
end
end
---------------------------------------------------------------------
@@ -1097,6 +1226,17 @@ 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)
@@ -1107,8 +1247,8 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
end
-- Calcolo dell'ingombro della testa rispetto allo Zero Macchina
local b3Enc
if sHead ~= 'H21' and sHead ~= 'H22' and sHead ~= 'H23' then
if bIsFirstHead then
EgtSetAxisPos( 'C1', vAxes[4])
EgtSetAxisPos( 'B1', vAxes[5])
if sHead == 'H13' or sHead == 'H15' then
@@ -1142,6 +1282,7 @@ 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,11 +91,13 @@ 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
@@ -114,6 +116,7 @@ H21.1:MILL_NOTIP=MillNoTip.nge
H22.1=Saw.nge
[Machinings]
Probing=1
Drilling=1
Sawing=1
Milling=1
@@ -126,6 +129,8 @@ SawFinishing=0
[Machining]
InitScript=InitMach.lua
ExitScript=ExitMach.lua
[Probing]
PrbScript1=StdProbe
[Disposition]
;InitScript=InitDisp.lua
@@ -139,10 +144,14 @@ 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
@@ -155,3 +164,5 @@ WinPlace=0,514,138,628,810
Enable=1
Save=0
[ToolTrace]
Enable=1
+124 -10
View File
@@ -42,12 +42,12 @@
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
EgtEnableDebug( true)
PP_VER = '2.7h2_DEV1'
PP_NVER = '2.7.8.2'
PP_VER = '3.1c1_DEV1'
PP_NVER = '3.1.3.1'
MIN_MACH_VER = '2.5k1'
MACH_NAME = string.match( EgtGetCurrMachineDir(), "[^\\]+$") -- si ricava il nome della macchina dal direttorio
MACH_NAME = EgtGetCurrMachineName()
-- Carico i dati globali
local sMachDir = EgtGetCurrMachineDir()
@@ -178,7 +178,10 @@ 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
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PFrl.data"
@@ -235,6 +238,8 @@ if EgtExistsFile( sData) then
if Machine.Offsets.MIN_V2 then MinV2 = Machine.Offsets.MIN_V2 end
if Machine.Offsets.MAX_V2 then MaxV2 = Machine.Offsets.MAX_V2 end
if Machine.Offsets.CLAMP5 then Clamp5 = ( Machine.Offsets.CLAMP5 == 1) end
if Machine.Offsets.MIN_W then MinW = Machine.Offsets.MIN_W end
if Machine.Offsets.MAX_W then MaxW = Machine.Offsets.MAX_W end
if Machine.Offsets.MINWOPEN then MinWOpen = Machine.Offsets.MINWOPEN end
if Machine.Offsets.MAXWOPEN then MaxWOpen = Machine.Offsets.MAXWOPEN end
if Machine.Offsets.MAXWHEIGHT then MaxWHeight = Machine.Offsets.MAXWHEIGHT end
@@ -267,12 +272,17 @@ 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
if Machine.Offsets.MAX_BACK_CLAMP_5 then MaxBackClamp5 = Machine.Offsets.MAX_BACK_CLAMP_5 end
if Machine.Offsets.COEFF_CLAMP_CHECK then ClampingCoeffMin = Machine.Offsets.COEFF_CLAMP_CHECK end
-- aggiustamenti
MinY1 = MinV1 + MinDeltaYV
MaxY1 = MaxMchY1
@@ -344,6 +354,13 @@ 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',
@@ -354,7 +371,7 @@ EmtAxis {
Stroke = {MinB1, MaxB1},
Home = ParkB1,
Geo = 'B1_AXIS/GEO',
Aux = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION'}}
Aux = sBAxisAuxGeom }
-- Frese
local H11Id = EmtHead {
Name = 'H11',
@@ -382,6 +399,22 @@ 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',
@@ -461,6 +494,12 @@ 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',
@@ -471,7 +510,7 @@ local B2Id = EmtAxis {
Stroke = {MinB2, MaxB2},
Home = ParkB2,
Geo = 'B2_AXIS/GEO',
Aux = {'B2_AXIS/SOLID', 'B2_AXIS/COLLISION'}}
Aux = sBAxisAuxGeom}
local vtMove2 = Vector3d( 0, Head2Y, Head2Z)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'SOLID'), vtMove2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'COLLISION'), vtMove2, GDB_RT.GLOB)
@@ -481,6 +520,10 @@ 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',
@@ -509,6 +552,22 @@ 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 {
@@ -530,7 +589,7 @@ local PY1Id = EmtAxis {
Stroke = {0, MaxHoOpen},
Home = MaxHoOpen,
Geo = 'PY1_AXIS/GEO',
Aux = 'PY1_AXIS/SOLID'}
Aux = {'PY1_AXIS/SOLID', 'PY1_AXIS/CLAMP_CHECK'}}
local Y2Id = EmtAxis {
Name = 'Y2',
Parent = 'Base',
@@ -550,7 +609,7 @@ local PY2Id = EmtAxis {
Stroke = {0, MaxHoOpen},
Home = MaxHoOpen,
Geo = 'PY2_AXIS/GEO',
Aux = 'PY2_AXIS/SOLID'}
Aux = {'PY2_AXIS/SOLID', 'PY2_AXIS/CLAMP_CHECK'}}
-- Rulli
local V1Id = EmtAxis {
Name = 'V1',
@@ -661,6 +720,7 @@ EmtTable {
Parent = 'T',
Type = MCH_TT.FLAT,
Ref1 = Point3d( -DimTabX, DeltaTabY, DeltaTabZ),
Coll = 'Base/BELT',
Geo = 'TABLE/GEO',
Aux = 'TABLE/SOLID'}
-- *** ToolChanger ***
@@ -856,8 +916,10 @@ local vtMove = Vector3d( 0, ( DeltaTabY - 1170.0), ( DeltaTabZ + 1010.0))
EgtMove( EgtGetFirstNameInGroup( BaseId, 'CONVOYER'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( Y1Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PY1Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PY1Id, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( Y2Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PY2Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PY2Id, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( V1Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( PV1Id, 'SOLID'), vtMove, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( QV1Id, 'SOLID'), vtMove, GDB_RT.GLOB)
@@ -937,8 +999,12 @@ end
function GetHeadSet( sHead)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' or sHead == 'H17' then
return 1
elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then
elseif sHead == 'H19' then
return 11
elseif sHead == 'H21' or sHead == 'H22' then
return 2
elseif sHead == 'H29' then
return 21
else
return 0
end
@@ -986,6 +1052,54 @@ 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)
@@ -1040,6 +1154,7 @@ function GetZExtra( sHead, dAngV)
return 0
end
end
return 0
end
---------------------------------------------------------------------
@@ -1080,7 +1195,6 @@ function GetPY2Light()
return ( EgtGetInfo( PY2LightId, 'On') == '1')
end
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
function OnResetMachine()
+7
View File
@@ -2,6 +2,9 @@
;Index = Type, Description, Default Value
; Type : b=boolean, d=double, l=lenght, s=string
[Probing]
0=s,Type,Head
[Drilling]
[Sawing]
@@ -13,6 +16,9 @@
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
@@ -20,6 +26,7 @@
2=d,OpenMinSafe,0
3=d,OpenOutRaw,0
4=l,MaxOptSize,0
5=b,AdjustFeed,1
[Mortising]
0=d,MaxElev,0
+13 -1
View File
@@ -31,6 +31,8 @@ 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"},
@@ -79,7 +81,17 @@ else
table.insert( PositionTable, {Pos = "Pos21", TcPos = "T201", Head = "H13", Group = "G2"})
end
end
local UsePositionHead = false
-- 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 function IsInGeomSet( ToolHead, PosHead)
for GsIndex = 1, #GS do
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -3
View File
@@ -36,6 +36,7 @@
4=s,DOUBLE
[MORTISE_STD]
0=b,MORTISE
1=d,STEP
2=d,SIDESTEP
0=th,TH,
1=b,MORTISE
2=d,STEP
3=d,SIDESTEP
+50
View File
@@ -1,5 +1,54 @@
==== Common_ONE-PF Update Log ====
Versione 3.1c2 (17/03/2026)
- (SIM-GEN) Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito
- Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente. ATT: MIN_MACH -> 3.1b2
Versione 3.1c1 (04/03/2026)
- (GEN) Corretta chiamata di una variabile insesistente in caso di ONE
- (SIM) Allineata simulazione a generazione
Versione 3.1b1 (20/02/2026)
- (GEN) Aggiunta funzione ToolPreSelection() per la preselezione utensile. Ticket#2789
- (GEN) Funzione rinominata in ToolPreSelectionSingleHead(), ora utilizza funzione in MLDE per capire se è motosega
Versione 3.1a1 (16/01/2026)
- (SIM-GEN) Aggiunto controllo che evita collisioni durante lo svincolo in Z della sega a catena nelle funzioni ExecMoveZMax() e EmitZMax(). Ticket#2767
- (SIM-GEN) Piccola correzione modifiche fatte in precedenza
Versione 2.7l1 (18/12/2025)
- (SIM-GEN) Aggiunto controllo post movimenti ausiliari dell' EMC.PREVOFFSX nella funzione OnSpecialGetPrevMachiningOffset(). Ticket#2727
- (SIM-GEN) Divisione movimento B in approccio se > 90°. Ticket#2754
- (SIM) Aggiunta funzione CheckClamping
Versione 2.7k3 (28/11/2025)
- (GEN) Prima di andare allo scarico, si aggiunge movimento intermedio dove si aspetta che rulli scarico siano arrivati in posizione. Ticket#2716
Versione 2.7k2 (20/11/2025)
- (SIM) Aggiornata risoluzione VMillTol in funzione dello spessore lama
Versione 2.7k1 (05/11/2025)
- (SIM-GEN) Corretto calcolo per decidere se serve aprire i rulli
- (GEN) Aggiunta tolleranza in creazione piano di lavoro inclinato
- (SIM) Allo scarico si resetta Y2DELTA. Ticket#2687
Versione 2.7j3 (23/10/2025)
- (SIM) Corretta posizione parcheggio in caso di testa 1 su magazzino 2. Ticket#2660
Versione 2.7j2 (21/10/2025)
- (GEN) Se SPLIT con pinza 5, corretto salvataggio posizione pinza 2. Ticket#2654
Versione 2.7j1 (08/10/2025)
- (GEN) Salvataggio posizione Z su lavorazione precedente, sbagliava in caso di separazione. Ticket#2637
Versione 2.7i1 (10/09/2025)
- (SIM-GEN) Piccole correzioni per gestire secondo TC su ONE. Ticket#2563
- (SIM-GEN) Gestione aggregato BH completato. Ticket#2482
- (EST) Stima tempi considerando accelerazioni
- (SIM-GEN) Se fase start o restart, si aggiorna la posizione in X dell'asse per calcolare il link corretto
- (GEN) Piccola correzione risalita ZMAX dopo RELOAD del pezzo. Generazione allineata a simulazione.
Versione 2.7h2 (28/08/2025)
- (GEN) Migliorata gestione spegnimento utensile e disattivazione piano
- (SIM-GEN) Corretto nome variabile e altre piccole modifiche per Progress
@@ -26,6 +75,7 @@ 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)
+2 -2
View File
@@ -3,8 +3,8 @@
local InfoCommon_STD_PP = {
NAME = 'Common_ONE-PF', -- nome script PP standard
VERSION = '2.7h2', -- versione script
MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel
VERSION = '3.1c2', -- versione script
MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel
}
return InfoCommon_STD_PP