Compare commits

...

42 Commits

Author SHA1 Message Date
andrea.villa 5e9912eb5f Merge provvisorio con common 2026-06-05 15:19:34 +02:00
daniele.nicoli 0c2333df8b In caso di ultimo movimento come scarico rimanenza, porta V2 in posizione di parcheggio 2026-05-28 14:44:39 +02:00
daniele.nicoli d1ddc26d8f Merge branch 'main' into develop 2026-05-28 14:40:43 +02:00
andrea.villa 0ea2adecbb Merge branch 'develop' 2026-05-15 10:36:20 +02:00
andrea.villa d401d8e37c Corretta gestione scarico manuale ( errore in versione 3.1e1) 2026-05-15 10:35:44 +02:00
andrea.villa ebbe1c9ac6 corretto nome variabile 2026-05-15 09:24:18 +02:00
andrea.villa e88ce08053 Merge remote-tracking branch 'origin/main' into develop 2026-05-15 09:23:57 +02:00
andrea.villa 97ec5d29c6 Merge branch 'develop' 2026-05-12 15:50:24 +02:00
andrea.villa 293dc97749 Cambio versione per rilascio a cliente 2026-05-12 15:50:14 +02:00
daniele.nicoli 1fa5c7de64 Sistemata gestione di pezzi lunghi che necessitano lo scarico manuale :
- Simulazione (muoveva Y2 a MaxY2 senza aprire pinza).
- Generazione (non chiudeva rulliere e dava extracorsa e non generava P7=-85).
2026-05-12 13:14:47 +02:00
daniele.nicoli 61fe9ba362 Merge remote-tracking branch 'origin/main' into develop 2026-05-12 13:00:11 +02:00
andrea.villa 300eead9d1 Merge branch 'develop' 2026-03-12 16:12:37 +01:00
andrea.villa caf3739c3f Cambio versione per rilascio a cliente 2026-03-12 16:12:04 +01:00
daniele.nicoli bd04fcb4ab Solo se dY1DeltaMaxSP > WorkTab.dY1DeltaMinF lo prende in considerazione per il valore di WorkTab.dY1DeltaMaxF 2026-03-12 15:55:01 +01:00
andrea.villa 021e841126 - Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito
- Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente
2026-03-12 15:22:46 +01:00
andrea.villa 87f7aad2f0 - Revert modifica fatta al ParkRoller
- Ora calcola la lunghezza del pezzo sulla lavorazioen di  precut con DELTA_LT
2026-03-12 15:14:30 +01:00
daniele.nicoli 5e4ec03149 Merge branch 'Test_Ticket2832' into develop 2026-02-26 16:27:10 +01:00
andrea.villa 8cd863c4b7 Corretto caricamento geometrie di collisioni. Modificato indice di collisione per una migliore gestione 2026-02-26 11:38:19 +01:00
daniele.nicoli 67a45afd0d Corretto calcolo rimanenza durante ParkRoller 2026-02-25 10:18:23 +01:00
daniele.nicoli 66a0e4f2e8 Merge remote-tracking branch 'origin/main' into develop 2026-02-25 10:13:45 +01:00
andrea.villa dba3a45080 Migliorata gestione aggiornamento valori 2026-02-17 10:23:50 +01:00
andrea.villa 7631f4f86c In OnPathStart, la L3o viene salvata sulla L3pp solo se non è nil. Altrimenti si tiene valore vecchio 2026-02-17 09:49:34 +01:00
andrea.villa 34a5cb79b6 Merge remote-tracking branch 'origin/develop' 2026-01-30 13:06:22 +01:00
andrea.villa 6c81d8c21d - Simulazione non allineata a generazione. Mancava reset flag di pezzo a caduta
- Cambio versione per rilascio a cliente
2026-01-30 13:06:11 +01:00
daniele.nicoli 12445313c6 Allineato approccio in simulazione a generazione in caso di lavorazione in doppio verticale 2026-01-19 13:28:37 +01:00
andrea.villa 1164be0cb6 Merge remote-tracking branch 'origin/main' into develop 2026-01-16 15:54:55 +01:00
andrea.villa 651ab27194 Merge commit 'c385253e0bebdd6c5a69dbaacf2a4b639395869f' 2026-01-16 15:54:34 +01:00
andrea.villa c385253e0b Commit per rilascio versione 2026-01-16 15:54:20 +01:00
daniele.nicoli 93701378db Corretto movimento di approccio con sega a catena e allineati Simulazione e Generazione 2026-01-13 11:59:22 +01:00
daniele.nicoli 367fcdce2e Merge branch 'main' into develop 2026-01-13 10:25:13 +01:00
andrea.villa b9f0713dda Cambio versione per rilascio a cliente 2025-12-18 12:05:16 +01:00
andrea.villa 4853f7459f Merge remote-tracking branch 'origin/develop' 2025-12-18 12:04:20 +01:00
daniele.nicoli d3f5b0e7e8 Modifica errori del commit precedente 2025-12-16 11:41:25 +01:00
daniele.nicoli 61b9c86cc4 Divisione movimento B in approccio se > 90°. Risolto Ticket#2485 2025-12-16 11:23:46 +01:00
daniele.nicoli 22c451fde6 Cambiato delta di correzione Z per lama con inclinazione >= 81° da 70 a 60 mm. Risoluzione Ticket#2210 2025-12-16 09:39:50 +01:00
daniele.nicoli 727d1812a1 Aggiunto controllo post movimenti ausiliari dell' EMC.PREVOFFSX nella funzione OnSpecialGetPrevMachiningOffset() come su ONE-PF. Ticket#2727 2025-12-01 17:05:14 +01:00
daniele.nicoli 716a404ea8 Merge branch 'main' into develop 2025-12-01 17:02:11 +01:00
andrea.villa 018bd2d80a Merge branch 'develop' 2025-11-26 09:30:05 +01:00
andrea.villa 6d921cdd39 Commit per rilascio versione 2025-11-26 09:29:55 +01:00
daniele.nicoli 70618a298f - Migliorata funzione CheckClamping, ora il controllo di warning si basa sulla somma delle lunghezze delle aree pinzate
- Aggiornato UpdateLog
2025-11-26 09:22:19 +01:00
andrea.villa 8b1c51b766 Merge branch 'main' into develop 2025-11-25 10:26:10 +01:00
andrea.villa 71ed6a3db4 Merge branch 'main' into develop 2025-11-25 09:49:21 +01:00
5 changed files with 638 additions and 121 deletions
+243 -41
View File
@@ -32,6 +32,10 @@ function OnStart()
EMT.MAXACC = MaxAcc or 6000 -- accelerazione massima pinze. In realtà è il tempo in millisecondi, quindi MAXACC corrisponde al tempo massimo per raggiungere la velocità desiderata EMT.MAXACC = MaxAcc or 6000 -- accelerazione massima pinze. In realtà è il tempo in millisecondi, quindi MAXACC corrisponde al tempo massimo per raggiungere la velocità desiderata
EMT.MINACC = MinAcc or 600 -- accelerazione minima pinze. In realtà è il tempo in millisecondi, quindi MINACC corrisponde al tempo massimo per raggiungere la velocità desiderata EMT.MINACC = MinAcc or 600 -- accelerazione minima pinze. In realtà è il tempo in millisecondi, quindi MINACC corrisponde al tempo massimo per raggiungere la velocità desiderata
SetToParkLine() -- si inizia con linee da parcheggiare su stack SetToParkLine() -- si inizia con linee da parcheggiare su stack
-- se il pezzo dev'essere scaricato al carico
local dUnloadType = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'UNLOAD', 'd')
EMT.UNLOAD = dUnloadType == 1 or dUnloadType == -1
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -289,28 +293,47 @@ function OnDispositionEnd()
-- altrimenti disposizione finale, eventuale scarico pezzo lavorato se non ci sono lavorazioni -- altrimenti disposizione finale, eventuale scarico pezzo lavorato se non ci sono lavorazioni
else else
if #EMT.MDCHAR > 0 then if #EMT.MDCHAR > 0 then
EmitRemark( 'PART UNLOAD') if EMT.AUXTYPE == 'R' and EMT.UNLOAD then
EmitRemark( 'PART UNLOAD ON LOAD POSITION')
else
EmitRemark( 'PART UNLOAD')
end
end end
for i = 1, #EMT.MDCHAR do for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i]) -- Se è un'istruzione del piano ferma pezzo
if EMT.MDCHAR[i].Y1 then EMT.CHY_ON = true end if EMT.MDCHAR[i].StopBeamStat then
if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end EmitStopBeam( EMT.MDCHAR[i])
if EMT.MDCHAR[i].V2 then EMT.V2POS = EMT.MDCHAR[i].V2 end EMT.LASTOISBRAKE = true
else
EmitMoveDataChars( EMT.MDCHAR[i])
if EMT.MDCHAR[i].Y1 then EMT.CHY_ON = true end
if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end
if EMT.MDCHAR[i].V2 then EMT.V2POS = EMT.MDCHAR[i].V2 end
EMT.LASTOISBRAKE = false
end
end end
if #EMT.MDCHAR > 0 then if #EMT.MDCHAR > 0 then
local nMoveType = EgtIf( EMT.CHY_ON, 3, 2) if not EMT.LASTOISBRAKE then
EmitMoveStartChars( nMoveType) local nMoveType = EgtIf( EMT.CHY_ON, 3, 2)
-- se dopo c'è scarico spezzone devo mettere attesa termine esecuzione EmitMoveStartChars( nMoveType)
if IsRestPhase( EMT.PHASE + 1) then -- se dopo c'è scarico spezzone devo mettere attesa termine esecuzione
EmitMoveWaitChars( nMoveType) if IsRestPhase( EMT.PHASE + 1) then
EmitMoveWaitChars( nMoveType)
else
EmitMoveWaitChars( nMoveType, true)
end
else else
EmitMoveWaitChars( nMoveType, true) EMT.LASTOISBRAKE = nil
end end
-- emissione conclusione pezzo precedente (se non in modalità test) -- emissione conclusione pezzo precedente (se non in modalità test)
if not TEST_USE and EMT.PRODID then if not TEST_USE and EMT.PRODID then
local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2' local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2'
MyOutput( sEnd) MyOutput( sEnd)
end end
if EMT.UNLOAD then
MyOutput('M77')
end
end end
EMT.MDCHAR = {} EMT.MDCHAR = {}
EMT.AUXTYPE = nil EMT.AUXTYPE = nil
@@ -358,6 +381,7 @@ function OnRawMoveData()
EMT.HT = b3Part:getDimY() EMT.HT = b3Part:getDimY()
EMT.ST = b3Part:getDimZ() EMT.ST = b3Part:getDimZ()
EMT.HOVM = EgtGetInfo( EMT.RAWID, 'HOVM', 'd') or 0 EMT.HOVM = EgtGetInfo( EMT.RAWID, 'HOVM', 'd') or 0
EMT.XMINT = b3Part:getMin():getX()
EMT.PARTTYPE = 0 EMT.PARTTYPE = 0
local sMaterial = EgtGetInfo( PartId, 'MATERIAL') local sMaterial = EgtGetInfo( PartId, 'MATERIAL')
if sMaterial and sMaterial:find( 'CLT-', 1, true) == 1 then if sMaterial and sMaterial:find( 'CLT-', 1, true) == 1 then
@@ -405,6 +429,7 @@ function OnMachiningStart()
EMT.MCHNAME = EgtGetOperationName( EMT.MCHID) EMT.MCHNAME = EgtGetOperationName( EMT.MCHID)
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE) EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES)
EMT.MCHPRECUT = ( EMT.MCHUSERNOTES:find( 'Precut;', 1, true) ~= nil)
EMT.MCHCUT = ( EMT.MCHUSERNOTES:find( 'Cut;', 1, true) ~= nil) EMT.MCHCUT = ( EMT.MCHUSERNOTES:find( 'Cut;', 1, true) ~= nil)
-- se sega a catena, aggiusto subito angolo scelto per asse virtuale A -- se sega a catena, aggiusto subito angolo scelto per asse virtuale A
@@ -489,6 +514,10 @@ function OnMachiningEnd()
elseif EMT.AUXTYPE == 'U' then elseif EMT.AUXTYPE == 'U' then
EmitRemark( 'PART UNLOAD') EmitRemark( 'PART UNLOAD')
elseif EMT.AUXTYPE == 'P' then elseif EMT.AUXTYPE == 'P' then
local nNextPathId
local nNextMchId
if EMT.PATHID then nNextPathId = EgtGetNextActiveOperation( EMT.PATHID) end
if EMT.MCHID then nNextMchId = EgtGetNextActiveOperation( EMT.MCHID) end
if EMT.PREROT then if EMT.PREROT then
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false) EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true EMT.ZMAX = true
@@ -500,6 +529,12 @@ function OnMachiningEnd()
EMT.TO_ZMAX = nil EMT.TO_ZMAX = nil
end end
EmitRemark( 'PART FALL') EmitRemark( 'PART FALL')
elseif EMT.UNLOAD and not nNextPathId and not nNextMchId then
if not EMT.ZMAX then
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true
end
EmitRemark( 'PART UNLOAD ON LOAD POSITION')
else else
EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false) EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true EMT.ZMAX = true
@@ -508,20 +543,31 @@ function OnMachiningEnd()
end end
end end
for i = 1, #EMT.MDCHAR do for i = 1, #EMT.MDCHAR do
EmitMoveDataChars( EMT.MDCHAR[i]) -- Se è un'istruzione del piano ferma pezzo
if EMT.MDCHAR[i].StopBeamStat then
EmitStopBeam( EMT.MDCHAR[i])
EMT.LASTOISBRAKE = true
else
EmitMoveDataChars( EMT.MDCHAR[i])
EMT.LASTOISBRAKE = false
end
end end
if #EMT.MDCHAR > 0 then if #EMT.MDCHAR > 0 then
if EMT.AUXTYPE == 'S' then if EMT.AUXTYPE == 'S' then
EmitMoveStartChars( 1) if not EMT.LASTOISBRAKE then
EmitMoveWaitChars( 1) EmitMoveStartChars( 1)
EmitMoveWaitChars( 1)
end
elseif EMT.AUXTYPE == 'U' then elseif EMT.AUXTYPE == 'U' then
local nMoveType = EgtIf( EMT.CHY_ON, 3, 2) if not EMT.LASTOISBRAKE then
EmitMoveStartChars( nMoveType) local nMoveType = EgtIf( EMT.CHY_ON, 3, 2)
-- se dopo cè scarico spezzone devo mettere attesa termine esecuzione EmitMoveStartChars( nMoveType)
if IsRestPhase( EMT.PHASE + 1) then -- se dopo cè scarico spezzone devo mettere attesa termine esecuzione
EmitMoveWaitChars( nMoveType) if IsRestPhase( EMT.PHASE + 1) then
else EmitMoveWaitChars( nMoveType)
EmitMoveWaitChars( nMoveType, true) else
EmitMoveWaitChars( nMoveType, true)
end
end end
-- emissione conclusione pezzo precedente (se non è modalità test) -- emissione conclusione pezzo precedente (se non è modalità test)
if not TEST_USE and EMT.PRODID then if not TEST_USE and EMT.PRODID then
@@ -529,8 +575,10 @@ function OnMachiningEnd()
MyOutput( sEnd) MyOutput( sEnd)
end end
elseif EMT.AUXTYPE == 'P' then elseif EMT.AUXTYPE == 'P' then
EmitMoveStartChars( 3) if not EMT.LASTOISBRAKE then
EmitMoveWaitChars( 3) EmitMoveStartChars( 3)
EmitMoveWaitChars( 3)
end
if EMT.FALL then if EMT.FALL then
MyOutput( 'M155') MyOutput( 'M155')
-- emissione conclusione pezzo (se non in modalità test) -- emissione conclusione pezzo (se non in modalità test)
@@ -538,7 +586,13 @@ function OnMachiningEnd()
local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2' local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2'
MyOutput( sEnd) MyOutput( sEnd)
end end
EMT.FALL = nil
elseif not EMT.PREROT then elseif not EMT.PREROT then
-- emissione conclusione pezzo (se non in modalità test)
if not TEST_USE and EMT.PRODID and ( EMT.UNLOAD and ( not nNextPathId) and ( not nNextMchId)) then
local sEnd= 'M113 P1='..tostring( EMT.PRODID)..' P2='..tostring( EMT.PATTID)..' P3='..tostring( EMT.CUTID)..' P4=2'
MyOutput( sEnd)
end
MyOutput( 'M77') MyOutput( 'M77')
end end
end end
@@ -573,12 +627,22 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnPathStart() function OnPathStart()
if EMT.OPEISDISP then
return
end
-- non ancora iniziata la lavorazione -- non ancora iniziata la lavorazione
EMT.MCHFIRST = true EMT.MCHFIRST = true
EMT.MCHFIRSTFEED = true EMT.MCHFIRSTFEED = true
-- primo posizionamento sempre in globale -- primo posizionamento sempre in globale
EMT.REFLOC = nil EMT.REFLOC = nil
EMT.IPLGL = false EMT.IPLGL = false
-- se taglio di precut verifico quanto è più lungo il grezzo rispetto al pezzo (non tiene conto dell'ultimo cubetto)
EMT.DELTA_LT = 0
if EMT.MCHPRECUT then
local dCosA = sqrt( max( 1 - EMT.EXTR[1] * EMT.EXTR[1], 0))
EMT.DELTA_LT = max( EMT.XMINT - Point3d( EMT.MMAX):getX() - dCosA * EMT.TDIAM / 2, 0)
end
-- leggo se ancora presa iniziale carrello -- leggo se ancora presa iniziale carrello
--EMT.CNT = EgtGetInfo( EMT.PATHID, 'CNT', 'i') --EMT.CNT = EgtGetInfo( EMT.PATHID, 'CNT', 'i')
--MyOutput( 'CNT='.. tostring( EMT.CNT or 0)) --MyOutput( 'CNT='.. tostring( EMT.CNT or 0))
@@ -602,6 +666,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnPathEnd() function OnPathEnd()
if EMT.OPEISDISP then
return
end
if not EMT.ZMAX then if not EMT.ZMAX then
EmitResetMachining() EmitResetMachining()
end end
@@ -770,7 +837,15 @@ function OnRapid()
EmitMoveDataHead( 1, { B=0, S=Speed}) EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed}) EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed}) EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, 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=EMT.L3, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
end
-- caso standard -- caso standard
else else
-- se bisogna scrivere tutti gli assi -- se bisogna scrivere tutti gli assi
@@ -1084,7 +1159,15 @@ function OnRapid()
EmitMoveDataHead( 1, { Z=MyMaxZ1, B=0, S=Speed}) EmitMoveDataHead( 1, { Z=MyMaxZ1, B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed}) EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed}) EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, 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=EMT.L3, B=dBref, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
else
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
end
-- caso standard -- caso standard
else else
-- se ero in posizione speciale, prima ruoto poi scendo -- se ero in posizione speciale, prima ruoto poi scendo
@@ -1105,16 +1188,24 @@ function OnRapid()
-- altrimenti sega a catena -- altrimenti sega a catena
else else
-- se bisogna scrivere tutti gli assi -- se bisogna scrivere tutti gli assi
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
if WriteAllCoordsOnFirstM101 then if WriteAllCoordsOnFirstM101 then
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=dSafeZ1, B=HomeB1, C=HomeC1, TRad=dTRad, TLen=dTLen, S=Speed}) EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=dSafeZ1, B=HomeB1, C=HomeC1, TRad=dTRad, TLen=dTLen, S=Speed})
end end
-- Porto la Z alla giusta quota -- Porto la Z alla giusta quota
if EMT.L3 > HomeZ1 + 1 and abs( EMT.R2) > 89.9 then if EMT.L3 > dSafeZ1 + 1 and abs( EMT.R2) > 89.9 then
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed}) EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=HomeZ1, S=Speed}) EmitMoveDataHead( 1, { Z=dSafeZ1, S=Speed})
end
local dChSawEncumbrance = EMT.L3 + MillOffs - ( ( ChSawLen + MillOffs) * EMT.ADIR[3]) - ( EMT.TTOTLEN * EMT.TDIR[3])
local dBeamQuote = DeltaTabZ + EMT.SB + 30
if dChSawEncumbrance < dBeamQuote then
EmitMoveDataHead( 1, { Z=dSafeZ1, B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
else
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
end end
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
-- se motosega molto lunga, ruoto prima di muovermi in X -- se motosega molto lunga, ruoto prima di muovermi in X
if EMT.TTOTLEN >= MinLengthLongCSaw then if EMT.TTOTLEN >= MinLengthLongCSaw then
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed}) EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
@@ -1930,20 +2021,40 @@ function PrepareResidue( sCmd, nInd)
else else
EMT.UNL = true EMT.UNL = true
end end
-- se è scarico al carico
if Cmd[2] == 'Unload-On-Load' then
EMT.UNL2 = true
end
elseif Cmd[1] == '1' then elseif Cmd[1] == '1' then
if Cmd[2] ~= 'Z' then if Cmd[2] ~= 'Z' then
local MDChar local MDChar
if not EMT.UNL then if not EMT.UNL then
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV} MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV}
else else
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY2=1, FinStatY2=-84, BeamVise=0} if IsLastMachining( EMT.MCHID) then
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY2=1, FinStatY2=-84, V2=ParkV2, BeamVise=0}
else
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY2=1, FinStatY2=-84, BeamVise=0}
end
end end
if EMT.ROLL_IN then if EMT.ROLL_IN then
MDChar.V1 = MinV1 ; EMT.V1POS = MDChar.V1 MDChar.V1 = MinV1 ; EMT.V1POS = MDChar.V1
MDChar.V2 = MaxV2 ; EMT.V2POS = MDChar.V2 MDChar.V2 = MaxV2 ; EMT.V2POS = MDChar.V2
EMT.ROLL_IN = nil EMT.ROLL_IN = nil
end end
-- se scarico al carico parcheggio per sicurezza morsa e paratia lato scarico
if EMT.UNL2 then
MDChar.V1 = ParkV1 ; EMT.V1POS = MDChar.V1
MDChar.V2 = ParkV2 ; EMT.V2POS = MDChar.V2
MDChar.BeamVise = 0
end
table.insert( EMT.MDCHAR, MDChar) table.insert( EMT.MDCHAR, MDChar)
-- Se scarico in linea con abbassamento piano ferma pezzo allo scarico
if Cmd[4] == 'UnBrakeBeam' then
-- Abbassa ferma pezzo
local MDStopBeam = { StopBeamStat=2, Load=1}
table.insert( EMT.MDCHAR, MDStopBeam)
end
end end
elseif Cmd[1] == '2' then elseif Cmd[1] == '2' then
local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV2=1, BeamVise=EMT.BV} local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV2=1, BeamVise=EMT.BV}
@@ -1955,6 +2066,11 @@ function PrepareResidue( sCmd, nInd)
EMT.ROLL_IN = nil EMT.ROLL_IN = nil
end end
table.insert( EMT.MDCHAR, MDChar) table.insert( EMT.MDCHAR, MDChar)
-- Alza ferma pezzo
if Cmd[6] == 'BrakeBeam' then
local MDStopBeam = { StopBeamStat=1, Load=1}
table.insert( EMT.MDCHAR, MDStopBeam)
end
elseif Cmd[1] == '3' then elseif Cmd[1] == '3' then
local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV1=1, IniStatV2=1, BeamVise=EMT.BV} local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV1=1, IniStatV2=1, BeamVise=EMT.BV}
if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end
@@ -2036,20 +2152,58 @@ function PrepareUnload( sCmd, nInd)
local Cmd = EgtSplitString( sCmd) local Cmd = EgtSplitString( sCmd)
if Cmd[1] == '0' then if Cmd[1] == '0' then
-- non interessa if Cmd[3] == 'Manual Unloading' then
EMT.MANUAL_UNL = true
end
elseif Cmd[1] == '1' then elseif Cmd[1] == '1' then
if Cmd[2] == 'Y2' then if Cmd[2] == 'Y2' then
-- se non è ultima fase e non è fase successiva a scarico su carico c'è una barra sulla pinza Y1
local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE)) local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE))
local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=-84, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)} -- Se scarico in linea con abbassamento piano ferma pezzo allo scarico
table.insert( EMT.MDCHAR, MDChar) if Cmd[4] == 'UnBrakeBeam' then
-- Muove carrello aperto e lo mantiene aperto
local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=1, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
-- Abbassa ferma pezzo
local MDStopBeam = { StopBeamStat=2, Unload=1}
table.insert( EMT.MDCHAR, MDStopBeam)
-- Dopo che si è abbassato il ferma pezzo chiude il pezzo in morsa per evitare che esso possa essere pinzato inclinato dal pistone
MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=-1, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
-- Se non è ultima fase e non è fase successiva a scarico su carico c'è una barra sulla pinza Y1
else
if EMT.MANUAL_UNL then
-- se non è ultima fase e non è fase successiva a scarico su carico c'è una barra sulla pinza Y1
local dUnloadMacroCode = EgtIf( EMT.MANUAL_UNL, 85, 84)
EMT.MANUAL_UNL = nil
local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE))
local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=-dUnloadMacroCode, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
else
local nFinStatY2 = EgtIf( Cmd[4] == 'NoWaitUnload', -84, -1)
local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=nFinStatY2, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
end
end
end end
elseif Cmd[1] == '2' then elseif Cmd[1] == '2' then
if Cmd[4] == 'Y2' then if Cmd[4] == 'Y2' then
-- se non è ultima fase c'è una barra sulla pinza Y1
local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE)) local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE))
local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)} -- Se scarico in linea con alzata piano ferma pezzo allo scarico
table.insert( EMT.MDCHAR, MDChar) if Cmd[6] == 'BrakeBeam' then
-- Muove carrello e lo mantiene in presa
local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=-1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
-- Alza ferma pezzo
local MDStopBeam = { StopBeamStat=1, Unload=1}
table.insert( EMT.MDCHAR, MDStopBeam)
-- Ribadisce le quote del carrello appena mosso e Apre la pinza
MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
-- se non è ultima fase c'è una barra sulla pinza Y1
else
local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)}
table.insert( EMT.MDCHAR, MDChar)
end
end end
elseif Cmd[1] == '3' then elseif Cmd[1] == '3' then
-- non interessa -- non interessa
@@ -2083,27 +2237,55 @@ function PreparePreRotation( sCmd, nInd)
EMT.PREROT = true EMT.PREROT = true
elseif Cmd[2] == 'SplitRot' then elseif Cmd[2] == 'SplitRot' then
EMT.SPLITROT = true EMT.SPLITROT = true
-- se è scarico al carico
elseif Cmd[2] == 'Unload-On-Load' then
EMT.UNL2 = true
end end
elseif Cmd[1] == '1' then elseif Cmd[1] == '1' then
if Cmd[2] ~= 'Z' then if Cmd[2] ~= 'Z' then
local MDChar local MDChar
if not EMT.PREROT then if not EMT.PREROT then
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV} MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV}
if EMT.UNL2 then
MDChar.V1 = ParkV1 ; EMT.V1POS = MDChar.V1
MDChar.V2 = ParkV2 ; EMT.V2POS = MDChar.V2
end
else else
MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=86, FinStatY1=87, IniStatY2=1, BeamVise=0} MDChar = { [Cmd[2]]=tonumber(Cmd[3]), IniStatY1=86, FinStatY1=87, IniStatY2=1, BeamVise=0}
end end
table.insert( EMT.MDCHAR, MDChar) table.insert( EMT.MDCHAR, MDChar)
-- Se scarico in linea con abbassamento piano ferma pezzo allo scarico
if Cmd[4] == 'UnBrakeBeam' then
-- Abbassa ferma pezzo
local MDStopBeam = { StopBeamStat=2, Load=1}
table.insert( EMT.MDCHAR, MDStopBeam)
end
end end
elseif Cmd[1] == '2' then elseif Cmd[1] == '2' then
local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV} local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV2=1, BeamVise=EMT.BV}
if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end
if Cmd[4] ~= 'T' then MDChar[Cmd[4]] = tonumber( Cmd[5]) end if Cmd[4] ~= 'T' then MDChar[Cmd[4]] = tonumber( Cmd[5]) end
if EMT.ROLL_IN then
MDChar.V1 = MinV1 ; EMT.V1POS = MDChar.V1
MDChar.V2 = MaxV2 ; EMT.V2POS = MDChar.V2
EMT.ROLL_IN = nil
end
table.insert( EMT.MDCHAR, MDChar) table.insert( EMT.MDCHAR, MDChar)
-- Alza ferma pezzo
if Cmd[6] == 'BrakeBeam' then
local MDStopBeam = { StopBeamStat=1, Load=1}
table.insert( EMT.MDCHAR, MDStopBeam)
end
elseif Cmd[1] == '3' then elseif Cmd[1] == '3' then
local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, BeamVise=EMT.BV} local MDChar = { IniStatY1=EMT.ISY1, FinStatY1=EMT.FSY1, IniStatY2=EMT.ISY2, FinStatY2=EMT.FSY2, IniStatV1=1, IniStatV2=1, BeamVise=EMT.BV}
if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end if Cmd[2] ~= 'T' then MDChar[Cmd[2]] = tonumber( Cmd[3]) end
if Cmd[4] ~= 'T' then MDChar[Cmd[4]] = tonumber( Cmd[5]) end if Cmd[4] ~= 'T' then MDChar[Cmd[4]] = tonumber( Cmd[5]) end
if Cmd[6] ~= 'T' then MDChar[Cmd[6]] = tonumber( Cmd[7]) end if Cmd[6] ~= 'T' then MDChar[Cmd[6]] = tonumber( Cmd[7]) end
if EMT.ROLL_IN then
MDChar.V1 = MinV1 ; EMT.V1POS = MDChar.V1
MDChar.V2 = MaxV2 ; EMT.V2POS = MDChar.V2
EMT.ROLL_IN = nil
end
table.insert( EMT.MDCHAR, MDChar) table.insert( EMT.MDCHAR, MDChar)
elseif Cmd[1] == '4' then elseif Cmd[1] == '4' then
EMT.TO_ZMAX = true EMT.TO_ZMAX = true
@@ -2199,6 +2381,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function GetV1ToCloseTPA() function GetV1ToCloseTPA()
if EMT.MCHPRECUT or EMT.MCHCUT then
return false
end
local dMaxHeadPos = EMT.MAXMAX[1] + ( EMT.HOVM or 0) - ( EMT.X_OFF or 0) local dMaxHeadPos = EMT.MAXMAX[1] + ( EMT.HOVM or 0) - ( EMT.X_OFF or 0)
local dMinTailPos = EMT.MAXMIN[1] + EMT.LB + EgtIf( IsStartOrMidPhase( EMT.PHASE), 0, ( EMT.HOVM or 0)) - ( EMT.X_OFF or 0) local dMinTailPos = EMT.MAXMIN[1] + EMT.LB + EgtIf( IsStartOrMidPhase( EMT.PHASE), 0, ( EMT.HOVM or 0)) - ( EMT.X_OFF or 0)
--MyOutput( string.format( 'V1 MaxHeadPos=%.3f MinTailPos=%.3f BarLen=%.3f HeadOvm=%.3f V1NextPos=%.3f', dMaxHeadPos, dMinTailPos, EMT.LB, ( EMT.HOVM or 0), EMT.V1NEXTPOS)) --MyOutput( string.format( 'V1 MaxHeadPos=%.3f MinTailPos=%.3f BarLen=%.3f HeadOvm=%.3f V1NextPos=%.3f', dMaxHeadPos, dMinTailPos, EMT.LB, ( EMT.HOVM or 0), EMT.V1NEXTPOS))
@@ -2686,8 +2871,8 @@ function EmitParkRoller( dPosT, bSplitCut)
local dPosY2 = dPosT + EMT.Y2DELTA local dPosY2 = dPosT + EMT.Y2DELTA
local DiffY2 = MyParkY2 - dPosY2 local DiffY2 = MyParkY2 - dPosY2
local dMoveY2 = EgtIf( DiffY2 < -0.1, dMoveV2, 0) local dMoveY2 = EgtIf( DiffY2 < -0.1, dMoveV2, 0)
local dTryMoveY2 = max( ParkV2 - dPosT - EMT.LT - EMT.HOVM, MinY2 - dPosY2 + 10) local dTryMoveY2 = max( ParkV2 - dPosT - EMT.LT - EMT.DELTA_LT - EMT.HOVM, MinY2 - dPosY2 + 10)
if ( dPosT + EMT.LT + EMT.HOVM < ParkV1 + ExtraParkV and dPosT + EMT.LT + EMT.HOVM > ParkV2 and dPosY2 + dTryMoveY2 > MinY2) then dMoveY2 = min( dMoveY2, dTryMoveY2) end if ( dPosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM < ParkV1 + ExtraParkV and dPosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM > ParkV2 and dPosY2 + dTryMoveY2 > MinY2) then dMoveY2 = min( dMoveY2, dTryMoveY2) end
--MyOutput( string.format( 'PosT=%.3f LT=%.3f PosY2=%.3f V2POS=%.3f', dPosT, EMT.LT, dPosY2, EMT.V2POS)) --MyOutput( string.format( 'PosT=%.3f LT=%.3f PosY2=%.3f V2POS=%.3f', dPosT, EMT.LT, dPosY2, EMT.V2POS))
MDChar.Y2 = dPosY2 + dMoveY2 MDChar.Y2 = dPosY2 + dMoveY2
MDChar.MovType = 2 MDChar.MovType = 2
@@ -3001,6 +3186,23 @@ function EmitMoveWaitHead( nHead)
MyOutput( sOut) MyOutput( sOut)
end end
---------------------------------------------------------------------
-- Emette i movimenti di esecuzione movimenti trave e alzata o discesa del piano ferma pezzo
function EmitStopBeam( MoData)
if MoData.StopBeamStat then
if MoData.Load then
EmitMoveStartChars( 3)
EmitMoveWaitChars( 3)
sOut = 'M125 P1=' .. EgtNumToString( MoData.StopBeamStat, 0)
else
EmitMoveStartChars( 2)
EmitMoveWaitChars( 2)
sOut = 'M125 P2=' .. EgtNumToString( MoData.StopBeamStat, 0)
end
end
MyOutput( sOut)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function EmitMoveDataChars( MoData) function EmitMoveDataChars( MoData)
local sOut = 'M111' local sOut = 'M111'
+130 -48
View File
@@ -160,10 +160,10 @@ function OnSimulStart()
local nId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( nGrpId, McdData[i].Sub), McdData[i].Name) local nId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( nGrpId, McdData[i].Sub), McdData[i].Name)
if nId then if nId then
table.insert( EMT.MCODET, nId) table.insert( EMT.MCODET, nId)
EgtOutLog( 'Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' (' .. tostring( nId) .. ') is ok', 4) EgtOutLog( ' Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' (' .. tostring( nId) .. ') is ok', 4)
else else
nMcdNullCnt = nMcdNullCnt + 1 nMcdNullCnt = nMcdNullCnt + 1
EgtOutLog( 'Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' is null', 4) EgtOutLog( ' Element ' .. McdData[i].Grp .. '/' .. McdData[i].Sub .. '/' .. McdData[i].Name .. ' is null', 4)
end end
end end
if nMcdNullCnt > 0 then if nMcdNullCnt > 0 then
@@ -352,6 +352,10 @@ function OnSimulDispositionStart()
EMT.LB = b3Bar:getDimX() EMT.LB = b3Bar:getDimX()
EMT.LR = b3Raw:getDimX() EMT.LR = b3Raw:getDimX()
EMT.LT = b3Part:getDimX() EMT.LT = b3Part:getDimX()
if b3Part:getMin() then
EMT.XMINT = b3Part:getMin():getX() + ( EgtGetAxisPos( 'T') - EgtGetAxisHomePos( 'T'))
end
EMT.HOVM = EgtGetInfo( nPartRawId or GDB_ID.NULL, 'HOVM', 'd') or 0
EMT.CUTID = EgtGetInfo( EgtGetFirstPartInRawPart( nPartRawId or GDB_ID.NULL) or GDB_ID.NULL, 'CUTID', 'i') or 0 EMT.CUTID = EgtGetInfo( EgtGetFirstPartInRawPart( nPartRawId or GDB_ID.NULL) or GDB_ID.NULL, 'CUTID', 'i') or 0
EMT.Y1SPEC = nil EMT.Y1SPEC = nil
-- se vero inizio, assegno solidi per verifica collisione -- se vero inizio, assegno solidi per verifica collisione
@@ -484,10 +488,12 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnSimulToolSelect( dPosA) function OnSimulToolSelect( dPosA)
EgtOutLog( '===> ToolSelect : Reset CollisionObj', 4)
-- se utensile non definito, è disposizione ed esco -- se utensile non definito, è disposizione ed esco
if EMT.TOOL == '' then return end if EMT.TOOL == '' then return end
-- recupero dati utensile -- recupero dati utensile
EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE) EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN) EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
@@ -575,9 +581,9 @@ function OnSimulToolSelect( dPosA)
-- se attivo Collision Check -- se attivo Collision Check
EMT.SAFEDIST = COLL_SAFE_DIST EMT.SAFEDIST = COLL_SAFE_DIST
if EMT.COLLOBJ then if EMT.COLLOBJ then
local nInd = EgtIf( nSetHead ~= 2, 1001, 1011) local nInd = 1000 + tonumber( string.sub( EMT.HEAD, 2))
AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd, true) AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd, true)
AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd + 1) AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd + 100)
for i, Coll in ipairs( EMT.COLLOBJ or {}) do for i, Coll in ipairs( EMT.COLLOBJ or {}) do
EmtAddCollisionObjEx( i, Coll.Fr, Coll.Ty, Coll.Mv, Coll.P1, Coll.P2, Coll.P3) EmtAddCollisionObjEx( i, Coll.Fr, Coll.Ty, Coll.Mv, Coll.P1, Coll.P2, Coll.P3)
end end
@@ -736,8 +742,9 @@ function OnSimulToolDeselect( dPrevA)
-- prendo utensile lama su aggregato -- prendo utensile lama su aggregato
elseif EMT.NEXTHEAD == 'H22' then elseif EMT.NEXTHEAD == 'H22' then
-- aggiungo utensile per verifica collisione -- aggiungo utensile per verifica collisione
AddToolToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, 1011, false) local nInd = 1000 + tonumber( string.sub( EMT.NEXTHEAD, 2))
AddToolHolderToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, 1011 + 1) AddToolToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, nInd, false)
AddToolHolderToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, nInd + 100)
-- simulo movimento -- simulo movimento
SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkSawC2, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkSawC2, MCH_SIM_STEP.COLLROT)
@@ -746,6 +753,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnSimulMachiningStart() function OnSimulMachiningStart()
EgtOutLog( '===> Start Machining : ' .. EgtGetName( EMT.MCHID), 4)
-- se lavorazione è con gruppo a forare, abilito le altre punte alla lavorazione del VMILL -- se lavorazione è con gruppo a forare, abilito le altre punte alla lavorazione del VMILL
if EMT.HEAD == 'H14' then if EMT.HEAD == 'H14' then
local OtherTools = EgtGetToolsInCurrSetupPos( 'T121') local OtherTools = EgtGetToolsInCurrSetupPos( 'T121')
@@ -754,7 +762,7 @@ function OnSimulMachiningStart()
if OtherTools[i] ~= '' and OtherTools[i] ~= EMT.TOOL then if OtherTools[i] ~= '' and OtherTools[i] ~= EMT.TOOL then
EmtAddToolForVmill( OtherTools[i], 'H14', i, EMT.VMILL) EmtAddToolForVmill( OtherTools[i], 'H14', i, EMT.VMILL)
-- dichiaro utensile per verifica collisioni -- dichiaro utensile per verifica collisioni
local nInd = 1011 local nInd = 1000 + tonumber( string.sub( 'H14', 2))
AddToolToCollisionObj( OtherTools[i], 'H14', i, nInd, true) AddToolToCollisionObj( OtherTools[i], 'H14', i, nInd, true)
end end
end end
@@ -796,6 +804,8 @@ function OnSimulMachiningStart()
EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and not EMT.MCHUSERNOTES:find( 'VMRS=0;', 1, true)) EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and not EMT.MCHUSERNOTES:find( 'VMRS=0;', 1, true))
EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil) EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil)
EMT.MCHPRECUT = ( EMT.MCHUSERNOTES:find( 'Precut;', 1, true) ~= nil)
EMT.MCHCUT = ( EMT.MCHUSERNOTES:find( 'Cut;', 1, true) ~= nil)
-- recupero TASKID e CUTID della feature lavorata (CUTID va recuperato qui per le pareti) -- recupero TASKID e CUTID della feature lavorata (CUTID va recuperato qui per le pareti)
local vId = EgtGetMachiningGeometry() local vId = EgtGetMachiningGeometry()
if vId and #vId > 0 and #vId[1] > 0 then if vId and #vId > 0 and #vId[1] > 0 then
@@ -821,9 +831,9 @@ function OnSimulMachiningStart()
-- dichiaro utensile per Vmill -- dichiaro utensile per Vmill
EmtAddToolForVmill( sDouTool, sDouHead, nDouExit, EMT.VMILL) EmtAddToolForVmill( sDouTool, sDouHead, nDouExit, EMT.VMILL)
-- dichiaro utensile per verifica collisioni -- dichiaro utensile per verifica collisioni
local nInd = 1011 local nInd = 1000 + tonumber( string.sub( sDouHead, 2))
AddToolToCollisionObj( sDouTool, sDouHead, nDouExit, nInd, true) AddToolToCollisionObj( sDouTool, sDouHead, nDouExit, nInd, true)
AddToolHolderToCollisionObj( sDouTool, sDouHead, nDouExit, nInd + 1) AddToolHolderToCollisionObj( sDouTool, sDouHead, nDouExit, nInd + 100)
-- salvo dati -- salvo dati
EMT.DOU_TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN) EMT.DOU_TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.DOU_TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) EMT.DOU_TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
@@ -840,19 +850,17 @@ function OnSimulMachiningStart()
local nSetHead = GetHeadSet( EMT.HEAD) local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead ~= 1 and ( EMT.PREVTOOL_H1 and EMT.PREVHEAD_H1) then if nSetHead ~= 1 and ( EMT.PREVTOOL_H1 and EMT.PREVHEAD_H1) then
local nPrevExit_H1 = 1 local nPrevExit_H1 = 1
local nInd_H1 = 1001 local nInd_H1 = 1000 + tonumber( string.sub( EMT.PREVHEAD_H1, 2))
AddToolToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1, true) AddToolToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1, true)
AddToolHolderToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1 + 1) AddToolHolderToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1 + 100)
end end
if nSetHead ~= 2 and ( EMT.PREVTOOL_H2 and EMT.PREVHEAD_H2) then if nSetHead ~= 2 and ( EMT.PREVTOOL_H2 and EMT.PREVHEAD_H2) then
local nPrevExit_H2 = 1 local nPrevExit_H2 = 1
local nInd_H2 = 1011 local nInd_H2 = 1000 + tonumber( string.sub( EMT.PREVHEAD_H2, 2))
AddToolToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2, true) AddToolToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2, true)
AddToolHolderToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2 + 1) AddToolHolderToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2 + 100)
end end
if nSetHead ~= 3 and IsHeadExisting( 3) then if nSetHead ~= 3 and IsHeadExisting( 3) then
local nPrevExit_H3 = 1
local nInd_H3 = 1001
local sHeadName local sHeadName
if EgtGetHeadId( 'H39') then if EgtGetHeadId( 'H39') then
sHeadName = 'H39' sHeadName = 'H39'
@@ -861,8 +869,10 @@ function OnSimulMachiningStart()
else else
EmtSetLastError( 1212, "HEAD not managed") EmtSetLastError( 1212, "HEAD not managed")
end end
AddToolToCollisionObj( nil, sHeadName, nPrevExit_H3, 1001) local nPrevExit_H3 = 1
AddToolHolderToCollisionObj( nil, sHeadName, nPrevExit_H3, 1002) local nInd_H3 = 1000 + tonumber( string.sub( sHeadName, 2))
AddToolToCollisionObj( nil, sHeadName, nPrevExit_H3, nInd_H3)
AddToolHolderToCollisionObj( nil, sHeadName, nPrevExit_H3, nInd_H3 + 100)
end end
end end
-- se precedente in doppio ma ora solo testa 1 e non in sicurezza -- se precedente in doppio ma ora solo testa 1 e non in sicurezza
@@ -933,6 +943,17 @@ function OnSimulPathStart()
EMT.TO_FALL = true EMT.TO_FALL = true
end end
end end
-- dump oggetti di collisione
if DumpCollisionObj then
DumpCollisionObj( ' ==> CollisionObj :', 4)
end
-- se taglio di precut verifico quanto è più lungo il grezzo rispetto al pezzo (non tiene conto dell'ultimo cubetto)
EMT.DELTA_LT = 0
if EMT.MCHPRECUT then
local dCosA = sqrt( max( 1 - EMT.EXTR[1] * EMT.EXTR[1], 0))
EMT.DELTA_LT = max( EMT.XMINT - Point3d( EMT.MMAX):getX() - dCosA * EMT.TDIAM / 2, 0)
EgtOutLog( 'PreCutDeltaLT='..EgtNumToString( EMT.DELTA_LT, 3), 5)
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -1068,7 +1089,15 @@ function OnSimulMoveStart()
SimulMoveAxes( 'Z1', MyMaxZ1, MCH_SIM_STEP.RAPID, 'B1', 0, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'Z1', MyMaxZ1, MCH_SIM_STEP.RAPID, 'B1', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT) SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'Z1', EMT.L3, 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', EMT.L3, MCH_SIM_STEP.RAPID, 'B1', dBref, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
-- caso standard -- caso standard
else else
-- se bisogna scrivere tutti gli assi -- se bisogna scrivere tutti gli assi
@@ -1094,14 +1123,24 @@ function OnSimulMoveStart()
end end
-- altrimenti sega a catena -- altrimenti sega a catena
else else
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
-- Porto la Z alla giusta quota -- Porto la Z alla giusta quota
if Z1Pos > Z1Home + 1 and abs( B1Pos) > 89.9 then if Z1Pos > dSafeZ1 + 1 and abs( B1Pos) > 89.9 then
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', Z1Home, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z1', dSafeZ1, MCH_SIM_STEP.RAPID)
end end
-- se movimento iniziale da Zmax -- se movimento iniziale da Zmax
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
SimulMoveAxes( 'Z1', Z1Home, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT) local dChSawEncumbrance = EMT.L3 + MillOffs - ( ( ChSawLen + MillOffs) * EMT.ADIR[3]) - ( EMT.TTOTLEN * EMT.TDIR[3])
local dBeamQuote = DeltaTabZ + EMT.SB + 30
if dChSawEncumbrance < dBeamQuote then
SimulMoveAxes( 'Z1', dSafeZ1, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'X1', EMT.L2, MCH_SIM_STEP.RAPID, 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
else
SimulMoveAxes( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
end
-- se motosega molto lunga, ruoto prima di muovermi in X -- se motosega molto lunga, ruoto prima di muovermi in X
if EMT.TTOTLEN >= MinLengthLongCSaw then if EMT.TTOTLEN >= MinLengthLongCSaw then
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT) SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
@@ -1231,7 +1270,7 @@ function OnSimulMoveStart()
EMT.A6 = EgtClamp( Z2, MinZ2, MaxZ2) EMT.A6 = EgtClamp( Z2, MinZ2, MaxZ2)
-- dato che la testa 2 è slave, bisogna controllare eventuale extra-corsa da post -- dato che la testa 2 è slave, bisogna controllare eventuale extra-corsa da post
if not( EMT.MOVE == 0 and EMT.FLAG == 2) and Z2 > MaxZ2 then if not( EMT.MOVE == 0 and EMT.FLAG == 2) and Z2 > MaxZ2 then
local sErr = EMT.MCHNAME..' ==> Out of Stroke: Z2 : '.. EgtNumToString( dZ2-MaxZ2, 2) local sErr = EMT.MCHNAME..' ==> Out of Stroke: Z2 : '.. EgtNumToString( Z2-MaxZ2, 2)
EmtSetLastError( 1220, sErr, true) EmtSetLastError( 1220, sErr, true)
EgtOutBox( sErr, 'ERROR') EgtOutBox( sErr, 'ERROR')
end end
@@ -1284,6 +1323,12 @@ function OnSimulMoveStart()
local sErr = 'Z1 Z2 tools in collision (distance=' .. EgtNumToString( dDistToolZ1Z2, 1) .. ')' local sErr = 'Z1 Z2 tools in collision (distance=' .. EgtNumToString( dDistToolZ1Z2, 1) .. ')'
EmtSetLastError( 1208, sErr) EmtSetLastError( 1208, sErr)
end end
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local B2Home = EgtGetAxisHomePos( 'B2')
local C2Home = EgtGetAxisHomePos( 'C2')
SimulMoveAxes( 'X2', SafeX2, MCH_SIM_STEP.RAPID, 'C2', C2Home, MCH_SIM_STEP.RAPROT, 'B2', B2Home, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X2', X2, MCH_SIM_STEP.RAPID)
end
end end
end end
-- se necessario ... -- se necessario ...
@@ -1421,10 +1466,10 @@ function OnSimulCollision()
return return
end end
local Class = '' local Class = ''
if EMT.SIMCOBIND == 1001 or EMT.SIMCOBIND == 1011 then if EMT.SIMCOBIND > 1000 and EMT.SIMCOBIND < 1099 then
Class = 'T_'..EMT.HEAD Class = 'T_H'.. tostring( EMT.SIMCOBIND - 1000)
elseif EMT.SIMCOBIND == 1002 or EMT.SIMCOBIND == 1012 then elseif EMT.SIMCOBIND > 1100 and EMT.SIMCOBIND < 1199 then
Class = 'TH_'..EMT.HEAD Class = 'TH_H'..tostring( EMT.SIMCOBIND - 1100)
else else
Class = EMT.COLLOBJ[EMT.SIMCOBIND].Cl Class = EMT.COLLOBJ[EMT.SIMCOBIND].Cl
end end
@@ -1723,17 +1768,36 @@ function ExecUnloading()
local vMillId = EMT.VMILL[1] local vMillId = EMT.VMILL[1]
-- gruppo dei Vmill -- gruppo dei Vmill
local nVmGrpId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill') local nVmGrpId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill')
local sUnloadType = ''
local sUnloadTypeOld = ''
local vtMove = Vector3d( 0, 0, 0)
local vtMoveOldElements = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, ( EMT.HB + 50.0), -( EMT.HB + 50.0)), 0)
-- Se scarico in linea
if MinBeamLenUnloadInLine and EMT.LT >= MinBeamLenUnloadInLine then
sUnloadType = 'LINE'
vtMove = Vector3d( EgtIf( BD.RIGHT_LOAD, -MinBeamLenUnloadInLine, MinBeamLenUnloadInLine), EgtIf( BD.RIGHT_LOAD, ( EMT.HB + 50.0), -( EMT.HB + 50.0)), 0)
else
if EMT.FALL then
sUnloadType = 'FALL'
vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 3200, -2600), -1150)
else
sUnloadType = 'STD'
vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 1600, -1600), 0)
end
end
-- li sposto per lasciare spazio al nuovo pezzo -- li sposto per lasciare spazio al nuovo pezzo
local nId = EgtGetFirstInGroup( nVmGrpId) local nId = EgtGetFirstInGroup( nVmGrpId)
while nId do while nId do
EgtMove( nId, Vector3d( 0, EgtIf( BD.RIGHT_LOAD, ( EMT.HB + 50.0), -( EMT.HB + 50.0)), 0), GDB_RT.GLOB) sUnloadTypeOld = EgtGetInfo( nId, 'UNLOAD_TYPE')
if sUnloadTypeOld == sUnloadType then
EgtMove( nId, vtMoveOldElements, GDB_RT.GLOB)
end
nId = EgtGetNext( nId) nId = EgtGetNext( nId)
end end
-- creo un nuovo layer e vi inserisco il nuovo pezzo -- creo un nuovo layer e vi inserisco il nuovo pezzo
local nLayId = EgtGroup( nVmGrpId, EgtGetGlobFrame( vMillId)) local nLayId = EgtGroup( nVmGrpId, EgtGetGlobFrame( vMillId))
EgtRelocate( vMillId, nLayId) EgtRelocate( vMillId, nLayId)
local vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 1600, -1600), 0) EgtSetInfo( nLayId, 'UNLOAD_TYPE', sUnloadType)
if EMT.FALL then vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 3200, -2600), -1150) end
EgtMove( nLayId, vtMove, GDB_RT.GLOB) EgtMove( nLayId, vtMove, GDB_RT.GLOB)
EgtSetLevel( vMillId, GDB_LV.USER) EgtSetLevel( vMillId, GDB_LV.USER)
-- aggiungo gli spigoli -- aggiungo gli spigoli
@@ -1819,24 +1883,29 @@ function CheckClamping( sClampName)
-- si copia curva intersezione e curva pinza in gruppo di confronto -- si copia curva intersezione e curva pinza in gruppo di confronto
local idFlatSurf, nFlatSurfCnt = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idCurveList) local idFlatSurf, nFlatSurfCnt = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idCurveList)
local idClampSurf = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idClampPath) local idClampSurf = EgtSurfFlatRegion( CLAMP_CHECK_GROUP, idClampPath)
if idFlatSurf then if idFlatSurf then
local dTotalArea = 0 local dTotalArea = 0
local dTotalXLenght = 0
for k = 1, nFlatSurfCnt do for k = 1, nFlatSurfCnt do
local idTempSurf = idFlatSurf + k - 1 local idTempSurf = idFlatSurf + k - 1
EgtSurfFrIntersect( idTempSurf, idClampSurf) EgtSurfFrIntersect( idTempSurf, idClampSurf)
if idTempSurf then if idTempSurf then
dTotalArea = dTotalArea + ceil( EgtSurfArea( idTempSurf) or 0) 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
end end
return dTotalArea return dTotalArea, dTotalXLenght
end end
return 0 return 0
end end
-- minima area considerata per un corretto pinzaggio -- minima area considerata per un corretto pinzaggio
DistZClampToTable = DistZClampToTable or 0 DistZClampToTable = DistZClampToTable or 0
local MinJoin = BD.GetMinJoin( EMT.SB, EMT.HB, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB)) local MinJoin = BD.GetMinJoin( EMT.HB, EMT.SB, EgtIf( EMT.SPLIT, EMT.LT, EMT.LB))
local MinZClamping = min( b3ClampingArea:getDimZ() + DistZClampToTable, EMT.SB) - DistZClampToTable local MinZClamping = min( b3ClampingArea:getDimZ() + DistZClampToTable, EMT.SB) - DistZClampToTable
-- si moltiplica per un coefficiente minimo sotto al quale si da l'errore di pinzaggio -- si moltiplica per un coefficiente minimo sotto al quale si da l'errore di pinzaggio
ClampingCoeffMin = EgtClamp( ClampingCoeffMin, 0.01, 1) ClampingCoeffMin = EgtClamp( ClampingCoeffMin, 0.01, 1)
@@ -1848,15 +1917,12 @@ function CheckClamping( sClampName)
local bWriteWarnMessage = false local bWriteWarnMessage = false
local bWriteErrMessage = false local bWriteErrMessage = false
-- controllo faccia frontale -- controllo faccia frontale
local dArea = CalculateIntersectionArea( 'MIN', 'Y', 3) local dArea, dXClampedLenght = CalculateIntersectionArea( 'MIN', 'Y', 3)
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto) -- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
if dArea and dArea < dMinClampingAreaErr then if dArea and dArea < dMinClampingAreaErr then
-- solo se pinza almeno 1cm2, si prova un altro slice 5mm più all'interno, se aumenta al doppio non c'è errore (probabilmente siamo in presenza di un displuvio) -- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
if dArea > 1000 then if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
local dNewArea = CalculateIntersectionArea( 'MIN', 'Y', 3 + 4) bError = false
if dNewArea > dArea * 2 then
bError = false
end
end end
-- pinzaggio non fattibile, errore -- pinzaggio non fattibile, errore
if bError then if bError then
@@ -1878,13 +1944,10 @@ function CheckClamping( sClampName)
dArea = CalculateIntersectionArea( 'MAX', 'Y', 3) dArea = CalculateIntersectionArea( 'MAX', 'Y', 3)
-- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto) -- ERRORE: pinza troppo poco (meno di 1/3 del minimo richiesto)
if dArea and dArea < dMinClampingAreaErr then if dArea and dArea < dMinClampingAreaErr then
-- solo se pinza almeno 1cm2, si prova un altro slice 5mm più all'interno, se aumenta al doppio non c'è errore (probabilmente siamo in presenza di un displuvio) -- solo se pinza almeno 1cm2, e la somma della lunghezza pinzata è maggiore della lunghezza minima pinzabile da Warning e non errore
if dArea > 1000 then if dXClampedLenght >= MinJoin * ClampingCoeffMin and dArea > 1000 then
local dNewArea = CalculateIntersectionArea( 'MAX', 'Y', 3 + 4) bError = false
if dNewArea > dArea * 2 then end
bError = false
end
end
-- pinzaggio non fattibile, errore -- pinzaggio non fattibile, errore
if bError then if bError then
sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)' sErr = 'ERROR CLAMPING ' .. sClampName .. ' : '..tostring( ceil( ( dArea / dMinClampingAreaWarn) * 100))..'% ( '.. tostring( dArea/1000)..'cm2)'
@@ -2044,8 +2107,8 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV2 = ParkV2 - PosV2 local MoveV2 = ParkV2 - PosV2
local DiffY2 = MyParkY2 - PosY2 local DiffY2 = MyParkY2 - PosY2
local MoveY2 = EgtIf( DiffY2 < -0.1, MoveV2, 0) local MoveY2 = EgtIf( DiffY2 < -0.1, MoveV2, 0)
local TryMoveY2 = max( ParkV2 - PosT - EMT.LT, MinY2 - PosY2 + 10) local TryMoveY2 = max( ParkV2 - PosT - EMT.LT - EMT.DELTA_LT - EMT.HOVM, MinY2 - PosY2 + 10)
if ( PosT + EMT.LT < ParkV1 + ExtraParkV and PosT + EMT.LT > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end if ( PosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM < ParkV1 + ExtraParkV and PosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end
if not SimulMoveAxes( 'T', PosT + MoveY2, MCH_SIM_STEP.RAPID, if not SimulMoveAxes( 'T', PosT + MoveY2, MCH_SIM_STEP.RAPID,
'V1', ParkV1, MCH_SIM_STEP.RAPID, 'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID, 'V2', ParkV2, MCH_SIM_STEP.RAPID,
@@ -2278,6 +2341,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function GetV1ToClose() function GetV1ToClose()
if EMT.MCHPRECUT or EMT.MCHCUT then
return false
end
--EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB)) --EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0)) --EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0))
return ( EMT.MAXMAX[1] <= EMT.V1NEXTPOS + RollCageMin and EMT.MAXMIN[1] + EMT.LB >= EMT.V1NEXTPOS + RollCageMax) return ( EMT.MAXMAX[1] <= EMT.V1NEXTPOS + RollCageMin and EMT.MAXMIN[1] + EMT.LB >= EMT.V1NEXTPOS + RollCageMax)
@@ -2944,6 +3010,22 @@ function IsLastPath( nPathId)
return not EgtGetNext( nPathId) return not EgtGetNext( nPathId)
end end
---------------------------------------------------------------------
function IsLastMachining( nMchId)
local nOpeId = EgtGetNextActiveOperation( nMchId)
while nOpeId do
local nType = EgtGetOperationType( nOpeId)
-- se c'è una lavorazione
if nType ~= MCH_OY.NONE and nType ~= MCH_OY.DISP then
return false
elseif nType == MCH_OY.DISP and IsRestPhase( EMT.PHASE + 1) then
return false
end
nOpeId = EgtGetNextActiveOperation( nOpeId)
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2) function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
+229 -30
View File
@@ -17,6 +17,33 @@ require( 'EmtGenMachining')
--------------------------------------------------------------------- ---------------------------------------------------------------------
----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------
function OnSpecialGetPrevMachiningOffset() 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 -- default
EMC.ERR = 0 EMC.ERR = 0
EMC.PREVOFFSX = 0 EMC.PREVOFFSX = 0
@@ -26,8 +53,15 @@ function OnSpecialGetPrevMachiningOffset()
if IsStartOrRestPhase( EMC.CURRPHASE) then if IsStartOrRestPhase( EMC.CURRPHASE) then
-- recupero la posizione finale della lavorazione precedente -- recupero la posizione finale della lavorazione precedente
local vPrevAx = EmtGetFinalAxesPos( EMC.PREVMCHID) local vPrevAx = EmtGetFinalAxesPos( EMC.PREVMCHID)
-- la X (L1) di questa corrisponde alla posizione iniziale della nuova trave, se ne deduce l'offset -- ricava se e quanto la trave viene spostata tra le due fasi dai movimenti ausiliari e corregge l'offset di fine fase
EMC.PREVOFFSX = ParkV1 - vPrevAx[1] 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 end
end end
@@ -113,7 +147,7 @@ function OnSpecialGetMaxZ()
local vMZ = {{ Tz=0.85, Ez=440}, { Tz=0.5, Ez=200}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}} local vMZ = {{ Tz=0.85, Ez=440}, { Tz=0.5, Ez=200}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}}
EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ) EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ)
else else
local vMZ = {{ Tz=0.85, Ez=400}, { Tz=0.7, Ez=300}, { Tz=0.5, Ez=195}, { Tz=0.15, Ez=70}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}} local vMZ = {{ Tz=0.85, Ez=400}, { Tz=0.7, Ez=300}, { Tz=0.5, Ez=195}, { Tz=0.15, Ez=60}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}}
EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ) EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ)
end end
elseif EMC.HEAD == 'H16' then elseif EMC.HEAD == 'H16' then
@@ -133,7 +167,7 @@ function OnSpecialGetMaxZ()
local vMZ = {{ Tz=0.85, Ez=440}, { Tz=0.5, Ez=200}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}} local vMZ = {{ Tz=0.85, Ez=440}, { Tz=0.5, Ez=200}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}}
EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ) EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ)
else else
local vMZ = {{ Tz=0.85, Ez=400}, { Tz=0.7, Ez=300}, { Tz=0.5, Ez=195}, { Tz=0.15, Ez=70}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}} local vMZ = {{ Tz=0.85, Ez=400}, { Tz=0.7, Ez=300}, { Tz=0.5, Ez=195}, { Tz=0.15, Ez=60}, { Tz=-0.01, Ez=5}, { Tz=-0.5, Ez=1}}
EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ) EMC.MAXZ = ParkZ1 + CalcExtraZ( vtTpZm, vtT, vMZ)
end end
elseif EMC.HEAD == 'H21' then elseif EMC.HEAD == 'H21' then
@@ -347,7 +381,7 @@ local function GetNextRawInOrd( nCurrRawId)
end end
----------------------------------------------------------------------- -----------------------------------------------------------------------
local function EnsureZmax( bCloseV, vCmd) local function EnsureZmax( bCloseV, vCmd, nInd)
-- verifico non sia già inserito nella lista dei comandi -- verifico non sia già inserito nella lista dei comandi
for i = 1, #vCmd do for i = 1, #vCmd do
if vCmd[i][1] == 4 then if vCmd[i][1] == 4 then
@@ -359,7 +393,11 @@ local function EnsureZmax( bCloseV, vCmd)
end end
end end
-- posizionamento sicuro teste e rulli -- posizionamento sicuro teste e rulli
table.insert( vCmd, { 4, EgtIf( bCloseV, 1, 0)}) if not nInd then
table.insert( vCmd, { 4, EgtIf( bCloseV, 1, 0)})
else
table.insert( vCmd, nInd, { 4, EgtIf( bCloseV, 1, 0)})
end
return true return true
end end
@@ -533,6 +571,14 @@ function OnSpecialApplyDisposition()
end end
-- eseguo scarico -- eseguo scarico
SpecSetCarrPosFromCmds( vCmd2) SpecSetCarrPosFromCmds( vCmd2)
-- determino posizione testa trave
local nLastEntId = EgtGetLastInGroup( EgtGetLastInGroup( EgtGetFirstNameInGroup( EgtGetPrev( EMC.DISPID), 'CL')))
if nLastEntId then
local vAxes = EmtGetAxesPos( nLastEntId)
if #vAxes > 0 then EMC.TPOS = vAxes[1] end
else
EMC.TPOS = EgtGetInfo( EMC.DISPID, 'TPOS', 'd')
end
local vCmd3 = SpecCalcUnload() local vCmd3 = SpecCalcUnload()
-- unisco ed emetto i comandi -- unisco ed emetto i comandi
vCmd = EgtJoinTables( vCmd, vCmd2) vCmd = EgtJoinTables( vCmd, vCmd2)
@@ -542,6 +588,24 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnPostApplyMachining() 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) .. ' (' .. tostring( EMC.MCHID) .. ')') EgtOutLog( ' Lavorazione : ' .. EgtGetName( EMC.MCHID) .. ' (' .. tostring( EMC.MCHID) .. ')')
@@ -634,14 +698,14 @@ function OnPostApplyMachining()
-- verifico se ultimo percorso di ultima lavorazione della fase -- verifico se ultimo percorso di ultima lavorazione della fase
local bLast = ( bMchLast and ( not nPathId)) local bLast = ( bMchLast and ( not nPathId))
-- se ultimo, elimino ritorno in home -- 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 -- salvo lo stato dei carrelli
local OriTPos = EMC.TPOS local OriTPos = EMC.TPOS
local OriY1Delta = EMC.Y1DELTA local OriY1Delta = EMC.Y1DELTA
local OriY2Delta = EMC.Y2DELTA local OriY2Delta = EMC.Y2DELTA
local OriV1Pos = EMC.V1POS local OriV1Pos = EMC.V1POS
local OriV2Pos = EMC.V2POS local OriV2Pos = EMC.V2POS
local OriCnt = EMC.CNT local OriCnt = EMC.CNT
-- eseguo le elaborazioni -- eseguo le elaborazioni
SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bLast and bUnload) SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bLast and bUnload)
-- se separazione, verifico il risultato -- se separazione, verifico il risultato
@@ -698,7 +762,10 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
-- Verifico se lavorazione pareti -- Verifico se lavorazione pareti
local bWall = ( EgtGetInfo( EgtGetCurrMachGroup() or GDB_ID.NULL, 'Wall', 'd') == 1) local bWall = ( EgtGetInfo( EgtGetCurrMachGroup() or GDB_ID.NULL, 'Wall', 'd') == 1)
-- se il pezzo dev'essere scaricato al carico
local dUnloadType = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'UNLOAD', 'd')
local bUnloadOnLoadPos = dUnloadType == 1 or dUnloadType == -1
-- mi salvo info lavorazione su una lista -- mi salvo info lavorazione su una lista
local AuxInfoMach = {} local AuxInfoMach = {}
AuxInfoMach.bPreSplit = bPreSplit AuxInfoMach.bPreSplit = bPreSplit
@@ -706,7 +773,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
AuxInfoMach.bPreCut = bPreCut AuxInfoMach.bPreCut = bPreCut
AuxInfoMach.bCutting = bCutting AuxInfoMach.bCutting = bCutting
AuxInfoMach.bUnload = bUnload AuxInfoMach.bUnload = bUnload
-- Assegno flag di pezzo separato dal resto del grezzo -- Assegno flag di pezzo separato dal resto del grezzo
SPLIT = IsEndPhase( EMC.PHASE) SPLIT = IsEndPhase( EMC.PHASE)
@@ -714,6 +781,13 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
local b3Tot = BBox3d() local b3Tot = BBox3d()
local b3Raw = BBox3d() local b3Raw = BBox3d()
local nNextOddPhase = GetNextStartOrRestPhase( EMC.PHASE) local nNextOddPhase = GetNextStartOrRestPhase( EMC.PHASE)
-- se esistono più grezzi toglie l'impostazione di scarico al carico e ritorna errore
if bUnloadOnLoadPos and ( nNextOddPhase and nNextOddPhase <= EgtGetPhaseCount()) then
bUnloadOnLoadPos = false
EMC.ERR = 22
EMC.MSG = ' Error : Unload on Load Position not reachable if raw part on Load Position'
return
end
local nRawId = EgtGetFirstRawPart() local nRawId = EgtGetFirstRawPart()
local nCurrRawId = GDB_ID.NULL local nCurrRawId = GDB_ID.NULL
while nRawId do while nRawId do
@@ -764,6 +838,10 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
elseif bPreCut or bCutting then elseif bPreCut or bCutting then
local dDistF, dDistB, dRollF, dRollB = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1) local dDistF, dDistB, dRollF, dRollB = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1)
dDistFront = min( dDistFront, dDistF) dDistFront = min( dDistFront, dDistF)
-- Se è previsto lo scarico al carico aumenta l'ingombro dell'area di lavoro
if bUnloadOnLoadPos then
dDistFront = dDistFront -( MinDeltaYV*2 + AGG_V)
end
dDistBack = min( dDistBack, dDistB) dDistBack = min( dDistBack, dDistB)
end end
@@ -862,7 +940,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
EgtSetInfo( NextDispId, 'V1POS', EMC.V1POS) EgtSetInfo( NextDispId, 'V1POS', EMC.V1POS)
EgtSetInfo( NextDispId, 'V2POS', EMC.V2POS) EgtSetInfo( NextDispId, 'V2POS', EMC.V2POS)
end end
end end
-- Se previsto scarico, lo eseguo -- Se previsto scarico, lo eseguo
if bUnload then if bUnload then
@@ -1167,7 +1245,9 @@ function SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1Del
WorkTab.dY1DeltaMaxF = min( EMC.LB - MinJoin, MaxY1 + dDistFront + dRollFront + AGG_V) WorkTab.dY1DeltaMaxF = min( EMC.LB - MinJoin, MaxY1 + dDistFront + dRollFront + AGG_V)
WorkTab.dY2DeltaMinF = max( MinJoin + EMC.HCING + EMC.HOVM, EMC.LB + MinY2 - dMyDistBack - AGG_V - dRollBack) WorkTab.dY2DeltaMinF = max( MinJoin + EMC.HCING + EMC.HOVM, EMC.LB + MinY2 - dMyDistBack - AGG_V - dRollBack)
WorkTab.dY2DeltaMaxF = min( dDistFront, EMC.LB - MyMinOther) -- - EMC.TCING WorkTab.dY2DeltaMaxF = min( dDistFront, EMC.LB - MyMinOther) -- - EMC.TCING
if dY1DeltaMaxSP then WorkTab.dY1DeltaMaxF = min( WorkTab.dY1DeltaMaxF, dY1DeltaMaxSP) end if dY1DeltaMaxSP and dY1DeltaMaxSP > WorkTab.dY1DeltaMinF then
WorkTab.dY1DeltaMaxF = min( WorkTab.dY1DeltaMaxF, dY1DeltaMaxSP)
end
if dY2DeltaMinUL then WorkTab.dY2DeltaMinF = max( WorkTab.dY2DeltaMinF, dY2DeltaMinUL) end if dY2DeltaMinUL then WorkTab.dY2DeltaMinF = max( WorkTab.dY2DeltaMinF, dY2DeltaMinUL) end
WorkTab.dV1PosF = dRollBack WorkTab.dV1PosF = dRollBack
WorkTab.bV1CloseF = false WorkTab.bV1CloseF = false
@@ -1292,8 +1372,100 @@ function SpecCalcSplit( dLenRaw, dMaxLenLeft)
return vCmd return vCmd
end end
---------------------------------------------------------------------
-- Scarica il pezzo in zona di carico
function SpecCalcUnloadOnLoadPos()
local vCmdPre = {}
EgtOutLog( ' *[UL]', 1)
if not EMC.Y1DELTA and not EMC.Y2DELTA then
EMC.ERR = 21
EMC.MSG = ' Error : Y1 and Y2 not clamped for unloading'
return {}
end
-- Se pinza Y2 chiusa, devo effettuare uno scambio
local dY1DeltaMaxSP = MaxY1 - UnloadOnLoadTPos - TurnerOffs - 10 * GEO.EPS_SMALL
if EMC.Y2DELTA or EMC.Y1DELTA > dY1DeltaMaxSP then
-- imposto quote aggancio per avere solo pinza Y
local dDistFront = 0
local dDistBack = EMC.LB - MinOther - EMC.HOVM + 10 * GEO.EPS_SMALL
-- dico che le paratie sono chiuse perchè poi se ho dei movimenti, verranno chiuse, quindi parto considerandole già chiuse
EMC.V1POS = 0
EMC.V2POS = 0
-- effettuo scambio
vCmdPre = SpecCalcCarriages( dDistFront, dDistBack, 0, 0, dY1DeltaMaxSP)
-- recupero nuova posizione carrelli
SpecSetCarrPosFromCmds( vCmdPre)
EgtOutLog( ' [UL1]', 1)
end
-- porto il pezzo alla zona di rotazione con il carro Y1
local vCmd = {}
-- Commento
table.insert( vCmd, { 0, 'Unload-On-Load'})
-- posizionamento sicuro teste e rulli
if #vCmdPre > 0 then
EnsureZmax( true, vCmdPre, 2)
else
EnsureZmax( true, vCmd)
end
-- Se pinza V chiusa, la apro
if EMC.Y2DELTA then
table.insert( vCmd, { 12, 0})
end
-- riporto la trave al carico
local dRotT = UnloadOnLoadTPos + TurnerOffs
local dY1Move = dRotT + EMC.Y1DELTA
if dY1Move > MaxY1 then
local dRotTStep, dY1MoveStep = dRotT - dY1Move + MaxY1, MaxY1
if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then
table.insert( vCmd, { 2, 'Y1', dY1MoveStep, 'T', dRotTStep, 'BrakeBeam'})
-- apro la morsa
table.insert( vCmd, { 11, 0})
-- riporto il carrello in fondo alla trave
dY1MoveStep = dRotTStep + ( EMC.HCING or 0)
dY1Move = dY1MoveStep + dY1Move - MaxY1
table.insert( vCmd, { 1, 'Y1', dY1MoveStep, 'UnBrakeBeam'})
-- chiudo la morsa
table.insert( vCmd, { 11, 1})
end
end
table.insert( vCmd, { 2, 'Y1', dY1Move, 'T', dRotT, 'BrakeBeam'})
-- apro la morsa
table.insert( vCmd, { 11, 0})
EMC.CNT = nil
-- riporto il carrello in home
table.insert( vCmd, { 1, 'Y1', ParkY1, 'UnBrakeBeam'})
-- eventuale unione tabelle
if #vCmdPre > 0 then
vCmd = EgtJoinTables( vCmdPre, vCmd)
end
return vCmd
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function SpecCalcUnload() function SpecCalcUnload()
-- In caso di condizioni rispettate richiama lo scarico al carico e ritorna
local nNextPathId
local nNextMchId
local nNextDispId
if EMC.PATHID then nNextPathId = EgtGetNextActiveOperation( EMC.PATHID) end
if EMC.MCHID then nNextMchId = EgtGetNextActiveOperation( EMC.MCHID) end
if EMC.DISPID then nNextDispId = EgtGetNextActiveOperation( EMC.DISPID) end
-- se il pezzo dev'essere scaricato al carico
local dUnloadType = EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'UNLOAD', 'd')
local bUnloadOnLoadPos = dUnloadType == 1 or dUnloadType == -1
if bUnloadOnLoadPos then
-- è l'ultimo path, è l'ultima lavorazione, non ci sono altre disposizioni e non c'è rimanenza
if not nNextPathId and not nNextMchId and not nNextDispId and not IsStartOrRestPhase(EMC.PHASE) then
local vCmd = SpecCalcUnloadOnLoadPos()
return vCmd
else
EMC.ERR = 21
EMC.MSG = ' Error : Unload on Load Position not reachable if raw part on Load Position'
return {}
end
end
local vCmdPre = {} local vCmdPre = {}
EgtOutLog( ' *[U]', 1) EgtOutLog( ' *[U]', 1)
if not EMC.Y1DELTA and not EMC.Y2DELTA then if not EMC.Y1DELTA and not EMC.Y2DELTA then
@@ -1342,15 +1514,39 @@ function SpecCalcUnload()
if bStdUl then if bStdUl then
local dFinT = EgtIf( EMC.LB < MaxLenSmT, UnloadSmT, UnloadT) - EMC.LB local dFinT = EgtIf( EMC.LB < MaxLenSmT, UnloadSmT, UnloadT) - EMC.LB
local dFinY2 = dFinT + EMC.Y2DELTA local dFinY2 = dFinT + EMC.Y2DELTA
table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2}) local dBeamTailY2 = dFinY2 + ( EMC.LB - EMC.Y2DELTA) - ( EMC.TCING or 0)
-- Se scarico in linea scrivo una nota in più per l'attivazione del piano ferma pezzo (M125)
if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then
table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2, 'BrakeBeam'})
else
table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2})
end
EgtOutLog( ' Y2PosF=' .. EgtNumToString( dFinY2), 1) EgtOutLog( ' Y2PosF=' .. EgtNumToString( dFinY2), 1)
-- Se scarico in "linea"
if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then
-- apro la morsa
table.insert( vCmd, { 12, 0})
local dY2MoveMax = MinY2
if dBeamTailY2 >= ( dY2MoveMax + ( EMC.TCING or 0)) then
local dTMove = dY2MoveMax - EMC.LB + ( EMC.TCING or 0)
-- riporto il carrello in fondo alla trave
table.insert( vCmd, { 1, 'Y2', dBeamTailY2, 'UnBrakeBeam'})
-- chiudo la morsa
table.insert( vCmd, { 12, 1})
-- finisco scarico trave
table.insert( vCmd, { 2, 'T', dTMove, 'Y2', dY2MoveMax})
EgtOutLog( ' Y2PosF=' .. EgtNumToString( dY2MoveMax), 1)
end
end
else else
table.insert( vCmd, { 1, 'Y2', MaxY2}) local dFinT = min( MaxY2 - EMC.Y2DELTA, max( UnloadT - MaxUnloadLen, MinY2 - EMC.Y2DELTA))
local dFinY2 = dFinT + EMC.Y2DELTA
table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2})
end end
-- apro la morsa -- apro la morsa
table.insert( vCmd, { 12, 0}) table.insert( vCmd, { 12, 0})
-- riporto il carrello in home -- riporto il carrello in home
table.insert( vCmd, { 1, 'Y2', ParkY2}) table.insert( vCmd, { 1, 'Y2', ParkY2, 'NoWaitUnload'})
-- eventuale unione tabelle -- eventuale unione tabelle
if #vCmdPre > 0 then if #vCmdPre > 0 then
@@ -1527,7 +1723,7 @@ local function PosForEnl1FY1( dY1a, dY2a, dTa, dExtra, dCorsaY1e, dCorsaY2Te)
if dDispl/2 <= dCorsaY1e then if dDispl/2 <= dCorsaY1e then
dY1a = dY1a + dDispl / 2 dY1a = dY1a + dDispl / 2
dY2a = dY2a - dDispl / 2 dY2a = dY2a - dDispl / 2
dTa = dTa - dDispl / 2 dTa = dTa - dDispl / 2
else else
dY1a = dY1a + dCorsaY1e dY1a = dY1a + dCorsaY1e
dY2a = dY2a - (dDispl - dCorsaY1e) dY2a = dY2a - (dDispl - dCorsaY1e)
@@ -1549,7 +1745,7 @@ local function PosForEnl1FY2( dY1a, dY2a, dTa, dExtra, dCorsaY1Te, dCorsaY2e)
if dDispl/2 <= dCorsaY1Te then if dDispl/2 <= dCorsaY1Te then
if dDispl/2 <= dCorsaY2e then if dDispl/2 <= dCorsaY2e then
dY1a = dY1a + dDispl / 2 dY1a = dY1a + dDispl / 2
dTa = dTa + dDispl / 2 dTa = dTa + dDispl / 2
dY2a = dY2a - dDispl / 2 dY2a = dY2a - dDispl / 2
else else
dY2a = dY2a - dCorsaY2e dY2a = dY2a - dCorsaY2e
@@ -1577,7 +1773,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- allontano (Y1+T) e (Y2) -- allontano (Y1+T) e (Y2)
dY1a = MaxY1 dY1a = MaxY1
dY2a = MinY2 dY2a = MinY2
dTa = ( dY1a - TabI.dY1PosI) + dTa dTa = ( dY1a - TabI.dY1PosI) + dTa
-- **[M2]** = allontanamento dei trascinatori con Y2 in presa -- **[M2]** = allontanamento dei trascinatori con Y2 in presa
elseif sType == 'M2' then elseif sType == 'M2' then
EmitComment( vCmd, '[M2]') EmitComment( vCmd, '[M2]')
@@ -1588,7 +1784,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- allontano (Y2+T) e (Y1) -- allontano (Y2+T) e (Y1)
dY1a = MaxY1 dY1a = MaxY1
dY2a = MinY2 dY2a = MinY2
dTa = ( dY2a - TabI.dY2PosI) + dTa dTa = ( dY2a - TabI.dY2PosI) + dTa
-- **[M3]** = accentramento dei trascinatori con Y1 in presa -- **[M3]** = accentramento dei trascinatori con Y1 in presa
elseif sType == 'M3' then elseif sType == 'M3' then
EmitComment( vCmd, '[M3]') EmitComment( vCmd, '[M3]')
@@ -1598,7 +1794,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- accentro (Y1+T) e (Y2) -- accentro (Y1+T) e (Y2)
dY1a = TabI.MyMinY1V1 dY1a = TabI.MyMinY1V1
dY2a = TabI.MaxY2V2 dY2a = TabI.MaxY2V2
dTa = ( dY1a - TabI.dY1PosI) + dTa dTa = ( dY1a - TabI.dY1PosI) + dTa
-- **[M4]** = accentramento dei trascinatori con Y2 in presa -- **[M4]** = accentramento dei trascinatori con Y2 in presa
elseif sType == 'M4' then elseif sType == 'M4' then
EmitComment( vCmd, '[M4]') EmitComment( vCmd, '[M4]')
@@ -1609,7 +1805,7 @@ local function MaxDispl( TabI, vCmd, sType)
-- accentro (Y2+T) e (Y1) -- accentro (Y2+T) e (Y1)
dY1a = TabI.MyMinY1V1 dY1a = TabI.MyMinY1V1
dY2a = TabI.MaxY2V2 dY2a = TabI.MaxY2V2
dTa = ( dY2a - TabI.dY2PosI) + dTa dTa = ( dY2a - TabI.dY2PosI) + dTa
end end
-- --
table.insert( vCmd, { 3, 'Y1', dY1a, 'Y2', dY2a, 'T', dTa, EMC.CNT}) table.insert( vCmd, { 3, 'Y1', dY1a, 'Y2', dY2a, 'T', dTa, EMC.CNT})
@@ -1897,7 +2093,7 @@ local function PosY1Y2B( TabI, vCmd)
PosY2FromY1B( TabI, vCmd) PosY2FromY1B( TabI, vCmd)
end end
end end
bXW = false bXW = false
-- se posso posizionare 'direttamente' Y2 all'interno dell'intervallo I2 (casi [rp] o [ri]) -- se posso posizionare 'direttamente' Y2 all'interno dell'intervallo I2 (casi [rp] o [ri])
else else
-- |POSIZIONO MORSA 2| e poi MORSA 1 -- |POSIZIONO MORSA 2| e poi MORSA 1
@@ -1908,7 +2104,7 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
PosY2FromY1A( TabI, vCmd) PosY2FromY1A( TabI, vCmd)
PosY1FromY2B( TabI, vCmd) PosY1FromY2B( TabI, vCmd)
bXW = false bXW = false
end end
-- in **accentramento** -- in **accentramento**
else else
@@ -1917,9 +2113,9 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI <= TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then TabI.dY1PosI <= TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
PosY2FromY1B( TabI, vCmd) PosY2FromY1B( TabI, vCmd)
PosY1FromY2B( TabI, vCmd) PosY1FromY2B( TabI, vCmd)
bXW = false bXW = false
end end
end end
end end
if bXW then if bXW then
-- Massimo trascinamento della trave in direzione positiva (casi **[xw]** ) -- Massimo trascinamento della trave in direzione positiva (casi **[xw]** )
@@ -1929,10 +2125,10 @@ local function PosY1Y2B( TabI, vCmd)
TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then TabI.dY1PosI < TabI.dTPosI + EMC.LB - MinJoin - EgtIf( SPLIT, EMC.TCING, 0) + 10 * GEO.EPS_SMALL then
-- allontanamento morse, trascinamento trave con Y1 -- allontanamento morse, trascinamento trave con Y1
MaxDispl( TabI, vCmd, 'M1') MaxDispl( TabI, vCmd, 'M1')
else else
-- accentramento morse, trascinamento trave con Y2 -- accentramento morse, trascinamento trave con Y2
MaxDispl( TabI, vCmd, 'M4') MaxDispl( TabI, vCmd, 'M4')
end end
end end
nCnt = nCnt + 1 nCnt = nCnt + 1
if nCnt > 10 then return end if nCnt > 10 then return end
@@ -2472,14 +2668,17 @@ function SpecOutputCmds( vCmd, bEnd)
-- commento -- commento
if Cmd[1] == 0 then if Cmd[1] == 0 then
local sInfo = '0,'..Cmd[2] local sInfo = '0,'..Cmd[2]
if Cmd[3] then
sInfo = sInfo..','..Cmd[3]
end
EgtSetInfo( EMC.PATHID, sKey, sInfo) EgtSetInfo( EMC.PATHID, sKey, sInfo)
-- movimento di 1 asse -- movimento di 1 asse
elseif Cmd[1] == 1 then elseif Cmd[1] == 1 then
local sInfo = '1,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..EgtIf( Cmd[4], ',*', '') local sInfo = '1,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..EgtIf( Cmd[4], ','..tostring(Cmd[4]), '')
EgtSetInfo( EMC.PATHID, sKey, sInfo) EgtSetInfo( EMC.PATHID, sKey, sInfo)
-- movimento di 2 assi -- movimento di 2 assi
elseif Cmd[1] == 2 then elseif Cmd[1] == 2 then
local sInfo = '2,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..','..Cmd[4]..','..EgtNumToString( Cmd[5],3)..EgtIf( Cmd[6], ',*', '') local sInfo = '2,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..','..Cmd[4]..','..EgtNumToString( Cmd[5],3)..EgtIf( Cmd[6], ','..tostring(Cmd[6]), '')
EgtSetInfo( EMC.PATHID, sKey, sInfo) EgtSetInfo( EMC.PATHID, sKey, sInfo)
-- movimento di 3 assi -- movimento di 3 assi
elseif Cmd[1] == 3 then elseif Cmd[1] == 3 then
+34
View File
@@ -1,5 +1,39 @@
==== Common_PF1250 Update Log ==== ==== Common_PF1250 Update Log ====
Versione 3.1-- (--/--/2026)
- (GEN) In caso di ultimo movimento come scarico rimanenza, porta V2 in posizione di parcheggio. Ticket#3006
Versione 3.1e2 (15/05/2026)
- (SIM-GEN) Corretta gestione scarico manuale ( errore in versione 3.1e1)
Versione 3.1e1 (12/05/2026)
- (SIM-GEN) Corretta SIM (muoveva Y2 a MaxY2 senza aprire pinza) e GEN (non chiudeva rulliere e dava extracorsa e non generava P7=-85) di pezzi lunghi che necessitano lo scarico manuale. Ticket#2971
Versione 3.1c1
- (SIM-GEN) Corretto calcolo rimanenza durante ParkRoller. Ticket#2832
- (SIM) Corretto caricamento geometrie di collisioni. Modificato indice di collisione per una migliore gestione. ATT: MIN_MACH -> 3.1b2
- (SIM-GEN) Aggiunta OnSpecialApplyMachining per calcolare i carrelli da subito
- Aggiungendo OnSpecialApplyMachining, ora la OnSpecialGetPrevMachiningOffset lavora correttamente. Ticket#2798
- (SIM-GEN) Solo se dY1DeltaMaxSP > WorkTab.dY1DeltaMinF lo prende in considerazione per il valore di WorkTab.dY1DeltaMaxF Ticket#2798
Versione 3.1b1 (17/02/2026)
- (GEN) Generazione non allineata a simulazione. Ticket#2819
Versione 3.1a2 (30/01/2026)
- (SIM) Allineato approccio simulazione a generazione in caso di lavorazione in doppio verticale. Ticket#2781
- (GEN) Simulazione non allineata a generazione. Mancava reset flag di pezzo a caduta. Ticket#2798
Versione 3.1a1 (16/01/2026)
- (SIM-GEN) Corretto movimento di approccio con sega a catena e allineati Simulazione e Generazione. Ticket#2771
Versione 2.7l1 (18/12/2025)
- (SIM-GEN) Aggiunto controllo post movimenti ausiliari dell' EMC.PREVOFFSX nella funzione OnSpecialGetPrevMachiningOffset() come su ONE-PF. Ticket#2727
- (SIM-GEN) Cambiato delta di correzione Z per lama con inclinazione >= 81° da 70 a 60 mm. Risoluzione Ticket#2210
- (SIM-GEN) Divisione movimento B in approccio se > 90°.
Versione 2.7k5 (26/11/2025)
- (SIM) Migliorata funzione CheckClamping, ora il controllo di warning si basa sulla somma delle lunghezze delle aree pinzate
Versione 2.7k4 (25/11/2025) Versione 2.7k4 (25/11/2025)
- (SIM) Migliorata funzione CheckClamping, ora la sezione rientra di 3 mm - (SIM) Migliorata funzione CheckClamping, ora la sezione rientra di 3 mm
+2 -2
View File
@@ -3,8 +3,8 @@
local InfoCommon_STD_PP = { local InfoCommon_STD_PP = {
NAME = 'Common_PF1250', -- nome script PP standard NAME = 'Common_PF1250', -- nome script PP standard
VERSION = '2.7k4', -- versione script VERSION = '3.1--', -- versione script
MIN_MACH_VER_PP_COMMON = '2.7k1' -- versione minima kernel MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel
} }
return InfoCommon_STD_PP return InfoCommon_STD_PP