Compare commits

...

106 Commits

Author SHA1 Message Date
andrea.villa b93a21605d Merge remote-tracking branch 'origin/hotfix/PreselLongToolCorrection' 2024-11-26 15:57:52 +01:00
andrea.villa d22e223017 Corretto controllo preselezione per utensili lunghi 2024-11-26 15:57:39 +01:00
andrea.villa 7c208a3c34 Merge branch 'hotfix/PreselLongTools' 2024-11-25 15:59:40 +01:00
andrea.villa 525175586b Se si preseleziona su testa 1 un utensile lungo, non si va alla X successiva di lavoro ma si resta in home. Infatti potrebbe toccare le paratie in caso di scambio pezzo. 2024-11-25 15:59:27 +01:00
andrea.villa a08cc7ac7e Merge remote-tracking branch 'origin/develop' 2024-11-04 08:29:31 +01:00
andrea.villa a2068fc437 Commit per versione 2024-11-04 08:29:15 +01:00
andrea.villa 46893aed18 Gestione terza testa 5 assi dedicata lama (H38) 2024-10-29 17:24:27 +01:00
andrea.villa dffcc50b34 Merge branch 'main' into develop 2024-10-25 13:01:38 +02:00
andrea.villa 635457269e - Piccola correzione per capire se testa 3 presente
- In caso di lavorazione successiva alla prima, rivisto primo posizionamento alla quota Z di lavoro se precedentemente spostati a quota rotazione assi rotanti
2024-10-25 13:00:57 +02:00
andrea.villa 4fe1fee036 Piccola correzione per capire se testa 3 presente 2024-10-23 10:53:33 +02:00
andrea.villa f51cf52864 Merge branch 'main' into develop 2024-10-23 10:17:07 +02:00
andrea.villa 43b441d069 Merge remote-tracking branch 'origin/develop' 2024-10-23 10:16:56 +02:00
andrea.villa 8a30ac309e - Per movimento a ZMAX si considera utensile attuale o precedente
- Post con gestione 3 testa dedicata lama
2024-10-23 10:16:37 +02:00
andrea.villa 63bba61c19 Aggiunto parametro ParkTc1X1 in MLDE per simulazione quota parcheggio Testa 1 su TC1 2024-10-16 12:01:10 +02:00
andrea.villa 92d983451c Merge remote-tracking branch 'origin/main' into develop 2024-10-01 08:21:58 +02:00
andrea.villa b2ce94eeb3 Merge remote-tracking branch 'origin/develop' 2024-10-01 08:21:32 +02:00
andrea.villa 059e150bb1 Commit per versione 2024-10-01 08:21:18 +02:00
andrea.villa 7c81481da4 Per lavorazione in doppio: messaggio bloccante in caso di extra-corsa durante un movimento standard su piano generico della lavorazione. 2024-09-23 12:42:50 +02:00
andrea.villa 272705acf2 Aggiunta gestione solidi collisione per TC verticali e TC rotante sotto 2024-09-16 12:30:53 +02:00
andrea.villa 709c6ebccf Migliorato calcolo chiusura paratia rulli con aggiornamento lunghezza della barra in caso di ultimo taglio e grezzo residuo in coda 2024-09-12 13:02:26 +02:00
andrea.villa ab03fa02c1 Merge remote-tracking branch 'origin/main' into develop 2024-09-10 10:24:39 +02:00
andrea.villa 4e60812c29 Merge remote-tracking branch 'origin/develop' 2024-09-10 10:24:25 +02:00
andrea.villa 3c8d626277 Commit per versione 2024-09-10 10:24:15 +02:00
andrea.villa f90003d85a se diametro utensile più del truciolatore standard grande, non si preseleziona 2024-09-10 10:23:09 +02:00
andrea.villa 5cc80c6ce7 Merge remote-tracking branch 'origin/main' into develop 2024-08-28 10:00:24 +02:00
andrea.villa 2e2e56b86b Merge branch 'develop' 2024-08-28 10:00:05 +02:00
andrea.villa 344c135410 Primo movimento testa sotto in posizione rotazione assi rotanti dopo eventuale apertura rulli 2024-08-28 09:59:49 +02:00
andrea.villa e4b72f36de Quando si aprono i rulli, se la trave non può seguire i rulli perchè la pinza andrebbe in extra-corsa, si sposta comunque la pinza fino al massimo della sua corsa. 2024-08-07 13:14:34 +02:00
andrea.villa 6cd8cc0aa6 Merge remote-tracking branch 'origin/main' into develop 2024-08-07 09:18:11 +02:00
andrea.villa abeea33183 Corretto chiamata file TPA con nuovo nome 2024-08-07 09:18:00 +02:00
andrea.villa dbc72d38db Merge remote-tracking branch 'origin/main' into develop 2024-08-07 09:09:16 +02:00
andrea.villa 6bef01fec7 Merge remote-tracking branch 'origin/develop' 2024-08-07 09:09:04 +02:00
andrea.villa ae9de373fb Commit per versione 2024-08-07 09:08:49 +02:00
andrea.villa f5d4c8d8b7 - Rinominato file da "Common-" a "Common_" 2024-08-02 09:33:42 +02:00
andrea.villa c577ddf692 Ridotto limite minimo intervallo di pinzaggio 2024-07-30 14:37:49 +02:00
andrea.villa f750918c0e Migliorata gestione riposizionamenti fatta con la 2.6g1 2024-07-30 12:17:11 +02:00
andrea.villa 9fdaeee8d1 Viene ripristinato il tipo di arco corretto 2024-07-29 09:59:21 +02:00
andrea.villa 0041fea1b2 Gestione creazione piano generico in caso il primo movimento della lavorazione sia un arco 2024-07-29 09:18:28 +02:00
andrea.villa c3ca7da19c Merge remote-tracking branch 'origin/main' into develop 2024-07-24 13:05:04 +02:00
andrea.villa aea3cf168f Per OnSetHead chiamata da simulazione, aggiunta lettura TOTDIAM. Serve per limitare corse assi testa sotto 2024-07-24 13:04:46 +02:00
andrea.villa aa20eb6959 Merge branch 'main' into develop 2024-07-23 13:13:09 +02:00
andrea.villa 118298e841 Merge remote-tracking branch 'origin/develop' 2024-07-23 13:12:50 +02:00
andrea.villa ffeedc5fd6 Corretta ultima modifica per controllo collisioni testa non utilizzata. Trovava collisioni in lavorazioni in doppio. 2024-07-23 13:12:38 +02:00
andrea.villa 7686361567 Merge remote-tracking branch 'origin/main' into develop 2024-07-22 15:05:23 +02:00
andrea.villa fd1c2d2a21 Piccola correzione controllo collisione 2024-07-22 15:05:06 +02:00
andrea.villa 6ac9b67b8d Merge branch 'main' into develop 2024-07-22 15:00:54 +02:00
andrea.villa 1c1124ac39 Merge remote-tracking branch 'origin/develop' 2024-07-22 15:00:47 +02:00
andrea.villa ce46627885 In caso di grezzo piuttosto piccolo, concesso pinzaggio fino al massimo possibile, oltre al calcolo con coefficienti 2024-07-22 14:53:37 +02:00
andrea.villa 8755104f2f In calcolo pinzaggio al carico, si aggiunge anche alla quota massima l'offset aggiuntivo. 2024-07-22 12:52:02 +02:00
andrea.villa f5669d9e62 Si aggiunge al controllo collisioni anche Tool e ToolHolder della testa non utilizzata 2024-07-19 16:36:02 +02:00
andrea.villa 6560c27fed Merge remote-tracking branch 'origin/main' into develop 2024-07-12 16:21:36 +02:00
andrea.villa 962ea6f461 Corretto movimento testa sotto che andava in collisione tra una lavorazione e la successiva se tra le due c'era un riposizionamento pinze. 2024-07-12 16:21:20 +02:00
andrea.villa a4f8a81186 Merge branch 'main' into develop 2024-07-08 12:38:36 +02:00
andrea.villa e4704572da Corretto movimento che pinzava nel vuoto durante riposizionamento 2024-07-08 12:38:25 +02:00
andrea.villa e1c20e5152 Merge branch 'main' into develop 2024-06-06 16:33:43 +02:00
andrea.villa d3684186c7 Merge branch 'develop' 2024-06-06 16:33:27 +02:00
andrea.villa 69e4539fad Quando si va a ZMAX, si azzerano tutte le coordinate ".pp" 2024-06-06 16:33:18 +02:00
andrea.villa 7d563d06ab Merge branch 'main' into develop 2024-06-03 12:22:42 +02:00
andrea.villa e6fe268062 Merge branch 'develop' 2024-06-03 12:22:37 +02:00
andrea.villa 3854c6a24c Versione 2.6f1 2024-06-03 12:22:26 +02:00
andrea.villa 25bcad240a Migliorata gestione approccio al pezzo con lama aggregato da sotto. Va al minimo in X solo se necessario. 2024-05-29 12:17:36 +02:00
andrea.villa db5230a402 Merge branch 'main' into develop 2024-05-28 09:57:54 +02:00
andrea.villa 7ec4bfd76e Corretta versione 2024-05-28 09:57:43 +02:00
andrea.villa 2d97e2cb51 Merge branch 'develop' 2024-05-28 09:56:55 +02:00
andrea.villa d66abca2e7 - Ripristinato controllo extra-corsa per testa 2
- Corretto movimento testa sotto su prima lavorazione
2024-05-28 09:56:44 +02:00
andrea.villa b65e6f805d Aggiunta possibilità di scrivere nome utensile doppio anche in lavorazione con parametro "TOOLDOUBLE". Note sulla lavorazione hanno precedenza su note utensile. 2024-05-24 11:43:39 +02:00
andrea.villa e18023d094 Merge branch 'main' into develop 2024-05-23 14:44:05 +02:00
andrea.villa bd96eb55e2 Merge branch 'develop' 2024-05-23 14:43:57 +02:00
andrea.villa 73cdbd2df5 Se lavorazione con testa 2 e stesso utensile, piccola correzione che manda a parcheggio se cambiano assi rotanti solo se si trova a ZMAX 2024-05-23 14:43:47 +02:00
andrea.villa b28c999198 Corretta lettura e salvataggio coordinala asse L2 con coordinate rispetto origine. Prima erano locali e sbagliava alcuni calcoli 2024-05-16 15:09:21 +02:00
andrea.villa 44def6c43e Controllo extra-corsa per testa 2 in caso di lavorazioni in doppio in Y 2024-05-15 16:19:03 +02:00
andrea.villa d20c149686 Merge branch 'main' into develop 2024-05-15 13:13:28 +02:00
andrea.villa e6033e1f8d Miglioramento gestione lama su aggregato da sotto 2024-05-15 13:13:08 +02:00
andrea.villa f8974da04c Merge remote-tracking branch 'origin/main' into develop 2024-05-09 12:41:43 +02:00
andrea.villa dcb80bec7c Corretto prelievo lama 2 (H16). Prima di visualizzare utensile, si sposta la Z alla quota massima. 2024-05-09 12:41:32 +02:00
andrea.villa fde0489fe7 Merge branch 'main' into develop 2024-05-06 10:08:11 +02:00
andrea.villa d7f4fb0ef3 In parcheggio paratie/pinze, viene considerato sovramateriale di testa 2024-05-06 10:07:58 +02:00
andrea.villa efa56704d7 Merge branch 'main' into develop 2024-04-30 10:47:14 +02:00
andrea.villa 1f388d6b36 Merge branch 'develop' 2024-04-30 10:46:56 +02:00
andrea.villa c3a31403ce Modifica file log 2024-04-30 10:46:46 +02:00
andrea.villa 40cdb9ec93 Gestione parametro WoodDensity (WOOD_DENSITY in Ts3) 2024-04-30 10:37:32 +02:00
andrea.villa 33cb7da920 per macchina a 3 teste, ripristinato posizionamento testa 2 tramite parametro ParkInLavZ2 2024-04-23 16:40:16 +02:00
andrea.villa 0c8b706f9a Merge branch 'main' into develop 2024-04-23 15:49:03 +02:00
andrea.villa 6736907045 Merge branch 'develop' 2024-04-23 15:48:43 +02:00
andrea.villa 3d4e235a23 - Aggiunto parametro MaxZ1Blade per differenziare Z massima aggregato lama e altri utensili.
- Aggiunto controllo con solido di collisione per verificare di non salire oltre il massimo
- Corretta simulazione scambio testa 3 -> testa 1
2024-04-23 15:48:27 +02:00
andrea.villa 557bfcbe74 Ripristinato movimento iniziale testa sopra assieme alle pinze. 2024-04-22 10:25:39 +02:00
andrea.villa 6ac8ad5bfd - Modificato movimenti testa sotto. Prima si muove in quota 'ParkMchY2'.
- Per lavorazioni in doppio, viene subito scritta la quota Z.
2024-04-17 11:02:19 +02:00
andrea.villa b3b4061a07 Chiamando la macchina con un nome che termini con '.TEST' si abilita come macchina per test interni 2024-04-15 12:45:18 +02:00
andrea.villa 7b00a25b15 Aggiunto parametro 'IS_TEST_MACHINE' per test interni 2024-04-12 09:26:46 +02:00
andrea.villa 918ba0f7e5 Merge branch 'main' into develop 2024-04-09 11:48:57 +02:00
andrea.villa c7a867746c Merge remote-tracking branch 'origin/develop' 2024-04-09 11:48:48 +02:00
andrea.villa e795838473 - Corretto posizionamento assi in home se primo utensile punta lunga 2024-04-09 11:48:36 +02:00
andrea.villa 8d8d06022a - Corretto impostazione piano G24
- Corretta posizione prelievo/parcheggio se lama su aggregato da sotto
- Aggiunta variabile 'ForceToCloseRollersGate' per forzare chiusura paratie rulli
- Corretta scrittura lista utensili iniziale M992
-  Corretto movimento punte lunghe
- Corretto adeguamento speed aggregato lama da sotto
- Aumentato numero riposizionamenti possibili a 10
2024-04-09 09:58:09 +02:00
andrea.villa 3dc67b0861 Merge branch 'main' into develop 2024-03-26 13:28:18 +01:00
andrea.villa b291bc488b Merge branch 'develop' 2024-03-26 13:28:03 +01:00
andrea.villa c65aff1bed - Modificate collisioni traversa. Ora non comprende carro X1, il quale ha il proprio oggetto di collisione
- Aggiornati log per versione
2024-03-26 13:27:54 +01:00
andrea.villa 5f0f2a5961 Aggiunta gestione parametro "SECDIST" 2024-03-26 08:54:27 +01:00
andrea.villa d75d1ca9ea Corretto primo movimento in rapido della lavorazione per testa sotto 2024-03-21 11:42:50 +01:00
andrea.villa 2b23501bf6 Merge branch 'main' into develop 2024-03-14 09:09:58 +01:00
andrea.villa f0dcfb4b92 Merge branch 'develop' 2024-03-14 09:09:40 +01:00
andrea.villa 05f0d95c87 Migliorata preselezione utensile 2024-03-14 09:09:26 +01:00
andrea.villa b00c0e1213 Miglioramento visualizzazione spigoli VMILL alla fine della simulazione 2024-03-12 14:50:53 +01:00
andrea.villa 8084c2843e Merge branch 'main' into develop 2024-03-12 12:51:40 +01:00
andrea.villa 33b6c92e9a Merge branch 'develop' 2024-03-12 12:51:30 +01:00
andrea.villa 4f6d50c76b Migliorata gestione movimenti con lama su aggregato su testa sotto 2024-03-12 12:51:23 +01:00
andrea.villa c028617d57 Merge branch 'main' into develop 2024-03-04 10:32:35 +01:00
5 changed files with 915 additions and 244 deletions
+416 -117
View File
@@ -40,14 +40,17 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnProgramStart() function OnProgramStart()
-- aggiungo prefisso per commentae commenti iniziali se la macchina è utilizzata per fare i test
local sPrefixCommentLine = '' ; if IS_TEST_MACHINE or EgtEndsWith( EgtGetCurrMachineDir(), '.TEST') then sPrefixCommentLine = '//' end
-- Intestazioni -- Intestazioni
if EMT.INFO then if EMT.INFO then
MyOutput( '('..EMT.INFO..')') MyOutput( sPrefixCommentLine..'('..EMT.INFO..')')
else else
MyOutput( '(Program Start)') MyOutput( '(Program Start)')
end end
MyOutput( '('.. CSP_INFO..')') MyOutput( sPrefixCommentLine..'('.. CSP_INFO..')')
MyOutput( '('.. MACHINE_INFO..')') MyOutput( sPrefixCommentLine..'('.. MACHINE_INFO..')')
-- Se modalità test, aggiungo linee per muovere tappeto e alzare la testa (in automatico viene fatto dal main residente) -- Se modalità test, aggiungo linee per muovere tappeto e alzare la testa (in automatico viene fatto dal main residente)
if TEST_USE then if TEST_USE then
@@ -106,8 +109,20 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnToolData() function OnToolData()
-- emissione dati utensile (esclusa sega a catena) -- emissione dati utensile
if EMT.HEAD ~= 'H13' then -- lama su aggregato da sotto
if EMT.HEAD == 'H22' then
-- recupero posizione lama
local dPosBase = tonumber( AdjustTcPos( false, EMT.TCPOS, 0))
dAddLen = SawUnderOffsZ
local sData = ' P2=' .. EmtLenToString( dAddLen + EMT.TLEN, 3) .. ' P3=' .. EmtLenToString( EMT.TDIAM, 3) ..
' P4=' .. EmtLenToString( EMT.SMAX, 3) .. ' P5=' .. EmtLenToString( dAddLen + EMT.TTOTLEN, 3)
MyOutput( 'M992 P1='..tostring( dPosBase).. sData)
MyOutput( 'M992 P1='..tostring( dPosBase+1).. sData)
MyOutput( 'M992 P1='..tostring( dPosBase+2).. sData)
MyOutput( 'M992 P1='..tostring( dPosBase+3).. sData)
-- altri utensili tranne sega a catena
elseif EMT.HEAD ~= 'H13' then
local dAddLen = 0 local dAddLen = 0
if EMT.HEAD == 'H12' then if EMT.HEAD == 'H12' then
dAddLen = -SawOffsZ dAddLen = -SawOffsZ
@@ -119,13 +134,15 @@ function OnToolData()
MyOutput( sOut) MyOutput( sOut)
-- emissione dati sega a catena -- emissione dati sega a catena
else else
-- recupero posizione motosega
local dPosBase = tonumber( AdjustTcPos( false, EMT.TCPOS, 0))
if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end
local sData = ' P2=' .. EmtLenToString( ( EMT.TDIST or ChSawLen), 3) .. ' P3=' .. EmtLenToString( EMT.TLEN, 3) .. local sData = ' P2=' .. EmtLenToString( ( EMT.TDIST or ChSawLen), 3) .. ' P3=' .. EmtLenToString( EMT.TLEN, 3) ..
' P4=' .. EmtLenToString( EMT.SMAX, 3) .. ' P5=' .. EmtLenToString( ( EMT.TDIST or ChSawLen), 3) ' P4=' .. EmtLenToString( EMT.SMAX, 3) .. ' P5=' .. EmtLenToString( ( EMT.TDIST or ChSawLen), 3)
MyOutput( 'M992 P1=101' .. sData) MyOutput( 'M992 P1='..tostring( dPosBase).. sData)
MyOutput( 'M992 P1=102' .. sData) MyOutput( 'M992 P1='..tostring( dPosBase+1).. sData)
MyOutput( 'M992 P1=103' .. sData) MyOutput( 'M992 P1='..tostring( dPosBase+2).. sData)
MyOutput( 'M992 P1=104' .. sData) MyOutput( 'M992 P1='..tostring( dPosBase+3).. sData)
end end
end end
@@ -149,7 +166,7 @@ function OnDispositionStart()
' P15='..EmtLenToString( -DeltaTabY, 2)..' P16='..EmtLenToString( DeltaTabZ - MillOffs, 2).. ' P15='..EmtLenToString( -DeltaTabY, 2)..' P16='..EmtLenToString( DeltaTabZ - MillOffs, 2)..
' P17='..EmtLenToString( Delta2TabY, 2)..' P18='..EmtLenToString( -Delta2TabZ - Mill2Offs, 2) ' P17='..EmtLenToString( Delta2TabY, 2)..' P18='..EmtLenToString( -Delta2TabZ - Mill2Offs, 2)
-- se è in configurazione a 3 teste -- se è in configurazione a 3 teste
if EgtGetHeadId( 'H31') then if IsHeadExisting( 3) then
sOut = sOut .. ' P19='..EmtLenToString( -Delta3TabY, 2)..' P20='..EmtLenToString( Delta3TabZ - Mill3Offs, 2).. sOut = sOut .. ' P19='..EmtLenToString( -Delta3TabY, 2)..' P20='..EmtLenToString( Delta3TabZ - Mill3Offs, 2)..
' P21='..EmtLenToString( Mill3Offs, 2).. ' P22='.. EmtLenToString( -ParkInLavZ2, 2) ' P21='..EmtLenToString( Mill3Offs, 2).. ' P22='.. EmtLenToString( -ParkInLavZ2, 2)
else else
@@ -368,20 +385,6 @@ function OnToolSelect()
if MCH_TP.DIST then EMT.TDIST = EgtTdbGetCurrToolParam( MCH_TP.DIST) end if MCH_TP.DIST then EMT.TDIST = EgtTdbGetCurrToolParam( MCH_TP.DIST) end
if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
-- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD)
-- per gruppo testa 1
if nSetHead == 1 then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
-- per gruppo testa 2
elseif nSetHead == 2 then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
end
end end
end end
@@ -394,6 +397,8 @@ 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.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
if EMT.HEAD == 'H13' then if EMT.HEAD == 'H13' then
-- valore dell'asse virtuale -- valore dell'asse virtuale
@@ -404,16 +409,24 @@ function OnMachiningStart()
-- se lama su aggregato testa sotto, aggiusto subito angolo scelto per asse virtuale A -- se lama su aggregato testa sotto, aggiusto subito angolo scelto per asse virtuale A
elseif EMT.HEAD == 'H22' then elseif EMT.HEAD == 'H22' then
-- valore dell'asse virtuale -- valore dell'asse virtuale
local dPrevA = dPosA
dPosA = GetCurrSawingVirtualAxis() dPosA = GetCurrSawingVirtualAxis()
-- imposto home dell'asse C2 (A=0 -> T201, A=90 -> T204) -- imposto home dell'asse C2 (A=0 -> T201, A=90 -> T204)
local MyParkCSawC2 = GetSawCHomeFromVirtualAxis( dPosA) local MyParkCSawC2 = GetSawCHomeFromVirtualAxis( dPosA)
EmtModifyAxisHome( 'C2', MyParkCSawC2) EmtModifyAxisHome( 'C2', MyParkCSawC2)
-- se lavorazione attuale e precedente con lama su aggregato da sotto con angolo A diverso, devo scaricare e ricaricare
if EMT.HEAD == EMT.PREVHEAD_H2 then
if abs( dPosA - dPrevA) > 1 then
EMT.TO_ZMAX = true
EMT.R3_CHANGED = true
end
end
end end
-- gestione eventuale lavorazione in doppio -- gestione eventuale lavorazione in doppio
local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i') local nDouType = EgtGetValInNotes( EMT.MCHUSERNOTES, 'DOUBLE', 'i')
if nDouType == 2 or nDouType == 3 then if nDouType == 2 or nDouType == 3 then
local sDouTool = EgtGetValInNotes( EMT.TUSERNOTES, 'DOUBLE', 's') or '' local sDouTool = EgtGetValInNotes( EMT.MCHUSERNOTES, 'TOOLDOUBLE', 's') or EgtGetValInNotes( EMT.TUSERNOTES, 'DOUBLE', 's') or ''
local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME) local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if EgtTdbSetCurrTool( sDouTool) and EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then if EgtTdbSetCurrTool( sDouTool) and EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
-- salvo dati -- salvo dati
@@ -462,18 +475,18 @@ function OnMachiningEnd()
EmitRemark( 'PART UNLOAD') EmitRemark( 'PART UNLOAD')
elseif EMT.AUXTYPE == 'P' then elseif EMT.AUXTYPE == 'P' then
if EMT.PREROT then if EMT.PREROT then
EmitZmax( false, true, EMT.R1, EMT.R2) EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true EMT.ZMAX = true
EmitRemark( 'PART ROTATION') EmitRemark( 'PART ROTATION')
elseif EMT.FALL then elseif EMT.FALL then
if EMT.TO_ZMAX and not EMT.ZMAX then if EMT.TO_ZMAX and not EMT.ZMAX then
EmitZmax( false, true, EMT.R1, EMT.R2) EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true EMT.ZMAX = true
EMT.TO_ZMAX = nil EMT.TO_ZMAX = nil
end end
EmitRemark( 'PART FALL') EmitRemark( 'PART FALL')
else else
EmitZmax( false, true, EMT.R1, EMT.R2) EmitZmax( false, true, EMT.R1, EMT.R2, false, false, false)
EMT.ZMAX = true EMT.ZMAX = true
EmitRemark( 'PART SPLIT 2') EmitRemark( 'PART SPLIT 2')
end end
@@ -522,6 +535,25 @@ function OnMachiningEnd()
EMT.PREVTOOL = EMT.TOOL EMT.PREVTOOL = EMT.TOOL
if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end
EMT.DOU_TYPE = nil EMT.DOU_TYPE = nil
-- se taglio finale, aggiorno lunghezza barra
if EMT.MCHCUT then
EMT.LB = EMT.LT + ( EMT.X_OFF or 0)
end
-- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD)
-- per gruppo testa 1
if nSetHead == 1 then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
--EMT.PREVTCPOSREAL_H1 = EMT.TCPOSREAL
-- per gruppo testa 2
elseif nSetHead == 2 then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
--EMT.PREVTCPOSREAL_H2 = EMT.TCPOSREAL
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -537,10 +569,12 @@ function OnPathStart()
--MyOutput( 'CNT='.. tostring( EMT.CNT or 0)) --MyOutput( 'CNT='.. tostring( EMT.CNT or 0))
-- se utensile non cambiato, salvo eventuali precedenti rotanti -- se utensile non cambiato, salvo eventuali precedenti rotanti
if EMT.TOOL == EMT.PREVTOOL and not EMT.ZMAX then if EMT.TOOL == EMT.PREVTOOL and not EMT.ZMAX then
EMT.L2pp = EMT.L2op
EMT.L3pp = EMT.L3op EMT.L3pp = EMT.L3op
EMT.R1pp = EMT.R1p EMT.R1pp = EMT.R1p
EMT.R2pp = EMT.R2p EMT.R2pp = EMT.R2p
else else
EMT.L2pp = nil
EMT.L3pp = nil EMT.L3pp = nil
EMT.R1pp = nil EMT.R1pp = nil
EMT.R2pp = nil EMT.R2pp = nil
@@ -556,6 +590,10 @@ function OnPathEnd()
if not EMT.ZMAX then if not EMT.ZMAX then
EmitResetMachining() EmitResetMachining()
end end
-- salvo dati precedenti
EMT.L2pp = EMT.L2o
EMT.AUXTYPE = nil EMT.AUXTYPE = nil
EMT.UNL = nil EMT.UNL = nil
EMT.PREROT = nil EMT.PREROT = nil
@@ -666,7 +704,7 @@ function OnRapid()
EMT.V2POS = ParkV2 EMT.V2POS = ParkV2
-- primo posizionamento -- primo posizionamento
local Speed = EMT.S local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' or EMT.HEAD == 'H22' then Speed = 1.65 * EMT.S end
local bOnlyCharY = true local bOnlyCharY = true
for i = 1, #EMT.AUXCMD do for i = 1, #EMT.AUXCMD do
ProcessPathStartAux( EMT.AUXCMD[i], i) ProcessPathStartAux( EMT.AUXCMD[i], i)
@@ -688,7 +726,12 @@ function OnRapid()
-- se testa 1 -- se testa 1
if nHSet == 1 then if nHSet == 1 then
-- selezione testa (posso muovere X solo a Zmax) -- selezione testa (posso muovere X solo a Zmax)
local MaxZ1 = EgtGetAxisMax( 'Z1') local MyMaxZ1 = EgtGetAxisMax( 'Z1')
-- in caso di rotazione della lama lontano dalla posizione di home degli assi rotanti
local bXSpec = EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY))
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MyMaxZ1, S=Speed})
EmitMoveStartHead( 1)
EmitMoveWaitHead( 1)
EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3)) EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3))
-- se necessario allargo le cabine -- se necessario allargo le cabine
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, EMT.R1, EMT.R2) or if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, EMT.R1, EMT.R2) or
@@ -696,14 +739,12 @@ function OnRapid()
local dPosT = EMT.TPOS or EMT.L1op local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bSplitCut) EmitParkRoller( dPosT, bSplitCut)
end end
-- in caso di rotazione della lama lontano dalla posizione di home degli assi rotanti
if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( PrevR1 - EMT.R1) > 1 or abs( PrevR2 - EMT.R2) > 1) and ( abs( HomeR1 - EMT.R1) > 30.1 or abs( HomeR2 - EMT.R2) > 30.1) then if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( PrevR1 - EMT.R1) > 1 or abs( PrevR2 - EMT.R2) > 1) and ( abs( HomeR1 - EMT.R1) > 30.1 or abs( HomeR2 - EMT.R2) > 30.1) then
local bXSpec = EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY))
-- se bisogna scrivere tutti gli assi -- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, B=ParkB1, C=ParkC1, S=Speed}) EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MyMaxZ1, B=ParkB1, C=ParkC1, S=Speed})
else else
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, S=Speed}) EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MyMaxZ1, S=Speed})
end end
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})
@@ -718,7 +759,12 @@ function OnRapid()
EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=HomeZ1, B=HomeR2, C=HomeR1, TRad=dTRad, TLen=dTLen, S=Speed}) EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=HomeZ1, B=HomeR2, C=HomeR1, TRad=dTRad, TLen=dTLen, S=Speed})
-- utensili standard -- utensili standard
else else
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=EMT.L3, B=ParkB1, C=ParkC1, S=Speed}) -- utensili lunghi
if EMT.TTOTLEN > LongTool then
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=EMT.L3, B=ParkLongB1, C=ParkLongTc1C1, S=Speed})
else
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=EMT.L3, B=ParkB1, C=ParkC1, S=Speed})
end
end end
end end
if EMT.HEAD ~= 'H13' then if EMT.HEAD ~= 'H13' then
@@ -777,9 +823,21 @@ function OnRapid()
-- selezione testa (non posso muovere X) -- selezione testa (non posso muovere X)
-- se bisogna scrivere tutti gli assi -- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=ParkX2, Z=ParkZ2, B=ParkB2, C=ParkC2, S=Speed}) if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { X=ParkSawX2, Z=ParkZ2, B=0, C=ParkC2, S=Speed})
EMT.L2pp = ParkSawX2
else
EmitMoveDataHead( 2, { X=ParkX2, Z=ParkZ2, B=ParkB2, C=ParkC2, S=Speed})
EMT.L2pp = ParkX2
end
else else
EmitMoveDataHead( 2, { X=ParkX2, S=Speed}) if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { X=ParkSawX2, S=Speed})
EMT.L2pp = ParkSawX2
else
EmitMoveDataHead( 2, { X=ParkX2, S=Speed})
EMT.L2pp = ParkX2
end
end end
EmitMoveStartHead( 2) EmitMoveStartHead( 2)
EmitMoveWaitHead( 2) EmitMoveWaitHead( 2)
@@ -790,8 +848,19 @@ function OnRapid()
local dPosT = EMT.TPOS or EMT.L1op local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bSplitCut) EmitParkRoller( dPosT, bSplitCut)
end end
EmitMoveDataHead( 2, { X=EMT.L2, Z=EMT.L3, S=Speed}) -- vado a quota sicurezza in X per permettere rotazione assi rotanti
EmitMoveDataHead( 2, { B=EMT.R2, C=EMT.R1, S=Speed}) if ( not EMT.L2pp or ( EMT.L2pp and EMT.L2pp > ParkMchY2)) and ( ParkB2 ~= EMT.R2 or ParkC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { X=ParkMchY2, Z=ParkZ2, B=ParkB2, C=ParkC2, S=Speed})
end
-- scrivo solo se gli assi rotanti sono cambiati
if EMT.HEAD == 'H22' and ( CurrB2 ~= EMT.R2 or CurrC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { B=EMT.R2, C=EMT.R1, S=Speed})
end
if EMT.ZMAX then
EmitMoveDataHead( 2, { X=EMT.L2, B=EMT.R2, C=EMT.R1, S=Speed})
else
EmitMoveDataHead( 2, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
end
EmitMoveStartHead( 2) EmitMoveStartHead( 2)
-- eventuale preselezione successiva testa 1 -- eventuale preselezione successiva testa 1
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD) PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
@@ -818,13 +887,40 @@ function OnRapid()
end end
-- eseguo movimenti -- eseguo movimenti
local Speed = EMT.S local Speed = EMT.S
EmitMoveDataHead( 3, { Z=EMT.L3, S=Speed}) -- se è macchina a 3 teste con gruppo truciolatore 4 assi
EmitMoveDataHead( 3, { B=EMT.R2, C=EMT.R1, S=Speed}) if EgtGetHeadId( 'H39') then
EmitMoveStartHead( 3) EmitMoveDataHead( 3, { Z=EMT.L3, S=Speed})
-- eventuale preselezione successiva testa 2 EmitMoveDataHead( 3, { B=EMT.R2, C=EMT.R1, S=Speed})
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD) EmitMoveStartHead( 3)
-- aspetto esecuzione movimento testa 3 -- eventuale preselezione successiva testa 2
EmitMoveWaitHead( 3) PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
-- aspetto esecuzione movimento testa 3
EmitMoveWaitHead( 3)
-- se gruppo lama dedicato, senza cambio utensile
elseif EgtGetHeadId( 'H38') then
local B3Home = EgtGetAxisHomePos( 'B3')
local C3Home = EgtGetAxisHomePos( 'C3')
EmitMoveDataHead( 3, { X=SafeX3RotAxis, S=Speed})
-- se non sono esattamente in home, devo ruotare in zona sicura
if abs( C3Home - EMT.R1) > 1 or abs( B3Home - EMT.R2) > 1 then
EMT.L3 = min( EMT.L3, SafeZ3RotAxis)
EmitMoveDataHead( 3, { Z=SafeZ3RotAxis, S=Speed})
EmitMoveDataHead( 3, { B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveDataHead( 3, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 3, { X=EMT.L2, S=Speed})
end
-- muovo in posizione finale
EmitMoveDataHead( 3, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 3)
-- eventuale preselezione successiva testa 2
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
-- aspetto esecuzione movimento testa 3
EmitMoveWaitHead( 3)
-- errore, testa non gestita
else
EmtSetLastError( 1212, "HEAD not managed")
end
end end
-- dati aggancio a trave -- dati aggancio a trave
local BhData = { T=EMT.L1, SetHead=0} local BhData = { T=EMT.L1, SetHead=0}
@@ -868,7 +964,7 @@ function OnRapid()
EmitParkedLines() EmitParkedLines()
-- se sfrido grande, emetto comando speciale -- se sfrido grande, emetto comando speciale
if EMT.HOVM > 99 then if EMT.HOVM > 99 then
if EgtGetHeadId( 'H31') then if IsHeadExisting( 3) then
MyOutput( 'M107') MyOutput( 'M107')
else else
MyOutput( ';M107') MyOutput( ';M107')
@@ -878,7 +974,18 @@ function OnRapid()
else else
--MyOutput( string.format( 'V1Pos=%.3f V2Pos=%.3f', EMT.V1POS, EMT.V2POS)) --MyOutput( string.format( 'V1Pos=%.3f V2Pos=%.3f', EMT.V1POS, EMT.V2POS))
if not EMT.RELOAD and not EMT.ZMAX and #EMT.AUXCMD > 0 and EMT.TO_ZMAX then if not EMT.RELOAD and not EMT.ZMAX and #EMT.AUXCMD > 0 and EMT.TO_ZMAX then
EmitZmax( false, false, PrevR1, PrevR2) -- caso speciale in cui bisogna solo cambiare presa aggregato lama sotto
if EMT.R3_CHANGED then
-- EmitZmax è fatta per essere chiamata con utensile attuale. In questo caso l'attuale è già quello con nuova rotazione
-- Allora salvo l'attuale e imposto il vecchio solo momentanemente, per poi ripristinarlo
local sBckTcPos = EMT.TCPOS
EMT.TCPOS = EMT.PREVTCPOSREAL_H2
EmitZmax( false, false, PrevR1, PrevR2, false, false, true)
EMT.TCPOS = sBckTcPos
EMT.R3_CHANGED = nil
else
EmitZmax( false, false, PrevR1, PrevR2, false, false, true)
end
EMT.ZMAX = true EMT.ZMAX = true
EMT.TO_ZMAX = nil EMT.TO_ZMAX = nil
PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2')) PrevR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
@@ -915,7 +1022,7 @@ function OnRapid()
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
-- se sfrido grande, emetto comando speciale -- se sfrido grande, emetto comando speciale
if EMT.LB - EMT.LT > 99 then if EMT.LB - EMT.LT > 99 then
if EgtGetHeadId( 'H31') then if IsHeadExisting( 3) then
MyOutput( 'M107') MyOutput( 'M107')
else else
MyOutput( ';M107') MyOutput( ';M107')
@@ -956,9 +1063,20 @@ function OnRapid()
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed}) EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
-- caso standard -- caso standard
else else
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed}) -- se ero in posizione speciale, prima ruoto poi scendo
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed}) if bXSpec then
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed}) local dZPos = max( HomeZ1, EMT.L3)
EmitMoveDataHead( 1, { Z=dZPos, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
if abs( dZPos - EMT.L3) > 1 then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
end
else
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
end
end end
-- altrimenti sega a catena -- altrimenti sega a catena
else else
@@ -1037,16 +1155,58 @@ function OnRapid()
local CurrB2 = PrevR2 local CurrB2 = PrevR2
local CurrC2 = PrevR1 local CurrC2 = PrevR1
local dSafeZ2 = EgtGetAxisHomePos( 'Z2') local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
local Speed = EMT.S local Speed = EMT.S * EgtIf( EMT.HEAD ~= 'H22', 1, 1.65)
if EMT.ZMAX then if not EMT.L2pp then EMT.L2pp = EgtGetAxisHomePos( 'X2') end
-- se bisogna scrivere tutti gli assi -- calcolo posizione reale
if WriteAllCoordsOnFirstM101 then EMT.TCPOSREAL = 'T' .. AdjustTcPos( false, EMT.TCPOS, EMT.R3)
EmitMoveDataHead( 2, { X=SafeX2, Z=CurrZ2, B=CurrB2, C=CurrC2, S=Speed}) -- se utensile cambiato (controllo il reale perchè per aggregato dipende come è stato caricato)
if EMT.PREVTCPOSREAL_H2 ~= EMT.TCPOSREAL then
if EMT.ZMAX then
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { X=ParkSawX2, Z=-dSafeZ2, B=0, C=CurrC2, S=Speed})
EMT.L2pp = ParkSawX2
else
EmitMoveDataHead( 2, { X=SafeX2, Z=-dSafeZ2, B=CurrB2, C=CurrC2, S=Speed})
EMT.L2pp = SafeX2
end
else
if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { X=ParkSawX2, S=Speed})
EMT.L2pp = ParkSawX2
else
EmitMoveDataHead( 2, { X=SafeX2, S=Speed})
EMT.L2pp = SafeX2
end
end
-- scrivo solo se gli assi rotanti sono cambiati
EmitMoveDataHead( 2, { Z=-dSafeZ2, S=Speed})
if EMT.L2pp > ParkMchY2 and ( CurrB2 ~= EMT.R2 or CurrC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { X=ParkMchY2, Z=-dSafeZ2, B=CurrB2, C=CurrC2, S=Speed})
end
else
-- scrivo solo se gli assi rotanti sono cambiati
if EMT.L2pp > ParkMchY2 and ( CurrB2 ~= EMT.R2 or CurrC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { X=ParkMchY2, Z=-dSafeZ2, B=CurrB2, C=CurrC2, S=Speed})
end
end
-- se stesso utensile vado già alla X di lavoro
else
-- scrivo solo se gli assi rotanti sono cambiati
if EMT.ZMAX and EMT.L2pp > ParkMchY2 and ( CurrB2 ~= EMT.R2 or CurrC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { X=ParkMchY2, Z=-dSafeZ2, B=CurrB2, C=CurrC2, S=Speed})
end end
EmitMoveDataHead( 2, { Z=-dSafeZ2, S=Speed})
EmitMoveDataHead( 2, { X=EMT.L2, S=Speed})
end end
EmitMoveDataHead( 2, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed}) -- scrivo solo se gli assi rotanti sono cambiati
if EMT.HEAD == 'H22' and ( CurrB2 ~= EMT.R2 or CurrC2 ~= EMT.R1) then
EmitMoveDataHead( 2, { B=EMT.R2, C=EMT.R1, S=Speed})
end
if EMT.ZMAX then
EmitMoveDataHead( 2, { X=EMT.L2, B=EMT.R2, C=EMT.R1, S=Speed})
else
EmitMoveDataHead( 2, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
end
EmitMoveStartHead( 2) EmitMoveStartHead( 2)
-- eventuale preselezione successiva testa 1 -- eventuale preselezione successiva testa 1
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD) PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
@@ -1060,20 +1220,43 @@ function OnRapid()
local HomeC3 = EgtGetAxisHomePos( 'C3') local HomeC3 = EgtGetAxisHomePos( 'C3')
local HomeB3 = EgtGetAxisHomePos( 'B3') local HomeB3 = EgtGetAxisHomePos( 'B3')
local Speed = EMT.S local Speed = EMT.S
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then -- se è macchina a 3 teste con gruppo truciolatore 4 assi
local CurrB3 = PrevR2 if EgtGetHeadId( 'H39') then
local CurrC3 = PrevR1 if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
-- se bisogna scrivere tutti gli assi local CurrB3 = PrevR2
if WriteAllCoordsOnFirstM101 then local CurrC3 = PrevR1
EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, B=CurrB3, C=CurrC3, S=Speed}) -- se bisogna scrivere tutti gli assi
else if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, S=Speed}) EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, B=CurrB3, C=CurrC3, S=Speed})
end else
EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, S=Speed})
end
EmitMoveDataHead( 3, { Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed}) EmitMoveDataHead( 3, { Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
else else
EmitMoveDataHead( 3, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
end
-- se gruppo lama dedicato, senza cambio utensile
elseif EgtGetHeadId( 'H38') then
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local B3Home = EgtGetAxisHomePos( 'B3')
local C3Home = EgtGetAxisHomePos( 'C3')
EmitMoveDataHead( 3, { X=SafeX3RotAxis, S=Speed})
-- se non sono esattamente in home, devo ruotare in zona sicura
if abs( C3Home - EMT.R1) > 1 or abs( B3Home - EMT.R2) > 1 then
EMT.L3 = min( EMT.L3, SafeZ3RotAxis)
EmitMoveDataHead( 3, { Z=SafeZ3RotAxis, S=Speed})
EmitMoveDataHead( 3, { B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveDataHead( 3, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 3, { X=EMT.L2, S=Speed})
end
end
-- muovo in posizione finale
EmitMoveDataHead( 3, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed}) EmitMoveDataHead( 3, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
else
EmtSetLastError( 1212, "HEAD not managed")
end end
EmitMoveStartHead( 3) EmitMoveStartHead( 3)
-- eventuale preselezione successiva testa 2 -- eventuale preselezione successiva testa 2
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD) PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
@@ -1131,11 +1314,15 @@ function OnRapid()
EMT.L2 = -EMT.L2 EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina -- emetto movimenti in Zero macchina
local Speed = EMT.S local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' or EMT.HEAD == 'H22' then Speed = 1.65 * EMT.S end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed}) EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1) EmitMoveStartHead( 1)
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN + EgtIf( BD.RIGHT_LOAD, -EMT.HB, EMT.HB)) 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 dZ2 = -Head2Z + MillOffs + Mill2Offs + EMT.L3
-- dato che la testa 2 è slave, bisogna controllare eventuale extra-corsa da post
if dZ2 > MaxZ2 then
EmtSetLastError( 1220, EMT.MCHNAME..' ==> Out of Stroke: Z2 : '.. EgtNumToString( dZ2-MaxZ2, 2))
end
local dC2 = EMT.R1 local dC2 = EMT.R1
local dB2 = EMT.R2 local dB2 = EMT.R2
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED}) EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
@@ -1151,7 +1338,7 @@ function OnRapid()
EMT.L2 = -EMT.L2 EMT.L2 = -EMT.L2
-- emetto movimenti in Zero macchina -- emetto movimenti in Zero macchina
local Speed = EMT.S local Speed = EMT.S
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' or EMT.HEAD == 'H22' then Speed = 1.65 * EMT.S end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed}) EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1) EmitMoveStartHead( 1)
local dX2 = -Head2Y - EMT.L2 local dX2 = -Head2Y - EMT.L2
@@ -1183,6 +1370,14 @@ function OnRapid()
EMT.R1p = nil EMT.R1p = nil
EMT.R2p = nil EMT.R2p = nil
else else
-- se lavorazione in doppio controllo le corse
if EMT.DOU_TYPE == 2 then
local dZ2 = -Head2Z + MillOffs + Mill2Offs + EMT.L3
-- dato che la testa 2 è slave, bisogna controllare eventuale extra-corsa da post
if dZ2 > MaxZ2 then
EmtSetLastError( 1220, EMT.MCHNAME..' ==> Out of Stroke: Z2 : '.. EgtNumToString( dZ2-MaxZ2, 2))
end
end
MyAdjustLinearAxes() MyAdjustLinearAxes()
EmtAdjustRotaryAxes() EmtAdjustRotaryAxes()
end end
@@ -1205,10 +1400,10 @@ function OnRapid()
EmtAdjustRotaryAxes() EmtAdjustRotaryAxes()
-- se Split lascio agganciata solo la pinza Y2 alla fine dei movimenti -- se Split lascio agganciata solo la pinza Y2 alla fine dei movimenti
local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil) local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil)
-- se lavorazione successiva sopra con testa diversa, porto in home la testa corrente -- porto in home la testa corrente se lavorazione successiva sopra con testa diversa oppure se punta lunga
local nNextTopHSet = GetNextTopHSet( EMT.MCHID) local nNextTopHSet = GetNextTopHSet( EMT.MCHID)
local bTopGoHome = ( nHSet ~= 2 and nNextTopHSet ~= 0 and nHSet ~= nNextTopHSet) local bTopGoHome = ( nHSet ~= 2 and nNextTopHSet ~= 0 and nHSet ~= nNextTopHSet) or ( nHSet == 1 and EMT.TTOTLEN > LongTool)
EmitZmax( true, true, EMT.R1p, EMT.R2p, bSplitCut, bTopGoHome) EmitZmax( true, true, EMT.R1p, EMT.R2p, bSplitCut, bTopGoHome, false)
-- aggiorno quota finale trave dopo Zmax -- aggiorno quota finale trave dopo Zmax
EMT.L1o = EMT.TPOS EMT.L1o = EMT.TPOS
EMT.ZMAX = true EMT.ZMAX = true
@@ -1316,6 +1511,54 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnArc() function OnArc()
-- se necessario, impostazione riferimento locale
if EMT.REFLOC == 0 then
-- 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 (se presente devo annullare l'offset in X per sovramateriale di testa)
EMT.L1 = EMT.L1o
EMT.L2 = EMT.L2o
EMT.L3 = EMT.L3o
if EMT.X_OFF then EMT.L1 = EMT.L1 - EMT.X_OFF end
-- trasformo i punti nel piano
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..GetHeadSetCode()..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M98')
MyOutput( 'M6 ' .. GetHeadToolCode() .. AdjustTcPos( true))
MyOutput( 'G24' .. EMT.IPLGLSTR)
-- emissione movimento
EMT.R1p = nil
EMT.R2p = nil
if EmitRapidInG1 then
local sFeed = ' F30000'
sOut = 'G1'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')..sFeed
else
sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
end
MyOutput( sOut)
-- aggiorno precedenti
local nOriginalMove = EMT.MOVE
EMT.MOVE = 0
EmtUpdatePrev()
EMT.MOVE = nOriginalMove
-- ripristino posizione attuale
EMT.L1 = OldL1
EMT.L2 = OldL2
EMT.L3 = OldL3
end
-- se primo movimento in feed della lavorazione, dichiaro inizio lavorazione -- se primo movimento in feed della lavorazione, dichiaro inizio lavorazione
if EMT.MCHFIRSTFEED then if EMT.MCHFIRSTFEED then
EMT.MCHFIRSTFEED = nil EMT.MCHFIRSTFEED = nil
@@ -1358,7 +1601,7 @@ end
function CalcDinamicaPinze( dH, dS, dL) function CalcDinamicaPinze( dH, dS, dL)
local MinTempoAcc = 0.6 -- [s] local MinTempoAcc = 0.6 -- [s]
local MaxTempoAcc = 6.0 -- [s] local MaxTempoAcc = 6.0 -- [s]
local KgMtCubo= 550 -- densità legno [Kg / metro cubo] local KgMtCubo= WoodDensity or 550 -- densità legno [Kg / metro cubo]
local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg] local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg]
local FMaxPinze = EMT.FMAXPINZE -- Feed massima pinze [mm/min] 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 ForzaAttrito = 350 * 9.8 * 0.2 -- Forza chiusura pinze [Kgf] * g * Coeff_Attrito -> [N]
@@ -1383,7 +1626,7 @@ function CalcForzaPinze( dH, dS, dL, dT)
if dMinJoin < 0.9 * BD.MIN_JOIN_L then if dMinJoin < 0.9 * BD.MIN_JOIN_L then
return MinForzaPinze return MinForzaPinze
else else
local KgMtCubo= 550 -- densità legno [Kg / metro cubo] local KgMtCubo= WoodDensity or 550 -- densità legno [Kg / metro cubo]
local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg] local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg]
local Forza = Massa / MassaRef * MaxForzaPinze local Forza = Massa / MassaRef * MaxForzaPinze
return EgtClamp( Forza, MinForzaPinze, MaxForzaPinze) return EgtClamp( Forza, MinForzaPinze, MaxForzaPinze)
@@ -1990,7 +2233,7 @@ function MyAdjustLinearAxes()
elseif nHSet == 2 then elseif nHSet == 2 then
local dAddLen = 0 local dAddLen = 0
if EMT.HEAD == 'H22' then if EMT.HEAD == 'H22' then
dAddLen = -Saw2OffsZ dAddLen = SawUnderOffsZ
end end
local Len = EMT.TLEN + dAddLen + Mill2Offs local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs local LenRef = Mill2Offs
@@ -2072,17 +2315,17 @@ function AdjustTcPos( bLen3, sTcPos, dAxR3)
if not dAxR3 then dAxR3 = EMT.R3 end if not dAxR3 then dAxR3 = EMT.R3 end
if abs( dAxR3 - 0) < 0.1 then if abs( dAxR3 - 0) < 0.1 then
sPos = '201' sPos = '201'
elseif abs( dAxR3 - 270) < 0.1 then
sPos = '202'
elseif abs( dAxR3 - 180) < 0.1 then
sPos = '203'
elseif abs( dAxR3 - 90) < 0.1 then elseif abs( dAxR3 - 90) < 0.1 then
sPos = '204' sPos = '204'
-- Lama su aggregato da sotto non può essere presa in queste posizioni per problemi di collisione durante parcheggio
--elseif abs( dAxR3 - 270) < 0.1 then
-- sPos = '202'
--elseif abs( dAxR3 - 180) < 0.1 then
-- sPos = '203'
else else
EmtSetLastError( 1210, 'Saw orientation not allowed') EmtSetLastError( 1210, 'Saw orientation not allowed')
end end
end end
return sPos return sPos
end end
@@ -2117,7 +2360,8 @@ function CalcInterpPlane()
local vtX = EMT.IPLGLFR:getVersX() local vtX = EMT.IPLGLFR:getVersX()
local vtY = EMT.IPLGLFR:getVersY() local vtY = EMT.IPLGLFR:getVersY()
local vtZ = EMT.IPLGLFR:getVersZ() local vtZ = EMT.IPLGLFR:getVersZ()
if EMT.HEAD ~= 'H21' then local nHSet = GetHeadSet( EMT.HEAD)
if nHSet ~= 2 then
EMT.IPLGLSTR = ' X0 Y' .. EmtLenToString( xS, EMT.DECNUM) .. ' Z0' .. EMT.IPLGLSTR = ' X0 Y' .. EmtLenToString( xS, EMT.DECNUM) .. ' Z0' ..
' A' .. EgtNumToString( -vtX:getY(), 6) .. ' B' .. EgtNumToString( vtX:getX(), 6) .. ' C' .. EgtNumToString( vtX:getZ(), 6) .. ' A' .. EgtNumToString( -vtX:getY(), 6) .. ' B' .. EgtNumToString( vtX:getX(), 6) .. ' C' .. EgtNumToString( vtX:getZ(), 6) ..
' I' .. EgtNumToString( -vtY:getY(), 6) .. ' J' .. EgtNumToString( vtY:getX(), 6) .. ' K' .. EgtNumToString( vtY:getZ(), 6) .. ' I' .. EgtNumToString( -vtY:getY(), 6) .. ' J' .. EgtNumToString( vtY:getX(), 6) .. ' K' .. EgtNumToString( vtY:getZ(), 6) ..
@@ -2171,11 +2415,12 @@ function GetHeadToolCode()
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome) function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome, bUsePrevDelta)
if bReset then if bReset then
EmitResetMachining() EmitResetMachining()
end end
local nSetHead = GetHeadSet( EMT.HEAD) local nSetHead = GetHeadSet( EMT.HEAD)
local dXPos = EgtIf( bUsePrevDelta, EMT.L2pp or EMT.L2o, EMT.L2o)
-- se testa 1 -- se testa 1
if nSetHead == 1 then if nSetHead == 1 then
-- posizioni sicure -- posizioni sicure
@@ -2196,12 +2441,12 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome)
local dZref = dHomeZ1 + GetZExtra( EMT.HEAD, PrevR2) local dZref = dHomeZ1 + GetZExtra( EMT.HEAD, PrevR2)
dZref = min( dZref, dMaxZ1) dZref = min( dZref, dMaxZ1)
local MovH = { Z = EgtIf( dZref > EMT.L3o, dZref, EMT.L3o)} local MovH = { Z = EgtIf( dZref > EMT.L3o, dZref, EMT.L3o)}
MovH.X = -EMT.L2o ; MovH.B = EgtClamp( PrevR2, -90, 90) ; MovH.C = PrevR1 ; MovH.X = -dXPos ; MovH.B = EgtClamp( PrevR2, -90, 90) ; MovH.C = PrevR1 ;
EmitMoveDataHead( 1, MovH) EmitMoveDataHead( 1, MovH)
if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( dHomeC1 - PrevR1) > 30.1 or abs( dHomeB1 - PrevR2) > 30.1) then if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( dHomeC1 - PrevR1) > 30.1 or abs( dHomeB1 - PrevR2) > 30.1) then
EmitMoveDataHead( 1, { Z=dMaxZ1, B=0, Fmt=1}) EmitMoveDataHead( 1, { Z=dMaxZ1, B=0, Fmt=1})
end end
if EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY)) then if EgtIf( BD.RIGHT_LOAD, ( -dXPos > -DeltaTabY), ( -dXPos < -DeltaTabY)) then
EmitMoveDataHead( 1, { X=-DeltaTabY, Fmt=1}) EmitMoveDataHead( 1, { X=-DeltaTabY, Fmt=1})
end end
EmitMoveDataHead( 1, { C=dHomeC1, Fmt=1}) EmitMoveDataHead( 1, { C=dHomeC1, Fmt=1})
@@ -2224,16 +2469,11 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome)
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1) local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
EmitMoveDataHead( 1, { Z=dSafeZ1, B=dHomeB1, Fmt=1}) EmitMoveDataHead( 1, { Z=dSafeZ1, B=dHomeB1, Fmt=1})
EmitMoveDataHead( 1, { X=-dHomeX1, C=dHomeC1, Fmt=1}) EmitMoveDataHead( 1, { X=-dHomeX1, C=dHomeC1, Fmt=1})
if bTopGoHome then
-- !!! da verificare bene (come PF) !!!
EmitMoveDataHead( 1, { X=-ParkX1, TPos=50, Fmt=1})
end
EmitMoveStartHead( 1) EmitMoveStartHead( 1)
EmitMoveWaitHead( 1) EmitMoveWaitHead( 1)
end end
-- se altrimenti testa 2 -- se altrimenti testa 2
elseif nSetHead == 2 then elseif nSetHead == 2 then
-- posizioni sicure -- posizioni sicure
local dHomeX2 = EgtGetAxisHomePos( 'X2') local dHomeX2 = EgtGetAxisHomePos( 'X2')
local dHomeZ2 = EgtGetAxisHomePos( 'Z2') local dHomeZ2 = EgtGetAxisHomePos( 'Z2')
@@ -2247,7 +2487,15 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome)
-- eseguo la discesa a Z2max -- eseguo la discesa a Z2max
EmitMoveDataHead( 2, { Z=-dHomeZ2, Fmt=1}) EmitMoveDataHead( 2, { Z=-dHomeZ2, Fmt=1})
EmitMoveDataHead( 2, { B=dHomeB2, C=dHomeC2, Fmt=1}) EmitMoveDataHead( 2, { B=dHomeB2, C=dHomeC2, Fmt=1})
EmitMoveDataHead( 2, { X=dHomeX2, Fmt=1}) if EMT.HEAD == 'H22' then
EmitMoveDataHead( 2, { X=SafeX2, Fmt=1})
else
EmitMoveDataHead( 2, { X=dHomeX2, Fmt=1})
end
-- solo se è macchina a 3 teste con gruppo truciolatore 4 assi, devo stare più alto
if EgtGetHeadId( 'H39') then
EmitMoveDataHead( 2, { Z=-ParkInLavZ2, Fmt=1})
end
EmitMoveStartHead( 2) EmitMoveStartHead( 2)
EmitMoveWaitHead( 2) EmitMoveWaitHead( 2)
-- altrimenti testa 3 -- altrimenti testa 3
@@ -2256,14 +2504,44 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome)
local dMaxZ3 = EgtGetAxisMax( 'Z3') local dMaxZ3 = EgtGetAxisMax( 'Z3')
local dHomeX3 = EgtGetAxisHomePos( 'X3') local dHomeX3 = EgtGetAxisHomePos( 'X3')
local dHomeB3 = EgtGetAxisHomePos( 'B3') local dHomeB3 = EgtGetAxisHomePos( 'B3')
-- eseguo la salita a Z3max
EmitMoveDataHead( 3, { Z=dMaxZ3, Fmt=1}) -- se è macchina a 3 teste con gruppo truciolatore 4 assi
if bTopGoHome then if EgtGetHeadId( 'H39') then
EmitMoveDataHead( 3, { X=-dHomeX3, B=dHomeB3, Fmt=1}) -- eseguo la salita a Z3max
EmitMoveDataHead( 3, { Z=dMaxZ3, Fmt=1})
if bTopGoHome then
EmitMoveDataHead( 3, { X=-dHomeX3, B=dHomeB3, Fmt=1})
end
-- se gruppo lama dedicato, senza cambio utensile
elseif EgtGetHeadId( 'H38') then
local dHomeC3 = EgtGetAxisHomePos( 'C3')
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, dHomeC3, dHomeB3) then
local dPosT = EgtIf( bEnd, EMT.L1o, EMT.TPOS or EMT.L1op)
EmitParkRoller( dPosT, bSplitCut)
end
-- se non sono esattamente in home, devo ruotare in zona sicura
if abs( dHomeC3 - PrevR1) > 1 or abs( dHomeB3 - PrevR2) > 1 then
EmitMoveDataHead( 3, { X=SafeX3RotAxis, Fmt=1})
EmitMoveDataHead( 3, { Z=SafeZ3RotAxis, Fmt=1})
EmitMoveDataHead( 3, { B=dHomeB3, C=dHomeC3, Fmt=1})
end
-- eseguo la salita a Z3max
EmitMoveDataHead( 3, { Z=dMaxZ3, Fmt=1})
if bTopGoHome then
EmitMoveDataHead( 3, { X=-dHomeX3, Fmt=1})
end
else
EmtSetLastError( 1212, "HEAD not managed")
end end
EmitMoveStartHead( 3) EmitMoveStartHead( 3)
EmitMoveWaitHead( 3) EmitMoveWaitHead( 3)
end end
-- resetto posizione precedente assi
EMT.L2pp = nil
EMT.L3pp = nil
EMT.R1pp = nil
EMT.R2pp = nil
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -2350,7 +2628,7 @@ function EmitParkRoller( dPosT, bSplitCut)
local dPosY1 = dPosT + EMT.Y1DELTA local dPosY1 = dPosT + EMT.Y1DELTA
local DiffY1 = MyParkY1 - dPosY1 local DiffY1 = MyParkY1 - dPosY1
local dMoveY1 = EgtIf( DiffY1 > 0.1, dMoveV1, 0) local dMoveY1 = EgtIf( DiffY1 > 0.1, dMoveV1, 0)
local dTryMoveY1 = ParkV1 - dPosT - EgtIf( bSplitCut or EMT.FALL, EMT.LT, 0) local dTryMoveY1 = min( ParkV1 - dPosT - EgtIf( bSplitCut or EMT.FALL, EMT.LT, 0), MaxY1 - dPosY1 - 10)
if ( dPosT > ParkV2 - ExtraParkV and dPosT < ParkV1 and dPosY1 + dTryMoveY1 < MaxY1) then dMoveY1 = max( dMoveY1, dTryMoveY1) end if ( dPosT > ParkV2 - ExtraParkV and dPosT < ParkV1 and dPosY1 + dTryMoveY1 < MaxY1) then dMoveY1 = max( dMoveY1, dTryMoveY1) end
--MyOutput( string.format( 'PosT=%.3f PosY1=%.3f V1POS=%.3f Split=%s', dPosT, dPosY1, EMT.V1POS, EgtIf( bSplitCut, '1', '0'))) --MyOutput( string.format( 'PosT=%.3f PosY1=%.3f V1POS=%.3f Split=%s', dPosT, dPosY1, EMT.V1POS, EgtIf( bSplitCut, '1', '0')))
MDChar.Y1 = dPosY1 + dMoveY1 MDChar.Y1 = dPosY1 + dMoveY1
@@ -2362,8 +2640,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 = ParkV2 - dPosT - EMT.LT local dTryMoveY2 = max( ParkV2 - dPosT - EMT.LT - EMT.HOVM, MinY2 - dPosY2 + 10)
if ( dPosT + EMT.LT < ParkV1 + ExtraParkV and dPosT + EMT.LT > ParkV2 and dPosY2 + dTryMoveY2 > MinY2) then dMoveY2 = min( dMoveY2, dTryMoveY2) end 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
--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
@@ -2438,9 +2716,11 @@ function PreselectNextDiffHead( nMchId, sHead)
if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then return end if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then return end
-- se la Z di lavoro è più bassa del cambio della minima Z -- se la Z di lavoro è più bassa del cambio della minima Z
if EMT.MAXMIN[3] < MinZ1ToChangeH2 then if EMT.MAXMIN[3] < MinZ1ToChangeH2 then
-- se diametro utensile più del truciolatore standard grande, si rischia di collidere anche con il carro X testa sotto (quindi indipendentemente dalla Y della lavorazione)
if EMT.TTOTDIAM > 201 then return end
-- verifico quota del TC -- verifico quota del TC
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 200) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + 400) then return end if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + 200) then return end
end end
-- se preselezione testa 3 -- se preselezione testa 3
else else
@@ -2459,14 +2739,14 @@ function PreselectNextDiffHead( nMchId, sHead)
-- altrimenti se operazione su stesso TC -- altrimenti se operazione su stesso TC
else else
-- TC su montante destro oppure non so cosa c'è montato -- TC su montante destro oppure non so cosa c'è montato
if nNextTc == 1 or nPrevTc ~= 0 then if nNextTc == 1 or nPrevTc == 0 then
if BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - 400) then return end if BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - 200) then return end
if not BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - MaxHoOpen - 400) then return end if not BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - MaxHoOpen - 200) then return end
end end
-- TC su montante sinistro oppure non so cosa c'è montato -- TC su montante sinistro oppure non so cosa c'è montato
if nNextTc == 2 or nPrevTc ~= 0 then if nNextTc == 2 or nPrevTc == 0 then
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + MaxHoOpen + 400) then return end if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + MaxHoOpen + 200) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + 400) then return end if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + 200) then return end
end end
end end
end end
@@ -2478,11 +2758,13 @@ function PreselectNextDiffHead( nMchId, sHead)
else else
-- se preselezione testa 1 -- se preselezione testa 1
if nNextHSet == 1 then if nNextHSet == 1 then
-- TC su montante destro local nNextTc = GetTcForTopHeadTool( sNextTcPos) -- utensile da caricare
if nPrevTc == 1 then return local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1) -- utensile da depositare
-- se devo lasciare o prelevare da TC1 oppure non so cosa c'è montato, non posso preselezionare
if nNextTc == 1 or nPrevTc == 1 or nPrevTc == 0 then return
-- TC su montante sinistro -- TC su montante sinistro
else else
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 200) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end
end end
-- se preselezione testa 2 -- se preselezione testa 2
@@ -2491,7 +2773,7 @@ function PreselectNextDiffHead( nMchId, sHead)
if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then return end if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then return end
-- se la Z di lavoro è più bassa del cambio utensili, verifico quota X (la nostra Y) -- se la Z di lavoro è più bassa del cambio utensili, verifico quota X (la nostra Y)
if EMT.MAXMIN[3] < MinZ1ToChangeH2 then if EMT.MAXMIN[3] < MinZ1ToChangeH2 then
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 200) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end
end end
end end
@@ -2499,8 +2781,15 @@ function PreselectNextDiffHead( nMchId, sHead)
-- faccio preselezione ( se sono arrivato qui, vuol dire che posso preselezionare) -- faccio preselezione ( se sono arrivato qui, vuol dire che posso preselezionare)
if nNextHSet == 1 then if nNextHSet == 1 then
-- Recupero quota X1 (nostro L2) local dNextX
local dNextX = GetStartMachiningXaxis( nNextMchId) -- se sto lavorando con testa 3 oppure utensile lungo, la testa 1 deve restare in home
if nHSet == 3 or dNextTotLen > LongTool then
dNextX = - EgtGetAxisHomePos( 'X1')
-- altrimenti recupero quota X1 (nostro L2)
else
dNextX = GetStartMachiningXaxis( nNextMchId)
end
-- Emetto preselezione -- Emetto preselezione
if sNextHead == 'H11' then if sNextHead == 'H11' then
if dNextTotLen < LongTool then if dNextTotLen < LongTool then
@@ -2600,8 +2889,18 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function EmitMoveDataHead( nHead, MoData) function EmitMoveDataHead( nHead, MoData)
local sOut = 'M101' local sOut = 'M101'
if nHead == 2 then local sRealTcPos
if EMT.TCPOS then
sRealTcPos = AdjustTcPos( false)
end
if nHead == 1 then
sOut = 'M101'
EMT.PREVTCPOSREAL_H1 = 'T' .. sRealTcPos
elseif nHead == 2 then
sOut = 'M102' sOut = 'M102'
EMT.PREVTCPOSREAL_H2 = 'T' .. sRealTcPos
elseif nHead == 3 then elseif nHead == 3 then
sOut = 'M103' sOut = 'M103'
end end
@@ -2610,7 +2909,7 @@ function EmitMoveDataHead( nHead, MoData)
if MoData.Z then sOut = sOut .. ' P3=' .. EmtLenToString( MoData.Z, 3) end if MoData.Z then sOut = sOut .. ' P3=' .. EmtLenToString( MoData.Z, 3) end
if MoData.B then sOut = sOut .. ' P4=' .. EmtLenToString( MoData.B, 3) end if MoData.B then sOut = sOut .. ' P4=' .. EmtLenToString( MoData.B, 3) end
if MoData.C then sOut = sOut .. ' P5=' .. EmtLenToString( MoData.C, 3) end if MoData.C then sOut = sOut .. ' P5=' .. EmtLenToString( MoData.C, 3) end
if MoData.TPos then sOut = sOut .. ' P6=' .. MoData.TPos elseif EMT.TCPOS then sOut = sOut .. ' P6=' .. AdjustTcPos( false) end if MoData.TPos then sOut = sOut .. ' P6=' .. MoData.TPos elseif EMT.TCPOS then sOut = sOut .. ' P6=' .. sRealTcPos end
if MoData.S then sOut = sOut .. ' P7=' .. EgtNumToString( MoData.S, 0) end if MoData.S then sOut = sOut .. ' P7=' .. EgtNumToString( MoData.S, 0) end
if not MoData.Fmt then if not MoData.Fmt then
if MoData.F then sOut = sOut .. ' P8=' .. EmtLenToString( MoData.F, 0) else sOut = sOut .. ' P8=0' end if MoData.F then sOut = sOut .. ' P8=' .. EmtLenToString( MoData.F, 0) else sOut = sOut .. ' P8=0' end
+293 -98
View File
@@ -16,7 +16,7 @@ local sBaseDir = EgtGetCurrMachineDir()
if NumericalControl == 'NUM' then if NumericalControl == 'NUM' then
error( 'Numerical Control error : NUM not yet managed') error( 'Numerical Control error : NUM not yet managed')
elseif NumericalControl == 'TPA' then elseif NumericalControl == 'TPA' then
dofile( sBaseDir .. '\\Common-PF1250.TPA.mlpe') dofile( sBaseDir .. '\\Common_PF1250.TPA.mlpe')
else else
error( 'Numerical Control error : unkwnown type') error( 'Numerical Control error : unkwnown type')
end end
@@ -106,7 +106,7 @@ function OnSimulStart()
AddToCollisionCheck( 'X2', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'X2', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'C2', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'C2', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'B2', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'B2', 'COLLISION', EMT.COLLOBJ)
if EgtGetHeadId('H31') then if IsHeadExisting( 3) then
AddToCollisionCheck( 'Z3', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'Z3', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'C3', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'C3', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'B3', 'COLLISION', EMT.COLLOBJ) AddToCollisionCheck( 'B3', 'COLLISION', EMT.COLLOBJ)
@@ -120,12 +120,16 @@ function OnSimulStart()
{ Grp = 'Base', Sub = 'COLLISION', Name = 'COL1'}, { Grp = 'Base', Sub = 'COLLISION', Name = 'COL1'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'COL2'}, { Grp = 'Base', Sub = 'COLLISION', Name = 'COL2'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW'}, { Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'CEIL'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC1'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TC2'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'TCR'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'COL1'}, { Grp = 'Z2', Sub = 'COLLISION', Name = 'COL1'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'CHAIN'}, { Grp = 'Z2', Sub = 'COLLISION', Name = 'CHAIN'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'COL2'}} { Grp = 'Z2', Sub = 'COLLISION', Name = 'COL2'},
{ Grp = 'X1', Sub = 'COLLISION', Name = 'STM'}}
if EgtGetHeadId('H31') then if IsHeadExisting( 3) then
table.insert( McdData, { Grp = 'X1', Sub = 'COLLISION', Name = 'STM'})
table.insert( McdData, { Grp = 'X3', Sub = 'COLLISION', Name = 'STM'}) table.insert( McdData, { Grp = 'X3', Sub = 'COLLISION', Name = 'STM'})
end end
@@ -448,13 +452,16 @@ function OnSimulToolSelect( dPosA)
EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
-- recupero il gruppo -- recupero il gruppo
local nSetHead = GetHeadSet( EMT.NEXTHEAD) local nSetHead = GetHeadSet( EMT.HEAD)
-- se fresa o lama su testa 1, reset assi rotanti -- se fresa o lama su testa 1, reset assi rotanti
if nSetHead == 1 then if nSetHead == 1 then
-- se ho la testa 3, la mando a parcheggio -- se ho la testa 3, la mando a parcheggio
if EgtGetHeadId( 'H31') then if IsHeadExisting( 3) then
EgtSetAxisPos( 'X3', ParkX3) EgtSetAxisPos( 'X3', ParkX3)
end end
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then
EgtSetAxisPos( 'Z1', MaxZ1Blade)
end
EgtResetAxisPos( 'C1') EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1') EgtResetAxisPos( 'B1')
-- se testa 3 parcheggio la 1 -- se testa 3 parcheggio la 1
@@ -476,16 +483,20 @@ function OnSimulToolSelect( dPosA)
end end
-- se lama su aggregato da sotto, imposto subito angolo scelto per asse virtuale A -- se lama su aggregato da sotto, imposto subito angolo scelto per asse virtuale A
if EMT.HEAD == 'H22' then if EMT.HEAD == 'H22' then
-- valore dell'asse virtuale -- se c'era un altro utensile, imposto subito asse virtuale
dPosA = dPosA or GetNextSawingVirtualAxis( EMT.MCHID) if EMT.PREVHEAD_H2 ~= 'H22' then
-- imposto il valore di A dPosA = dPosA or GetNextSawingVirtualAxis( EMT.MCHID)
EgtSetAxisPos( 'A2', dPosA) end
-- imposto home dell'asse C1 (A2=0 -> T101, A2=90 -> T104) if dPosA then
local MyParkSawC2 = GetSawCHomeFromVirtualAxis( dPosA) -- imposto il valore di A
EmtModifyAxisHome( 'C2', MyParkSawC2) EgtSetAxisPos( 'A2', dPosA)
EgtSetAxisPos( 'C2', MyParkSawC2) -- imposto home dell'asse C1 (A2=0 -> T201, A2=90 -> T204)
-- Imposto visualizzazione local MyParkSawC2 = GetSawCHomeFromVirtualAxis( dPosA)
EgtSetMode( EgtGetHeadId( EMT.HEAD) or GDB_ID.NULL, GDB_MD.STD) EmtModifyAxisHome( 'C2', MyParkSawC2)
EgtSetAxisPos( 'C2', MyParkSawC2)
-- Imposto visualizzazione
EgtSetMode( EgtGetHeadId( EMT.HEAD) or GDB_ID.NULL, GDB_MD.STD)
end
end end
-- carico utensile, con breve pausa -- carico utensile, con breve pausa
EgtPause( 100) EgtPause( 100)
@@ -514,14 +525,18 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function OnSimulToolDeselect( dPrevA) function OnSimulToolDeselect( dPrevA)
-- se prossimo utensile non cambia e non è sega a catena, esco -- se prossimo utensile non cambia e non è sega a catena o lama su rinvio da sotto, esco
if ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and EMT.NEXTHEAD ~= 'H13' and EMT.NEXTHEAD ~= 'H22' then return end if ( EMT.NEXTTOOL == EMT.PREVTOOL_H1 or EMT.NEXTTOOL == EMT.PREVTOOL_H2) and EMT.NEXTHEAD ~= 'H13' and ( EMT.NEXTHEAD ~= 'H22' or not dPrevA) then return end
-- deposito utensile -- deposito utensile
EgtOutText( 'Tool change in progress...') EgtOutText( 'Tool change in progress...')
-- recupero il gruppo -- recupero il gruppo attuale e il successivo
local nSetHead = GetHeadSet( EMT.NEXTHEAD) local nNextSetHead = GetHeadSet( EMT.NEXTHEAD)
local nSetHead = GetHeadSet( EMT.HEAD)
-- se devo deselezionare testa 3, la mando a parcheggio
if nSetHead == 3 then
SimulMoveAxis( 'X3', ParkX3, MCH_SIM_STEP.RAPID)
-- per testa gruppo 2 -- per testa gruppo 2
if nSetHead == 2 and EMT.PREVTCPOS_H2 then elseif nNextSetHead == 2 then
-- deposito lama su aggregato testa sotto -- deposito lama su aggregato testa sotto
if EMT.PREVHEAD_H2 == 'H22' then if EMT.PREVHEAD_H2 == 'H22' then
-- simulo movimento -- simulo movimento
@@ -529,6 +544,7 @@ function OnSimulToolDeselect( dPrevA)
if dPrevA then if dPrevA then
ParkC2 = GetSawCHomeFromVirtualAxis( dPrevA) ParkC2 = GetSawCHomeFromVirtualAxis( dPrevA)
end end
SimulMoveAxis( 'Z2', MinZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
end end
@@ -539,22 +555,22 @@ function OnSimulToolDeselect( dPrevA)
-- nascondo l'utensile sulla testa -- nascondo l'utensile sulla testa
EgtSetStatus( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_ST.OFF) EgtSetStatus( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_ST.OFF)
-- se testa gruppo 1 -- se testa gruppo 1
elseif nSetHead == 1 and EMT.PREVTCPOS_H1 then elseif nNextSetHead == 1 and EMT.PREVTCPOS_H1 then
-- deposito utensile fresa -- deposito utensile fresa
if EMT.PREVHEAD_H1 == 'H11' then if EMT.PREVHEAD_H1 == 'H11' then
-- simulo movimento -- simulo movimento
local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1) local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1)
if EMT.PREVTTOTLEN_H1 < LongTool then if EMT.PREVTTOTLEN_H1 < LongTool then
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
local dPosX = EgtIf( nPrevTc ~= 2, ParkX1, ParkTc2X1) local dPosX = EgtIf( nPrevTc ~= 2, ParkTc1X1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
else else
if nPrevTc ~= 2 then if nPrevTc ~= 2 then
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc1C1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkLongB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc1C1, MCH_SIM_STEP.RAPROT)
local dPosX = ParkX1 local dPosX = ParkTc1X1
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
else else
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc2C1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkLongB1, MCH_SIM_STEP.RAPROT, 'C1', ParkLongTc2C1, MCH_SIM_STEP.RAPROT)
local dPosX = ParkTc2X1 local dPosX = ParkTc2X1
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
end end
@@ -563,7 +579,7 @@ function OnSimulToolDeselect( dPrevA)
elseif EMT.PREVHEAD_H1 == 'H12' then elseif EMT.PREVHEAD_H1 == 'H12' then
-- simulo movimento -- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', ParkTc1X1, MCH_SIM_STEP.RAPID)
-- deposito utensile sega a catena -- deposito utensile sega a catena
elseif EMT.PREVHEAD_H1 == 'H13' then elseif EMT.PREVHEAD_H1 == 'H13' then
-- simulo movimento -- simulo movimento
@@ -596,22 +612,20 @@ function OnSimulToolDeselect( dPrevA)
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN) EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
end end
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
elseif nNextSetHead == 1 then
SimulMoveAxis( 'X3', ParkX3, MCH_SIM_STEP.RAPID)
end end
-- movimento per prendere nuovo utensile -- movimento per prendere nuovo utensile
-- prendo utensile fresa -- prendo utensile fresa
if EMT.NEXTHEAD == 'H11' then if EMT.NEXTHEAD == 'H11' then
-- simulo movimento -- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
local dPosX = EgtIf( GetTcForTopHeadTool( EMT.NEXTTCPOS) ~= 2, ParkX1, ParkTc2X1) local dPosX = EgtIf( GetTcForTopHeadTool( EMT.NEXTTCPOS) ~= 2, ParkTc1X1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
-- prendo utensile lama -- prendo utensile lama
elseif EMT.NEXTHEAD == 'H12' then elseif EMT.NEXTHEAD == 'H12' then
-- simulo movimento -- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT) SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', ParkTc1X1, MCH_SIM_STEP.RAPID)
-- prendo utensile sega a catena -- prendo utensile sega a catena
elseif EMT.NEXTHEAD == 'H13' then elseif EMT.NEXTHEAD == 'H13' then
-- simulo movimento -- simulo movimento
@@ -651,39 +665,25 @@ function OnSimulMachiningStart()
OnSimulToolSelect( dPosA) OnSimulToolSelect( dPosA)
end end
end end
-- se lavorazione attuale e precedente con sega a catena con angolo A diverso, devo scaricare e ricaricare -- se lavorazione attuale e precedente con aggregato lama da sotto con angolo A diverso, devo scaricare e ricaricare
if EMT.HEAD == 'H22' and EMT.HEAD == EMT.PREVHEAD_H2 then if EMT.HEAD == 'H22' and EMT.HEAD == EMT.PREVHEAD_H2 then
local dPrevA = EgtGetAxisPos( 'A2') local dPrevA = EgtGetAxisPos( 'A2')
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
local dPosA = tonumber( sVal:sub( 4)) or 0 local dPosA = tonumber( sVal:sub( 4)) or 0
if abs( dPosA - dPrevA) > 1 then if abs( dPosA - dPrevA) > 1 then
ExecParkRoller( nil, nil, nil, nil, false, bAgg) ExecParkRoller( nil, nil, nil, nil, false, bAgg)
-- setto i valori per la funzione ToolDesel
EMT.NEXTHEAD = EMT.HEAD
EMT.NEXTTOOL = EMT.TOOL
EMT.NEXTEXIT = EMT.EXIT
OnSimulToolDeselect( dPrevA) OnSimulToolDeselect( dPrevA)
EgtSetStatus( EgtGetHeadId( EMT.HEAD), GDB_ST.ON) EgtSetStatus( EgtGetHeadId( EMT.HEAD), GDB_ST.ON)
OnSimulToolSelect( dPosA) OnSimulToolSelect( dPosA)
-- aggiorno dati utensile su testa
EMT.TCPOSREAL = 'T' .. AdjustTcPos( false, EMT.TCPOS, dPosA)
EMT.PREVTCPOSREAL_H2 = EMT.TCPOSREAL
end end
end end
-- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD)
-- per gruppo testa 1
if nSetHead == 1 then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
EMT.PREVTTOTLEN_H1 = EMT.TTOTLEN
-- per gruppo testa 2
elseif nSetHead == 2 then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
EMT.PREVTTOTLEN_H2 = EMT.TTOTLEN
-- per gruppo testa 3 (resetto dati testa 1)
else
EMT.PREVTOOL_H3 = nil
EMT.PREVHEAD_H3 = nil
EMT.PREVTCPOS_H3 = nil
EMT.PREVTTOTLEN_H3 = nil
end
-- recupero alcuni dati della lavorazione -- recupero alcuni dati della lavorazione
EMT.MCHNAME = EgtGetOperationName( EMT.MCHID) EMT.MCHNAME = EgtGetOperationName( EMT.MCHID)
EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE) EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE)
@@ -729,6 +729,35 @@ function OnSimulMachiningStart()
EmtSetLastError( 1211, 'Missing or not active double tool of '..sOldTool) EmtSetLastError( 1211, 'Missing or not active double tool of '..sOldTool)
end end
EgtTdbSetCurrTool( sOldTool) EgtTdbSetCurrTool( sOldTool)
else
-- recupero il gruppo
local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead ~= 1 and ( EMT.PREVTOOL_H1 and EMT.PREVHEAD_H1) then
local nPrevExit_H1 = 1
local nInd_H1 = 1001
AddToolToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1, true)
AddToolHolderToCollisionObj( EMT.PREVTOOL_H1, EMT.PREVHEAD_H1, nPrevExit_H1, nInd_H1 + 1)
end
if nSetHead ~= 2 and ( EMT.PREVTOOL_H2 and EMT.PREVHEAD_H2) then
local nPrevExit_H2 = 1
local nInd_H2 = 1011
AddToolToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2, true)
AddToolHolderToCollisionObj( EMT.PREVTOOL_H2, EMT.PREVHEAD_H2, nPrevExit_H2, nInd_H2 + 1)
end
if nSetHead ~= 3 and IsHeadExisting( 3) then
local nPrevExit_H3 = 1
local nInd_H3 = 1001
local sHeadName
if EgtGetHeadId( 'H39') then
sHeadName = 'H39'
elseif EgtGetHeadId( 'H38') then
sHeadName = 'H38'
else
EmtSetLastError( 1212, "HEAD not managed")
end
AddToolToCollisionObj( nil, sHeadName, nPrevExit_H3, 1001)
AddToolHolderToCollisionObj( nil, sHeadName, nPrevExit_H3, 1002)
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
if EMT.DOU_TO_ZMAX then if EMT.DOU_TO_ZMAX then
@@ -744,6 +773,7 @@ function OnSimulMachiningStart()
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
EMT.DOU_TO_ZMAX = nil EMT.DOU_TO_ZMAX = nil
end end
-- non ancora iniziata la lavorazione -- non ancora iniziata la lavorazione
EMT.MCHFIRST = true EMT.MCHFIRST = true
end end
@@ -761,6 +791,31 @@ function OnSimulMachiningEnd()
if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end if EMT.DOU_TYPE and not EMT.ZMAX then EMT.DOU_TO_ZMAX = EMT.DOU_TYPE end
EMT.DOU_TYPE = nil EMT.DOU_TYPE = nil
EMT.DOU_TOOL = nil EMT.DOU_TOOL = nil
-- salvo dati utensile
local nSetHead = GetHeadSet( EMT.HEAD)
-- per gruppo testa 1
if nSetHead == 1 then
EMT.PREVTOOL_H1 = EMT.TOOL
EMT.PREVHEAD_H1 = EMT.HEAD
EMT.PREVTCPOS_H1 = EMT.TCPOS
EMT.PREVTTOTLEN_H1 = EMT.TTOTLEN
EMT.PREVTCPOSREAL_H1 = EMT.TCPOSREAL
-- per gruppo testa 2
elseif nSetHead == 2 then
EMT.PREVTOOL_H2 = EMT.TOOL
EMT.PREVHEAD_H2 = EMT.HEAD
EMT.PREVTCPOS_H2 = EMT.TCPOS
EMT.PREVTTOTLEN_H2 = EMT.TTOTLEN
EMT.PREVTCPOSREAL_H2 = EMT.TCPOSREAL
-- per gruppo testa 3
else
EMT.PREVTOOL_H3 = EMT.TOOL
EMT.PREVHEAD_H3 = EMT.HEAD
EMT.PREVTCPOS_H3 = EMT.TCPOS
EMT.PREVTTOTLEN_H3 = EMT.TTOTLEN
end
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -895,6 +950,7 @@ function OnSimulMoveStart()
local C1Home = EgtGetAxisHomePos( 'C1') local C1Home = EgtGetAxisHomePos( 'C1')
local Z1Pos = EgtGetAxisPos( 'Z1') local Z1Pos = EgtGetAxisPos( 'Z1')
local Z1Home = EgtGetAxisHomePos( 'Z1') local Z1Home = EgtGetAxisHomePos( 'Z1')
local MyMaxZ1 = EgtGetAxisMax( 'Z1')
-- se fresa o lama -- se fresa o lama
if EMT.HEAD ~= 'H13' then if EMT.HEAD ~= 'H13' then
-- se movimento iniziale da Zmax con lama o fresa -- se movimento iniziale da Zmax con lama o fresa
@@ -903,7 +959,7 @@ function OnSimulMoveStart()
-- in caso di rotazione della lama lontano dalla posizione di home degli assi rotanti -- in caso di rotazione della lama lontano dalla posizione di home degli assi rotanti
if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( C1Pos - EMT.R1) > 1 or abs( B1Pos - EMT.R2) > 1) and ( abs( C1Home - EMT.R1) > 30.1 or abs( B1Home - EMT.R2) > 30.1) then if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( C1Pos - EMT.R1) > 1 or abs( B1Pos - EMT.R2) > 1) and ( abs( C1Home - EMT.R1) > 30.1 or abs( B1Home - EMT.R2) > 30.1) then
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'Z1', MaxZ1, 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) SimulMoveAxes( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
@@ -913,10 +969,21 @@ function OnSimulMoveStart()
if WriteAllCoordsOnFirstM101 then if WriteAllCoordsOnFirstM101 then
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID)
end end
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID) -- se ero in posizione speciale, prima ruoto poi scendo
SimulMoveAxis( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT) if bXSpec then
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT) local dZPos = max( Z1Home, EMT.L3)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z1', dZPos, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT, 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
if abs( dZPos - EMT.L3) > 1 then
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
end
else
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
end
end end
end end
-- altrimenti sega a catena -- altrimenti sega a catena
@@ -941,17 +1008,85 @@ function OnSimulMoveStart()
local C2Home = EgtGetAxisHomePos( 'C2') local C2Home = EgtGetAxisHomePos( 'C2')
local Z2Home = EgtGetAxisHomePos( 'Z2') local Z2Home = EgtGetAxisHomePos( 'Z2')
local X2Home = EgtGetAxisHomePos( 'X2') local X2Home = EgtGetAxisHomePos( 'X2')
if EMT.ZMAX then local X2Pos = EgtGetAxisPos( 'X2')
-- se bisogna scrivere tutti gli assi local B2Pos = EgtGetAxisPos( 'B2')
if WriteAllCoordsOnFirstM101 then local C2Pos = EgtGetAxisPos( 'C2')
SimulMoveAxes( 'X2', SafeX2, MCH_SIM_STEP.RAPID, 'B2', B2Home, MCH_SIM_STEP.COLLROT, 'C2', C2Home, MCH_SIM_STEP.COLLROT) -- calcolo posizione reale
EMT.TCPOSREAL = 'T' .. AdjustTcPos( false, EMT.TCPOS, EMT.R3)
-- se utensile cambiato (controllo il reale perchè per aggregato dipende come è stato caricato)
if EMT.PREVTCPOSREAL_H2 ~= EMT.TCPOSREAL then
if EMT.ZMAX then
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
if EMT.HEAD == 'H22' then
SimulMoveAxes( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID, 'B2', 0, MCH_SIM_STEP.COLLROT, 'C2', C2Home, MCH_SIM_STEP.COLLROT)
X2Pos = ParkSawX2
else
SimulMoveAxes( 'X2', SafeX2, MCH_SIM_STEP.RAPID, 'B2', B2Home, MCH_SIM_STEP.COLLROT, 'C2', C2Home, MCH_SIM_STEP.COLLROT)
X2Pos = SafeX2
end
else
if EMT.HEAD == 'H22' then
SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID)
X2Pos = ParkSawX2
else
SimulMoveAxis( 'X2', SafeX2, MCH_SIM_STEP.RAPID)
X2Pos = SafeX2
end
end
SimulMoveAxis( 'Z2', Z2Home, MCH_SIM_STEP.RAPID)
-- Porto la X alla giusta quota
if X2Pos > ParkMchY2 and ( B2Pos ~= EMT.R2 or C2Pos ~= EMT.R1) then
SimulMoveAxis( 'X2', ParkMchY2, MCH_SIM_STEP.RAPID)
end
end end
SimulMoveAxis( 'Z2', Z2Home, MCH_SIM_STEP.RAPID) else
SimulMoveAxis( 'X2', EMT.L2, MCH_SIM_STEP.RAPID) -- solo se è macchina a 3 teste con gruppo truciolatore 4 assi, devo andare prima in Z0
if EgtGetHeadId( 'H39') then
SimulMoveAxis( 'Z2', Z2Home, MCH_SIM_STEP.RAPID)
end
-- Porto la X alla giusta quota
if EMT.ZMAX and X2Pos > ParkMchY2 and ( B2Pos ~= EMT.R2 or C2Pos ~= EMT.R1) then
SimulMoveAxis( 'X2', ParkMchY2, MCH_SIM_STEP.RAPID)
end
end
if EMT.HEAD == 'H22' then
SimulMoveAxes( 'B2', EMT.R2, MCH_SIM_STEP.COLLROT, 'C2', EMT.R1, MCH_SIM_STEP.COLLROT)
end
-- se ero a ZMAX, mi sposto in posizione a Z home. Ultimo movimento muove in Z
if EMT.ZMAX then
SimulMoveAxes( 'X2', EMT.L2, MCH_SIM_STEP.RAPID, 'B2', EMT.R2, MCH_SIM_STEP.COLLROT, 'C2', EMT.R1, MCH_SIM_STEP.COLLROT)
end end
-- altrimenti testa 3 -- altrimenti testa 3
else else
; -- non devo fare alcunchè di speciale -- testa 4 assi dedicata truciolatore
if EgtGetHeadId( 'H39') then
if EMT.ZMAX then
local MaxZ3 = EgtGetAxisMax( 'Z3')
SimulMoveAxes( 'X3', EMT.L2, MCH_SIM_STEP.RAPID, 'Z3', MaxZ3, MCH_SIM_STEP.RAPID)
end
SimulMoveAxis( 'Z3', EMT.L3, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B3', EMT.R2, MCH_SIM_STEP.COLLROT, 'C3', EMT.R1, MCH_SIM_STEP.COLLROT)
-- testa 5 assi dedicata lama
elseif EgtGetHeadId( 'H38') then
if EMT.ZMAX then
local B3Home = EgtGetAxisHomePos( 'B3')
local C3Home = EgtGetAxisHomePos( 'C3')
SimulMoveAxis( 'X3', SafeX3RotAxis, MCH_SIM_STEP.RAPID)
-- se non sono esattamente in home, devo ruotare in zona sicura
if abs( C3Home - EMT.R1) > 1 or abs( B3Home - EMT.R2) > 1 then
EMT.L3 = min( EMT.L3, SafeZ3RotAxis)
SimulMoveAxis( 'Z3', SafeZ3RotAxis, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B3', EMT.R2, MCH_SIM_STEP.COLLROT, 'C3', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'Z3', EMT.L3, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'X3', EMT.L2, MCH_SIM_STEP.RAPID)
end
end
-- si muovono tutti gli assi assieme
-- altre configurazioni
else
EmtSetLastError( 1212, "HEAD not managed")
end
end end
end end
-- se lavorazione split, muovo per riaggancio del carro Y1 -- se lavorazione split, muovo per riaggancio del carro Y1
@@ -999,7 +1134,7 @@ function OnSimulMoveStart()
EmtSetLastError( 1208, sErr) EmtSetLastError( 1208, sErr)
end end
-- se appena sopra inizio, sistemo subito la quota in Z -- se appena sopra inizio, sistemo subito la quota in Z
if EMT.MOVE == 0 and EMT.FLAG == 1 then if EMT.MOVE == 0 then
SimulMoveAxes( 'Z2', EMT.A6, MCH_SIM_STEP.RAPID) SimulMoveAxes( 'Z2', EMT.A6, MCH_SIM_STEP.RAPID)
end end
end end
@@ -1061,6 +1196,7 @@ function OnSimulMoveStart()
EMT.A4 = EgtIf( GetV2ToClose(), EMT.V2NEXTPOS, ParkV2) EMT.A4 = EgtIf( GetV2ToClose(), EMT.V2NEXTPOS, ParkV2)
end end
EMT.ZMAX = nil EMT.ZMAX = nil
EMT.TO_ZMAX = nil
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -1220,7 +1356,7 @@ function ExecAuxCmd( sCmd, bPathStart)
ExecMoveHome( Cmd[2] == '1', EgtIf( bPathStart, false, EMT.MCHSPLIT)) ExecMoveHome( Cmd[2] == '1', EgtIf( bPathStart, false, EMT.MCHSPLIT))
elseif Cmd[1] == '11' then elseif Cmd[1] == '11' then
local bClose = Cmd[2] ~= '0' local bClose = Cmd[2] ~= '0'
if bPathStart and EMT.MCHSPLIT and not EMT.FALL and GetPY2Light() then bClose = false end if bPathStart and EMT.MCHSPLIT and not ( EMT.FALL or EMT.TO_FALL) and GetPY2Light() then bClose = false end
ExecMovePY1( bClose) ExecMovePY1( bClose)
elseif Cmd[1] == '12' then elseif Cmd[1] == '12' then
ExecMovePY2( Cmd[2] ~= '0') ExecMovePY2( Cmd[2] ~= '0')
@@ -1275,11 +1411,11 @@ end
function ExecStartHome() function ExecStartHome()
-- Testa 1 -- Testa 1
EgtResetAxisPos( 'X1') EgtResetAxisPos( 'X1')
EgtResetAxisPos( 'Z1') EgtSetAxisPos( 'Z1', MaxZ1)
EgtResetAxisPos( 'C1') EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1') EgtResetAxisPos( 'B1')
-- Testa 2 -- Testa 2
EgtResetAxisPos( 'X2') EgtSetAxisPos( 'X2', SafeX2)
EgtSetAxisPos( 'Z2', MinZ2) EgtSetAxisPos( 'Z2', MinZ2)
EgtResetAxisPos( 'C2') EgtResetAxisPos( 'C2')
EgtResetAxisPos( 'B2') EgtResetAxisPos( 'B2')
@@ -1289,13 +1425,18 @@ end
function ExecMoveHome( bNearV, bMchSplit) function ExecMoveHome( bNearV, bMchSplit)
-- risalita a Zmax -- risalita a Zmax
ExecMoveZmax( bMchSplit) ExecMoveZmax( bMchSplit)
EMT.TO_ZMAX = nil -- se testa sotto e macchian a 3 teste e gruppo truciolatore a 4 assi
-- se testa sotto if GetHeadSet( EMT.HEAD) == 2 and IsHeadExisting( 3) then
if GetHeadSet( EMT.HEAD) == 2 then
if not SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) then if not SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) then
EgtOutLog( 'Error on MoveHome : X2') EgtOutLog( 'Error on MoveHome : X2')
end end
if EgtGetHeadId( 'H39') then
if not SimulMoveAxis( 'Z2', ParkInLavZ2, MCH_SIM_STEP.RAPID) then
EgtOutLog( 'Error on MoveHome : Z2')
end
end
end end
EMT.TO_ZMAX = nil
-- se richiesto, avvicino i rulli -- se richiesto, avvicino i rulli
if bNearV then if bNearV then
ExecOpenRoller( 1) ExecOpenRoller( 1)
@@ -1312,15 +1453,15 @@ function ExecMoveZmax( bMchSplit)
-- set della testa -- set della testa
local nSetHead = GetHeadSet( EMT.HEAD) local nSetHead = GetHeadSet( EMT.HEAD)
-- posizioni correnti degli assi testa -- posizioni correnti degli assi testa
local CurrX = EgtGetAxisPos( EgtIf( nSetHead == 1, 'X1', 'X2')) local CurrX = EgtGetAxisPos( 'X'..nSetHead)
local CurrZ = EgtGetAxisPos( EgtIf( nSetHead == 1, 'Z1', 'Z2')) local CurrZ = EgtGetAxisPos( 'Z'..nSetHead)
local CurrC = EgtGetAxisPos( EgtIf( nSetHead == 1, 'C1', 'C2')) local CurrC = EgtGetAxisPos( 'C'..nSetHead)
local CurrB = EgtGetAxisPos( EgtIf( nSetHead == 1, 'B1', 'B2')) local CurrB = EgtGetAxisPos( 'B'..nSetHead)
-- posizioni home degli assi testa -- posizioni home degli assi testa
local HomeX = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'X1', 'X2')) local HomeX = EgtGetAxisHomePos( 'X'..nSetHead)
local HomeZ = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'Z1', 'Z2')) local HomeZ = EgtGetAxisHomePos( 'Z'..nSetHead)
local HomeC = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'C1', 'C2')) local HomeC = EgtGetAxisHomePos( 'C'..nSetHead)
local HomeB = EgtGetAxisHomePos( EgtIf( nSetHead == 1, 'B1', 'B2')) local HomeB = EgtGetAxisHomePos( 'B'..nSetHead)
-- verifico se necessario ruotare la testa -- verifico se necessario ruotare la testa
local bRot = ( abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1) local bRot = ( abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1)
-- se necessario ruotare la testa, allargo i carrelli -- se necessario ruotare la testa, allargo i carrelli
@@ -1332,13 +1473,14 @@ function ExecMoveZmax( bMchSplit)
end end
-- se testa sopra -- se testa sopra
if nSetHead == 1 then if nSetHead == 1 then
local MyMaxZ1 = EgtGetAxisMax( 'Z1')
-- se fresa o lama -- se fresa o lama
if EMT.HEAD ~= 'H13' then if EMT.HEAD ~= 'H13' then
if abs( HomeC - CurrC) > 0.1 or abs( HomeB - CurrB) > 0.1 then if abs( HomeC - CurrC) > 0.1 or abs( HomeB - CurrB) > 0.1 then
local dZref = HomeZ + GetZExtra( EMT.HEAD, CurrB) local dZref = HomeZ + GetZExtra( EMT.HEAD, CurrB)
SimulMoveAxes( 'Z1', EgtIf( dZref > CurrZ, dZref, CurrZ), MCH_SIM_STEP.RAPID, 'B1', EgtClamp( CurrB, -90, 90), MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'Z1', EgtIf( dZref > CurrZ, dZref, CurrZ), MCH_SIM_STEP.RAPID, 'B1', EgtClamp( CurrB, -90, 90), MCH_SIM_STEP.COLLROT)
if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( HomeC - CurrC) > 30.1 or abs( HomeB - CurrB) > 30.1) then if ( EMT.HEAD == 'H12' or EMT.HEAD == 'H16') and ( abs( HomeC - CurrC) > 30.1 or abs( HomeB - CurrB) > 30.1) then
SimulMoveAxes( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID, 'B1', 0, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'Z1', MyMaxZ1, MCH_SIM_STEP.RAPID, 'B1', 0, MCH_SIM_STEP.COLLROT)
end end
if ( not BD.RIGHT_LOAD and EMT.L2 > DeltaTabY) or ( BD.RIGHT_LOAD and EMT.L2 < DeltaTabY) then if ( not BD.RIGHT_LOAD and EMT.L2 > DeltaTabY) or ( BD.RIGHT_LOAD and EMT.L2 < DeltaTabY) then
SimulMoveAxis( 'X1', DeltaTabY, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'X1', DeltaTabY, MCH_SIM_STEP.RAPID)
@@ -1346,7 +1488,7 @@ function ExecMoveZmax( bMchSplit)
SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT) SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'B1', HomeB, MCH_SIM_STEP.COLLROT) SimulMoveAxis( 'B1', HomeB, MCH_SIM_STEP.COLLROT)
end end
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z1', MyMaxZ1, MCH_SIM_STEP.RAPID)
-- altrimenti sega a catena -- altrimenti sega a catena
else else
-- salgo in Z sicurezza raddrizzando la B -- salgo in Z sicurezza raddrizzando la B
@@ -1371,11 +1513,32 @@ function ExecMoveZmax( bMchSplit)
elseif nSetHead == 2 then elseif nSetHead == 2 then
SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID) SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) if EMT.HEAD == 'H22' then
SimulMoveAxis( 'X2', SafeX2, MCH_SIM_STEP.RAPID)
else
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
end
-- solo se è macchina a 3 teste con gruppo truciolatore 4 assi, devo stare più alto
if EgtGetHeadId( 'H39') then
SimulMoveAxis( 'Z2', ParkInLavZ2, MCH_SIM_STEP.RAPID)
end
-- altrimenti testa 3 -- altrimenti testa 3
else else
SimulMoveAxes( 'Z3', MaxZ3, MCH_SIM_STEP.RAPID) if EgtGetHeadId( 'H39') then
SimulMoveAxes( 'B3', ParkB3, MCH_SIM_STEP.COLLROT) SimulMoveAxes( 'Z3', MaxZ3, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B3', ParkB3, MCH_SIM_STEP.COLLROT)
elseif EgtGetHeadId( 'H38') then
local MyMaxZ3 = EgtGetAxisMax( 'Z3')
-- se non sono esattamente in home, devo ruotare in zona sicura
if abs( HomeC - CurrC) > 1 or abs( HomeB - CurrB) > 1 then
SimulMoveAxis( 'X3', SafeX3RotAxis, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z3', SafeZ3RotAxis, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'C3', HomeC, MCH_SIM_STEP.COLLROT, 'B3', HomeB, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Z3', MyMaxZ3, MCH_SIM_STEP.RAPID)
else
EmtSetLastError( 1212, "HEAD not managed")
end
end end
EMT.ZMAX = true EMT.ZMAX = true
end end
@@ -1400,10 +1563,14 @@ function ExecUnloading()
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
local nFirstId, nCount = EgtVolZmapGetEdges( vMillId, nLayId) if EgtVolZmapSetShowEdges then
if nFirstId then EgtVolZmapSetShowEdges( vMillId, true)
for nId = nFirstId, nFirstId + nCount - 1 do else
EgtSetColor( nId, Color3d( 96, 96, 96)) local nFirstId, nCount = EgtVolZmapGetEdges( vMillId, nLayId)
if nFirstId then
for nId = nFirstId, nFirstId + nCount - 1 do
EgtSetColor( nId, Color3d( 96, 96, 96))
end
end end
end end
-- rilascio Vmill -- rilascio Vmill
@@ -1525,7 +1692,7 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV1 = ParkV1 - PosV1 local MoveV1 = ParkV1 - PosV1
local DiffY1 = MyParkY1 - PosY1 local DiffY1 = MyParkY1 - PosY1
local MoveY1 = EgtIf( DiffY1 > 0.1, MoveV1, 0) local MoveY1 = EgtIf( DiffY1 > 0.1, MoveV1, 0)
local TryMoveY1 = ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LT, 0) local TryMoveY1 = min( ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LT, 0), MaxY1 - PosY1 - 10)
if ( PosT > ParkV2 - ExtraParkV and PosT < ParkV1 and PosY1 + TryMoveY1 < MaxY1) then MoveY1 = max( MoveY1, TryMoveY1) end if ( PosT > ParkV2 - ExtraParkV and PosT < ParkV1 and PosY1 + TryMoveY1 < MaxY1) then MoveY1 = max( MoveY1, TryMoveY1) end
-- se appena eseguito taglio di separazione -- se appena eseguito taglio di separazione
if bSpliCut then if bSpliCut then
@@ -1555,7 +1722,7 @@ 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 = ParkV2 - PosT - EMT.LT local TryMoveY2 = max( ParkV2 - PosT - EMT.LT, 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 < ParkV1 + ExtraParkV and PosT + EMT.LT > 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,
@@ -1815,7 +1982,7 @@ function LoadFirstTool( nHSet, sTcPosDef)
if nHSet ~= 1 and nHSet ~= 2 then return end if nHSet ~= 1 and nHSet ~= 2 then return end
EgtUnloadTool( EgtIf( nHSet == 1, 'H11', 'H21'), 1) EgtUnloadTool( EgtIf( nHSet == 1, 'H11', 'H21'), 1)
if GetHeadSetFromTcPos( sTcPosDef) ~= nHSet then return end if GetHeadSetFromTcPos( sTcPosDef) ~= nHSet then return end
local sTool, sHead, sTcPos, sTTotLen, sBlockedAxis = FindFirstToolOnHeadSet( nHSet) local sTool, sHead, sTcPos, sTTotLen, sTotDiam, sBlockedAxis = FindFirstToolOnHeadSet( nHSet)
if not sTool then if not sTool then
local vTools = EgtGetToolsInCurrSetupPos( sTcPosDef) local vTools = EgtGetToolsInCurrSetupPos( sTcPosDef)
if vTools and vTools[1] then if vTools and vTools[1] then
@@ -1827,12 +1994,32 @@ function LoadFirstTool( nHSet, sTcPosDef)
if sTool then if sTool then
-- imposto correttamente i dati di testa -- imposto correttamente i dati di testa
local OrigEMC = EMC local OrigEMC = EMC
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTLEN = sTTotLen, BLOCKEDAXIS = sBlockedAxis} EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTLEN = sTTotLen, TOTDIAM = sTotDiam, BLOCKEDAXIS = sBlockedAxis}
OnSetHead() OnSetHead()
EMC = OrigEMC EMC = OrigEMC
if sBlockedAxis then
local dPosA = tonumber( sBlockedAxis:sub( 4) or '') or 0
if dPosA ~= 0 then
-- imposto il valore di A
EgtSetAxisPos( EgtIf( nHSet == 1 , 'A1', 'A2'), dPosA)
end
end
-- carico l'utensile -- carico l'utensile
EgtLoadTool( sHead, 1, sTool) EgtLoadTool( sHead, 1, sTool)
ShowToolInTcPos( sTcPos, false) ShowToolInTcPos( sTcPos, false)
-- salvo utensili caricati
if nHSet == 1 then
EMT.PREVTOOL_H1 = sTool
EMT.PREVHEAD_H1 = sHead
EMT.PREVTCPOS_H1 = sTcPos
EMT.PREVTTOTLEN_H1 = sTTotLen
-- per gruppo testa 2
elseif nHSet == 2 then
EMT.PREVTOOL_H2 = sTool
EMT.PREVHEAD_H2 = sHead
EMT.PREVTCPOS_H2 = sTcPos
EMT.PREVTTOTLEN_H2 = sTTotLen
end
end end
return sTool return sTool
end end
@@ -2246,7 +2433,7 @@ function FindFirstToolOnHeadSet( nHSet)
local CurrMachId = EgtGetCurrMachining() local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME) local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato -- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos, sTTotLen, sBlockedAxis local sTool, sHead, sTcPos, sTTotLen, sTotDiam, sBlockedAxis
local OpId = EgtGetFirstActiveOperation() local OpId = EgtGetFirstActiveOperation()
while OpId do while OpId do
local nType = EgtGetOperationType( OpId) local nType = EgtGetOperationType( OpId)
@@ -2256,9 +2443,15 @@ function FindFirstToolOnHeadSet( nHSet)
if EgtTdbSetCurrTool( sTest) then if EgtTdbSetCurrTool( sTest) then
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if GetHeadSet( sHead) == nHSet then if GetHeadSet( sHead) == nHSet then
sTool = sTest
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS) sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
-- aggregato lama non si può mai preselezionare e viene sempre scaricato, quindi non sarà mai già caricato
if nHSet == 2 and sTcPos == 'T201' then
sTcPos = nil
break
end
sTool = sTest
sTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) sTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
sTotDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
sBlockedAxis = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) sBlockedAxis = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
break break
end end
@@ -2271,7 +2464,7 @@ function FindFirstToolOnHeadSet( nHSet)
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL) EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '') EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato -- restituisco risultato
return sTool, sHead, sTcPos, sTTotLen, sBlockedAxis return sTool, sHead, sTcPos, sTTotLen, sTotDiam, sBlockedAxis
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -2368,6 +2561,8 @@ function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2)
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' then elseif sHead == 'H21' or sHead == 'H22' 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 == 'H38' then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
end end
end end
+90 -27
View File
@@ -1,4 +1,4 @@
-- Special Operations macchina Essetre-PF1250 by Egalware s.r.l. 2024/01/22 -- Special Operations macchina Essetre-PF1250 by Egalware s.r.l. 2024/04/09
-- Intestazioni -- Intestazioni
require( 'EmtGenerator') require( 'EmtGenerator')
@@ -54,6 +54,9 @@ function OnSpecialGetMaxZ()
elseif nSetHead == 2 then elseif nSetHead == 2 then
EMC.R1p = ParkC2 EMC.R1p = ParkC2
EMC.R2p = ParkB2 EMC.R2p = ParkB2
elseif nSetHead == 3 then
EMC.R1p = ParkC3
EMC.R2p = ParkB3
end end
end end
local vtT = Vector3d( EMC.TDIR) local vtT = Vector3d( EMC.TDIR)
@@ -71,14 +74,14 @@ function OnSpecialGetMaxZ()
elseif EMC.HEAD == 'H12' then elseif EMC.HEAD == 'H12' then
if vtTp:getX() > 0.3 and vtT:getX() > 0.3 then if vtTp:getX() > 0.3 and vtT:getX() > 0.3 then
if bBSameSign and abs( EMC.R1 - EMC.R1p) < 165 then if bBSameSign and abs( EMC.R1 - EMC.R1p) < 165 then
EMC.MAXZ = MaxZ1 - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130) EMC.MAXZ = MaxZ1Blade - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130)
elseif vtTp:getZ() > 0.707 or vtT:getZ() > 0.707 then elseif vtTp:getZ() > 0.707 or vtT:getZ() > 0.707 then
EMC.MAXZ = ParkZ1 + 200 EMC.MAXZ = ParkZ1 + 200
else else
EMC.MAXZ = ParkZ1 + 1 EMC.MAXZ = ParkZ1 + 1
end end
elseif bBSameSign and EMC.R1p > 29.9 and EMC.R1p < 180.1 and EMC.R1 > 29.9 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then elseif bBSameSign and EMC.R1p > 29.9 and EMC.R1p < 180.1 and EMC.R1 > 29.9 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then
EMC.MAXZ = MaxZ1 - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130) EMC.MAXZ = MaxZ1Blade - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130)
elseif bBSameSign and EMC.R1p > -0.1 and EMC.R1p < 180.1 and EMC.R1 > -0.1 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then elseif bBSameSign and EMC.R1p > -0.1 and EMC.R1p < 180.1 and EMC.R1 > -0.1 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then
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)
@@ -89,14 +92,14 @@ function OnSpecialGetMaxZ()
elseif EMC.HEAD == 'H16' then elseif EMC.HEAD == 'H16' then
if vtTp:getX() > 0.3 and vtT:getX() > 0.3 then if vtTp:getX() > 0.3 and vtT:getX() > 0.3 then
if bBSameSign and abs( EMC.R1 - EMC.R1p) < 165 then if bBSameSign and abs( EMC.R1 - EMC.R1p) < 165 then
EMC.MAXZ = MaxZ1 - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130) EMC.MAXZ = MaxZ1Blade - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130)
elseif vtTp:getZ() > 0.707 or vtT:getZ() > 0.707 then elseif vtTp:getZ() > 0.707 or vtT:getZ() > 0.707 then
EMC.MAXZ = ParkZ1 + 200 EMC.MAXZ = ParkZ1 + 200
else else
EMC.MAXZ = ParkZ1 + 1 EMC.MAXZ = ParkZ1 + 1
end end
elseif bBSameSign and EMC.R1p > 29.9 and EMC.R1p < 180.1 and EMC.R1 > 29.9 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then elseif bBSameSign and EMC.R1p > 29.9 and EMC.R1p < 180.1 and EMC.R1 > 29.9 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then
EMC.MAXZ = MaxZ1 - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130) EMC.MAXZ = MaxZ1Blade - EgtIf( abs( EMC.R2) < 90.1 and abs( EMC.R2p) < 90.1, 0, 130)
elseif bBSameSign and EMC.R1p > -0.1 and EMC.R1p < 180.1 and EMC.R1 > -0.1 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then elseif bBSameSign and EMC.R1p > -0.1 and EMC.R1p < 180.1 and EMC.R1 > -0.1 and EMC.R1 < 180.1 and EMC.R2p > -10 and EMC.R2 > -10 then
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)
@@ -111,14 +114,16 @@ function OnSpecialGetMaxZ()
local vMZ = {{ Tz=0.85, Ez=390}, { Tz=0.5, Ez=280}, { Tz=-0.01, Ez=160}} local vMZ = {{ Tz=0.85, Ez=390}, { Tz=0.5, Ez=280}, { Tz=-0.01, Ez=160}}
EMC.MAXZ = ParkZ2 + CalcExtraZ( vtTpZm, vtT, vMZ) EMC.MAXZ = ParkZ2 + CalcExtraZ( vtTpZm, vtT, vMZ)
end end
elseif EMC.HEAD == 'H38' then
EMC.MAXZ = SafeZ3RotAxis
end end
end end
---------------------- OnSpecialMoveZup ----------------------------- ---------------------- OnSpecialMoveZup -----------------------------
function OnSpecialMoveZup() function OnSpecialMoveZup()
--EgtOutLog( 'OnSpecialMoveZup : ' .. EMC.HEAD .. '.' .. tostring( EMC.EXIT)) --EgtOutLog( 'OnSpecialMoveZup : ' .. EMC.HEAD .. '.' .. tostring( EMC.EXIT))
-- Inizializzazioni -- Inizializzazioni
EMC.ERR = 0 EMC.ERR = 0
EMC.MODIF = false EMC.MODIF = false
@@ -135,7 +140,7 @@ function OnSpecialMoveZup()
if EMC.HEAD == 'H11' or EMC.HEAD == 'H21' or EMC.HEAD == 'H22' then if EMC.HEAD == 'H11' or EMC.HEAD == 'H21' or EMC.HEAD == 'H22' then
; ;
-- se lama -- se lama
else elseif EMC.HEAD == 'H12' or EMC.HEAD == 'H16' then
-- riporto i valori tra -179 e + 180 -- riporto i valori tra -179 e + 180
local dCheckAxR1 = EMC.R1 local dCheckAxR1 = EMC.R1
if dCheckAxR1 < -180 then if dCheckAxR1 < -180 then
@@ -180,6 +185,12 @@ function OnSpecialMoveZup()
end end
end end
end end
elseif EMC.HEAD == 'H38' then
EMC.L3 = SafeZ3RotAxis
-- dichiaro modificato
EMC.MODIF = true
else
; -- non si fa nulla
end end
end end
@@ -574,7 +585,11 @@ function OnPostApplyMachining()
-- Verifico flag di separazione e fase di scarico -- Verifico flag di separazione e fase di scarico
local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) local sNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
local bPreSplit = ( false and sNotes:find( 'Presplit', 1, true) ~= nil)
-- bPreSplit sempre a falso per obbligare a pinzare il pezzo con 1 morsa anche se iniziato il taglio che dividerà grezzo e finito (in genere per sezioni grandi con 2 tagli di lama)
-- Tra un taglio e l'altro infatti c'e' inversione del braccio e quindi un'apertura delle rulliere. Se pinzano entrambe le pinze, potrebbero esserci problemi di collisone rulli-morse
local bPreSplit = false --( sNotes:find( 'Presplit', 1, true) ~= nil)
local bSplitting = ( sNotes:find( 'Split', 1, true) ~= nil) local bSplitting = ( sNotes:find( 'Split', 1, true) ~= nil)
local bPreCut = ( sNotes:find( 'Precut', 1, true) ~= nil) local bPreCut = ( sNotes:find( 'Precut', 1, true) ~= nil)
local bCutting = ( sNotes:find( 'Cut', 1, true) ~= nil) local bCutting = ( sNotes:find( 'Cut', 1, true) ~= nil)
@@ -655,6 +670,14 @@ 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)
-- mi salvo info lavorazione su una lista
local AuxInfoMach = {}
AuxInfoMach.bPreSplit = bPreSplit
AuxInfoMach.bSplitting = bSplitting
AuxInfoMach.bPreCut = bPreCut
AuxInfoMach.bCutting = bCutting
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)
@@ -741,7 +764,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
local dPosT = LoadT local dPosT = LoadT
local vCmd = SpecCalcLoad( dPosT, dDistFront, max( dDistBack, MinJoin, EMC.LB - ( MaxY1 - MinY1) + 6)) local vCmd = SpecCalcLoad( dPosT, dDistFront, max( dDistBack, MinJoin, EMC.LB - ( MaxY1 - MinY1) + 6))
EMC.LOAD = true EMC.LOAD = true
local vCmd2 = SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar) local vCmd2 = SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar, AuxInfoMach)
EMC.LOAD = nil EMC.LOAD = nil
if bSplitting and EMC.ERR == 18 then if bSplitting and EMC.ERR == 18 then
table.insert( vCmd, { 22, dRollBack, -dRollFront}) table.insert( vCmd, { 22, dRollBack, -dRollFront})
@@ -754,7 +777,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
-- Se altrimenti non eseguito SPLIT, eseguo calcoli per carrelli -- Se altrimenti non eseguito SPLIT, eseguo calcoli per carrelli
elseif not SPLIT then elseif not SPLIT then
local vCmd = SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar) local vCmd = SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar, AuxInfoMach)
-- Se non ci sono spostamenti, confermo i parametri di aggancio e di posizione roller -- Se non ci sono spostamenti, confermo i parametri di aggancio e di posizione roller
if SpecTestOnlyRemarkInCmds( vCmd) then if SpecTestOnlyRemarkInCmds( vCmd) then
table.insert( vCmd, { 21, EgtIf( EMC.Y1DELTA, EMC.Y1DELTA, 0), EgtIf( EMC.Y2DELTA, EMC.Y2DELTA, 0)}) table.insert( vCmd, { 21, EgtIf( EMC.Y1DELTA, EMC.Y1DELTA, 0), EgtIf( EMC.Y2DELTA, EMC.Y2DELTA, 0)})
@@ -883,15 +906,19 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
EgtSetAxisPos( 'A2', vAxMid[6]) EgtSetAxisPos( 'A2', vAxMid[6])
end end
b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C2'), GDB_BB.ONLY_VISIBLE) b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C2'), GDB_BB.ONLY_VISIBLE)
else -- 'H31' else -- testa 3
EgtSetAxisPos( 'C3', vAxMid[4]) EgtSetAxisPos( 'C3', vAxMid[4])
EgtSetAxisPos( 'B3', vAxMid[5]) EgtSetAxisPos( 'B3', vAxMid[5])
b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C3'), GDB_BB.ONLY_VISIBLE) b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C3'), GDB_BB.ONLY_VISIBLE)
end end
-- Forzo la distanza di sicurezza da utensile
local nSecRollerDist = EgtGetValInNotes( EgtTdbGetCurrToolParam( MCH_TP.USERNOTES), 'SECDIST', 'i') or SIC_V
local dMinFrontEng = EgtIf( nSetHead ~= 2, MIN_ENG_RACK_V, EgtIf( vAxMax[3] < MIN_Z2_FOR_ENG_XZ2_V, MIN_ENG_V, MIN_ENG_XZ2_V)) local dMinFrontEng = EgtIf( nSetHead ~= 2, MIN_ENG_RACK_V, EgtIf( vAxMax[3] < MIN_Z2_FOR_ENG_XZ2_V, MIN_ENG_V, MIN_ENG_XZ2_V))
local dRollFront = max( b3Enc:getMax():getX(), dMinFrontEng) + SIC_V local dRollFront = max( b3Enc:getMax():getX(), dMinFrontEng) + nSecRollerDist
local dMinBackEng = EgtIf( nSetHead ~= 2, MIN_ENG_V, EgtIf( vAxMax[3] < MIN_Z2_FOR_ENG_XZ2_V, MIN_ENG_V, MIN_ENG_XZ2_V)) local dMinBackEng = EgtIf( nSetHead ~= 2, MIN_ENG_V, EgtIf( vAxMax[3] < MIN_Z2_FOR_ENG_XZ2_V, MIN_ENG_V, MIN_ENG_XZ2_V))
local dRollBack = max( -b3Enc:getMin():getX(), dMinBackEng) + SIC_V local dRollBack = max( -b3Enc:getMin():getX(), dMinBackEng) + nSecRollerDist
EgtOutLog( ' RollFront = ' .. EgtNumToString( dRollFront, 1) .. ' RollBack = ' .. EgtNumToString( dRollBack, 1), 3) EgtOutLog( ' RollFront = ' .. EgtNumToString( dRollFront, 1) .. ' RollBack = ' .. EgtNumToString( dRollBack, 1), 3)
-- Calcolo della posizione della Punta Utensile rispetto allo Zero Macchina -- Calcolo della posizione della Punta Utensile rispetto allo Zero Macchina
local ptTip local ptTip
@@ -987,7 +1014,11 @@ function SpecCalcLoad( dPosT, dDistFront, dDistBack)
local dNewY1min = max( EMC.LB - dDistBack, MinOther + AggLoad + EMC.HCING + EMC.HOVM) local dNewY1min = max( EMC.LB - dDistBack, MinOther + AggLoad + EMC.HCING + EMC.HOVM)
local dNewY1max = min( ( MaxY1 - MinY1) - 5, EMC.LB - MinJoin) local dNewY1max = min( ( MaxY1 - MinY1) - 5, EMC.LB - MinJoin)
if dNewY1min > dNewY1max then return nil end if dNewY1min > dNewY1max then return nil end
local dNewY1Delta = EgtClamp( BD.CHAR_LOAD_DIST or 3000, 0.75 * dNewY1min + 0.25 * dNewY1max, 0.25 * dNewY1min + 0.75 * dNewY1max) -- minimo posizionamento pinza 1 per permettere scarico del restante
local dMinLengthRestToUnload = abs( MinY1) + abs( MinV1) + abs( MaxV2) + abs( MaxY2) + MinJoin + AggLoad + EMC.LT + 10
-- calcolo posizionamento con i coefficienti, ma verifico che sia tra il minimo e il massimo pinzabile
local dNewY1DeltaMax = EgtClamp( 0.25 * dNewY1min + 0.75 * dNewY1max, dMinLengthRestToUnload, dNewY1max)
local dNewY1Delta = EgtClamp( BD.CHAR_LOAD_DIST or 3000, 0.75 * dNewY1min + 0.25 * dNewY1max, dNewY1DeltaMax)
local dNewY2Delta = nil local dNewY2Delta = nil
local dNewY1 = dPosT + dNewY1Delta local dNewY1 = dPosT + dNewY1Delta
local vCmd = {} local vCmd = {}
@@ -1031,7 +1062,7 @@ function SpecCalcLoad( dPosT, dDistFront, dDistBack)
end -- SpecAdjustLoad [L] end -- SpecAdjustLoad [L]
--------------------------------------------------------------------- ---------------------------------------------------------------------
function SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar) function SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar, AuxInfoMach)
local MinFrontJoin = MinJoin + EMC.HCING + EMC.HOVM local MinFrontJoin = MinJoin + EMC.HCING + EMC.HOVM
local MyMinOther = MinOther + EgtIf( EMC.CNT == 1, AggLoad, 0) local MyMinOther = MinOther + EgtIf( EMC.CNT == 1, AggLoad, 0)
@@ -1065,11 +1096,19 @@ 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 = nil WorkTab.dY2DeltaMinF = nil
WorkTab.dY2DeltaMaxF = nil WorkTab.dY2DeltaMaxF = nil
if dY1DeltaMaxSP then WorkTab.dY1DeltaMaxF = min( WorkTab.dY1DeltaMaxF, dY1DeltaMaxSP) end
WorkTab.dV1PosF = dRollBack WorkTab.dV1PosF = dRollBack
WorkTab.bV1CloseF = false WorkTab.bV1CloseF = false
WorkTab.dV2PosF = -dRollFront WorkTab.dV2PosF = -dRollFront
WorkTab.bV2CloseF = false WorkTab.bV2CloseF = false
-- dopo che si è calcolato il minimo e massimo dell'intervallo, verifico che in testa rimanga almeno il minimo per poter fare passaggio pinze e scaricare
if AuxInfoMach and ( AuxInfoMach.bSplitting or AuxInfoMach.bCutting) then
if WorkTab.dY1DeltaMaxF - WorkTab.dY1DeltaMinF > 1.5 * BD.CHAR_EXTRA_DIST and WorkTab.dY1DeltaMaxF > EMC.LT + BD.MINRAW_S + BD.CHAR_EXTRA_DIST then
WorkTab.dY1DeltaMinF = max( min( EMC.LT + BD.MINRAW_S, WorkTab.dY1DeltaMaxF - 1), WorkTab.dY1DeltaMinF)
end
end
-- verifico validità intervallo ammesso per Y1 -- verifico validità intervallo ammesso per Y1
if WorkTab.dY1DeltaMinF > WorkTab.dY1DeltaMaxF + 10 * GEO.EPS_SMALL then if WorkTab.dY1DeltaMinF > WorkTab.dY1DeltaMaxF + 10 * GEO.EPS_SMALL then
EMC.ERR = 18 EMC.ERR = 18
@@ -1106,6 +1145,13 @@ function SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1Del
WorkTab.dV2PosF = -dRollFront WorkTab.dV2PosF = -dRollFront
WorkTab.bV2CloseF = false WorkTab.bV2CloseF = false
-- dopo che si è calcolato il minimo e massimo dell'intervallo, verifico che in testa rimanga almeno il minimo per poter fare passaggio pinze e scaricare
if AuxInfoMach and ( AuxInfoMach.bSplitting or AuxInfoMach.bCutting) then
if WorkTab.dY1DeltaMaxF - WorkTab.dY1DeltaMinF > 1.5 * BD.CHAR_EXTRA_DIST and WorkTab.dY1DeltaMaxF > EMC.LT + BD.MINRAW_S + BD.CHAR_EXTRA_DIST then
WorkTab.dY1DeltaMinF = max( min( EMC.LT + BD.MINRAW_S, WorkTab.dY1DeltaMaxF - 1), WorkTab.dY1DeltaMinF)
end
end
-- verifico validità intervallo ammesso per Y1 -- verifico validità intervallo ammesso per Y1
if WorkTab.dY1DeltaMinF > WorkTab.dY1DeltaMaxF + 10 * GEO.EPS_SMALL then if WorkTab.dY1DeltaMinF > WorkTab.dY1DeltaMaxF + 10 * GEO.EPS_SMALL then
EMC.ERR = 18 EMC.ERR = 18
@@ -1280,21 +1326,30 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function ChangedTool( nMchId) local function ChangedTool( nMchId)
local bChanged = false local nChanged = 0
-- Salvo lavorazione e utensile correnti, per ripristinarli alla fine -- Salvo lavorazione e utensile correnti, per ripristinarli alla fine
local nOrigMchId = EgtGetCurrMachining() local nOrigMchId = EgtGetCurrMachining()
local sOrigTool = EgtTdbGetCurrToolParam( MCH_TP.NAME) local sOrigTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
local sOrigBlockedAx = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
-- Recupero l'utensile della lavorazione precedente -- Recupero l'utensile della lavorazione precedente
local nPrevMchId = EgtGetPrevActiveOperation( nMchId or GDB_ID.NULL) local nPrevMchId = EgtGetPrevActiveOperation( nMchId or GDB_ID.NULL)
if nPrevMchId and EgtGetOperationType( nPrevMchId) ~= MCH_OY.DISP then if nPrevMchId and EgtGetOperationType( nPrevMchId) ~= MCH_OY.DISP then
EgtSetCurrMachining( nPrevMchId) EgtSetCurrMachining( nPrevMchId)
local sTool = EgtGetMachiningParam( MCH_MP.TOOL) local sTool = EgtGetMachiningParam( MCH_MP.TOOL)
bChanged = ( sTool ~= sOrigTool) nChanged = EgtIf( sTool ~= sOrigTool, 1 , 0)
local sBlockedAx = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
-- se stesso utensile, ma modo caricamento diverso, è come se fosse un cambio utensile. Vale solo se aggregato su lama da sotto.
if sTool == sOrigTool then
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if sHead == 'H22' and sOrigBlockedAx ~= sBlockedAx then
nChanged = 2
end
end
end end
-- Ripristino lavorazione e utensile correnti -- Ripristino lavorazione e utensile correnti
if nOrigMchId then EgtSetCurrMachining( nOrigMchId) end if nOrigMchId then EgtSetCurrMachining( nOrigMchId) end
if sOrigTool then EgtTdbSetCurrTool( sOrigTool) end if sOrigTool then EgtTdbSetCurrTool( sOrigTool) end
return bChanged return nChanged
end end
-------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------
@@ -1303,9 +1358,9 @@ end
function SpecAdjustCarriages( WorkTab) function SpecAdjustCarriages( WorkTab)
--EgtOutLog( ' --->>> CNT=' .. EgtIf( EMC.CNT, '1', '_')) --EgtOutLog( ' --->>> CNT=' .. EgtIf( EMC.CNT, '1', '_'))
local bChangedTool = ChangedTool( EMC.MCHID)
-- Aggiorno la posizione dei rulli per eventuale cambio utensile -- Aggiorno la posizione dei rulli per eventuale cambio utensile
if ChangedTool( EMC.MCHID) then if bChangedTool ~= 0 then
WorkTab.dV1PosI = ParkV1 WorkTab.dV1PosI = ParkV1
WorkTab.dV2PosI = ParkV2 WorkTab.dV2PosI = ParkV2
end end
@@ -1314,15 +1369,24 @@ function SpecAdjustCarriages( WorkTab)
if WorkTab.dY1DeltaI then if WorkTab.dY1DeltaI then
local dY1DeltaLim = MinJoin + WorkTab.dV1PosI - WorkTab.dV2PosI + 2 * AGG_V + EMC.HCING + EMC.HOVM + EgtIf( EMC.CNT == 1, AggLoad, 0) local dY1DeltaLim = MinJoin + WorkTab.dV1PosI - WorkTab.dV2PosI + 2 * AGG_V + EMC.HCING + EMC.HOVM + EgtIf( EMC.CNT == 1, AggLoad, 0)
if WorkTab.dY1DeltaI <= dY1DeltaLim or ( WorkTab.dY1DeltaMaxF and WorkTab.dY1DeltaMaxF <= dY1DeltaLim) then if WorkTab.dY1DeltaI <= dY1DeltaLim or ( WorkTab.dY1DeltaMaxF and WorkTab.dY1DeltaMaxF <= dY1DeltaLim) then
bCloseV = true bCloseV = true
end end
end end
if WorkTab.dY2DeltaI then if WorkTab.dY2DeltaI then
local dY2DeltaLim = MinJoin + WorkTab.dV1PosI - WorkTab.dV2PosI + 2 * AGG_V local dY2DeltaLim = MinJoin + WorkTab.dV1PosI - WorkTab.dV2PosI + 2 * AGG_V
if EMC.LB - WorkTab.dY2DeltaI <= dY2DeltaLim or ( WorkTab.dY2DeltaMinF and EMC.LB - WorkTab.dY2DeltaMinF <= dY2DeltaLim) then if EMC.LB - WorkTab.dY2DeltaI <= dY2DeltaLim or ( WorkTab.dY2DeltaMinF and EMC.LB - WorkTab.dY2DeltaMinF <= dY2DeltaLim) then
bCloseV = true bCloseV = true
end end
end end
-- se ho cambiato modo di prendere utensile, forzo chiusura
if bChangedTool == 2 then
bCloseV = true
end
-- se i pezzi del cliente sono molto storti, si forza la chiusura per evitare che vada a sbattere. Se parametro non presente, si chiude solo se necessario
if ForceToCloseRollersGate then
bCloseV = true
end
WorkTab.bCloseV = bCloseV WorkTab.bCloseV = bCloseV
-- |POSIZIONO Y1| **[A]** -- |POSIZIONO Y1| **[A]**
@@ -1835,7 +1899,7 @@ local function PosY1Y2B( TabI, vCmd)
end end
end end
nCnt = nCnt + 1 nCnt = nCnt + 1
if nCnt > 5 then return end if nCnt > 10 then return end
until ( not bXW) until ( not bXW)
-- chiusura/parcheggio dei trascinatori in funzioni chiamanti -- chiusura/parcheggio dei trascinatori in funzioni chiamanti
local dY1Delta = TabI.dY1PosI - TabI.dTPosI local dY1Delta = TabI.dY1PosI - TabI.dTPosI
@@ -1899,7 +1963,6 @@ local function PosY2Y1A( TabI, vCmd)
MaxDispl( TabI, vCmd, 'M1') MaxDispl( TabI, vCmd, 'M1')
end end
end end
until ( not bXW) until ( not bXW)
-- chiusura/parcheggio dei trascinatori in funzioni chiamanti -- chiusura/parcheggio dei trascinatori in funzioni chiamanti
local dY1Delta = TabI.dY1PosI - TabI.dTPosI local dY1Delta = TabI.dY1PosI - TabI.dTPosI
@@ -1967,14 +2030,14 @@ local function PosY2Y1B( TabI, vCmd)
if TabI.dY2PosI > MinY2 and if TabI.dY2PosI > MinY2 and
TabI.dY2PosI > TabI.dTPosI + MinJoin + EMC.HOVM + EMC.HCING - 10 * GEO.EPS_SMALL then TabI.dY2PosI > TabI.dTPosI + MinJoin + EMC.HOVM + EMC.HCING - 10 * GEO.EPS_SMALL then
-- allontanamento morse, trascinamento trave con Y2 -- allontanamento morse, trascinamento trave con Y2
MaxDispl( TabI, vCmd, 'M2') MaxDispl( TabI, vCmd, 'M2')
else else
-- accentramento morse, trascinamento trave con Y1 -- accentramento morse, trascinamento trave con Y1
MaxDispl( TabI, vCmd, 'M3') MaxDispl( TabI, vCmd, 'M3')
end end
end end
nCnt = nCnt + 1 nCnt = nCnt + 1
if nCnt > 5 then return end if nCnt > 10 then return end
until ( not bXW) until ( not bXW)
-- la chiusura delle morse è fatta sopra -- la chiusura delle morse è fatta sopra
local dY1Delta = TabI.dY1PosI - TabI.dTPosI local dY1Delta = TabI.dY1PosI - TabI.dTPosI
+115 -1
View File
@@ -1,5 +1,119 @@
==== Common_PF1250 Update Log ==== ==== Common_PF1250 Update Log ====
Versione 2.6k3 (26/11/2024)
- (GEN) Corretta modifica fatta in versione 2.6k2. Ticket#2183
Versione 2.6k2 (25/11/2024)
- (GEN) Se si preseleziona su testa 1 un utensile lungo, non si va alla X successiva di lavoro ma si resta in home. Infatti potrebbe toccare le paratie in caso di scambio pezzo. Ticket#2183
Versione 2.6k1 (04/11/2024)
- (SIM-GEN) Gestione terza testa 5 assi dedicata lama (H38)
Versione 2.6j3 (25/10/2024)
- (GEN) Piccola correzione per capire se testa 3 presente
- (SIM-GEN) In caso di lavorazione successiva alla prima, rivisto primo posizionamento alla quota Z di lavoro se precedentemente spostati a quota rotazione assi rotanti.
Versione 2.6j2 (23/10/2024)
- (MLDE-SIM) Aggiunto parametro ParkTc1X1 in MLDE per simulazione quota parcheggio Testa 1 su TC1.
- (SIM-GEN) Per movimento a ZMAX si considera utensile attuale o precedente
- (SIM-GEN) Prima versione con gestione testa 3 dedicata lama
Versione 2.6j1 (01/10/2024)
- (GEN) Migliorato calcolo chiusura paratia rulli con aggiornamento lunghezza della barra in caso di ultimo taglio e grezzo residuo in coda. Ticket#2017
- (NGE-SIM) Aggiunta gestione solidi collisione per TC verticali e TC rotante sotto
- (GEN) Per lavorazione in doppio: messaggio bloccante in caso di extra-corsa durante un movimento standard su piano generico della lavorazione.
Versione 2.6i1 (10/09/2024)
- (GEN) Se diametro utensile più del truciolatore standard grande, non si preseleziona. Ticket#2028
Versione 2.6h2 (28/08/2024)
- (SIM-GEN) Quando si aprono i rulli, se la trave non può seguire i rulli perchè la pinza andrebbe in extra-corsa, si sposta comunque la pinza fino al massimo della sua corsa. Ticket#1949
- (GEN) La testa veniva spostata a quota X sicurezza rotazione assi rotanti prima di aprire le rulliere. Ticket#1991
Versione 2.6h1 (07/08/2024)
- (GEN) Gestione creazione piano generico in caso il primo movimento della lavorazione sia un arco. Ticket#1891
- (SIM-GEN) Migliorata gestione riposizionamenti fatta con la 2.6g1. Ticket#1836
- (MLDE-SIM-GEN) Rinominato file da "Common-" a "Common_" per uniformità con i file common delle altre macchine. Serve modifica a MLDE macchina.
Versione 2.6g5 (24/07/2024)
- (SIM) Per OnSetHead chiamata da simulazione, aggiunta lettura TOTDIAM. Serve per limitare corse assi testa sotto. Ticket#1946
Versione 2.6g4 (23/07/2024)
- (SIM) Corretta ultima modifica per controllo collisioni testa non utilizzata. Trovava collisioni in lavorazioni in doppio.
Versione 2.6g3 (22/07/2024)
- (SIM) Si aggiunge al controllo collisioni anche Tool e ToolHolder della testa non utilizzata. Ticket#1937
- (SIM-GEN) In caso di grezzo piuttosto piccolo, concesso pinzaggio fino al massimo possibile, oltre al calcolo con coefficienti. Ticket#1942
Versione 2.6g2 (12/07/2024)
- (SIM-GEN) Corretto movimento testa sotto che andava in collisione tra una lavorazione e la successiva se tra le due c'era un riposizionamento pinze. Ticket#1925
Versione 2.6g1 (08/07/2024)
- (SIM-GEN) Corretto movimento che pinzava nel vuoto durante riposizionamento. Ticket#1836
Versione 2.6f2 (06/06/2024)
- (GEN) Quando si va a ZMAX, si azzerano tutte le coordinate ".pp". Scriveva una Z bassa quando era a Z massima. Ticket#1839
Versione 2.6f1 (03/06/2024)
- (SIM-GEN) Migliorata gestione approccio al pezzo con lama aggregato da sotto. Va al minimo in X solo se necessario.
Versione 2.6e6 (28/05/2024)
- (GEN) Aggiunta possibilità di scrivere nome utensile doppio anche in lavorazione con parametro "TOOLDOUBLE". Note sulla lavorazione hanno precedenza su note utensile.
- (GEN) Ripristinato controllo extra-corsa per testa 2 in caso di lavorazioni in doppio in Y (si era perso in un vecchio commit)
- (SIM-GEN) Corretto movimento testa sotto su prima lavorazione. Ruotava a parcheggio invece di andare a quota sicurezza rotazione assi.
Versione 2.6e5 (23/05/2024)
- (GEN) Controllo extra-corsa per testa 2 in caso di lavorazioni in doppio in Y
- (GEN) Corretta lettura e salvataggio coordinala asse L2 con coordinate rispetto origine. Prima erano locali e sbagliava alcuni calcoli
- (SIM-GEN) Se lavorazione con testa 2 e stesso utensile, piccola correzione che manda a parcheggio se cambiano assi rotanti solo se si trova a ZMAX
Versione 2.6e4 (15/05/2024)
- (SIM-GEN) Miglioramento gestione lama su aggregato da sotto
Versione 2.6e3 (09/05/2024)
- (SIM) Corretto prelievo lama 2 (H16). Prima di visualizzare utensile, si sposta la Z alla quota massima. Prima trovava collisione in caso utensile precedente non lama (perchè era già oltre la quota massima).
Versione 2.6e2 (06/05/2024)
- (GEN) In parcheggio paratie/pinze, viene considerato sovramateriale di testa. Simulazione era corretta. Ticket#1789
Versione 2.6e1 (30/04/2024)
- (SIM-GEN) Per macchina a 3 teste, ripristinato posizionamento testa 2 tramite parametro ParkInLavZ2. La gestione era stata persa dal common.
- (MLDE-GEN) Gestione facoltativa parametro WOOD_DENSITY settabile in Ts3. In MLDE, mettere il valore di WOOD_DENSITY nella nostra variabile 'WoodDensity'.
Versione 2.6d2 (23/04/2024)
- (MLDE-GEN) Aggiunto parametro 'IS_TEST_MACHINE' FACOLTATIVO. Se non esiste o 'false' è macchina standard, se 'true' è una macchina utilizzata per i test Egalware interni
- (GEN) Chiamando la macchina con un nome che termini con '.TEST' si abilita come macchina per test interni, equivalente a settare 'IS_TEST_MACHINE' (che comunque rimane)
- (SIM-GEN) Modificato movimenti testa sotto. Prima si muove in quota 'ParkMchY2' e poi va alla coordinata di lavoro ruotando gli assi
- (SIM) Per lavorazioni in doppio, viene subito scritta la quota Z. La generazione era già corretta. Ticket#1377
- (GEN) Ripristinato movimento iniziale testa sopra assieme alle pinze. Spostato comando wait dopo primo movimento testa. Ticket#1730
- (MLDE-SIM-GEN) Aggiunto parametro MaxZ1Blade per differenziare Z massima aggregato lama e altri utensili.
- (SIM) Aggiunto controllo con solido di collisione per verificare di non salire oltre il massimo
- (SIM) Corretta simulazione scambio testa 3 -> testa 1
Versione 2.6d1 (09/04/2024)
- (GEN) Corretto impostazione piano G24 con testa da sotto con aggregato
- (SIM-GEN) Corretta posizione prelievo/parcheggio se lama su aggregato da sotto
- (MLDE-SIM-GEN) Aggiunta variabile FACOLTATIVA 'ForceToCloseRollersGate' ( che legge la variabile da TS3 'CHIUDI_PINZE_2_3_SCAMBIO') in mlde per forzare chiusura paratie rulli
durante scambio pinze per facilitare passaggio pezzi molto storti. Se non presente chiude solo se necessario.
- (GEN) Corretta scrittura lista utensili iniziale M992 per doppia motosega e aggregato lama sotto
- (SIM-GEN) Corretto movimento punte lunghe
- (GEN) Corretto adeguamento speed per aggregato lama da sotto con coefficiente moltiplicativo
- (SIM-GEN) Aumentato numero riposizionamenti possibili a 10 ( per pezzi molto lunghi non bastava il valore precedente: 5)
- (GEN) Corretto posizionamento assi in home se primo utensile punta lunga
Versione 2.6c5 (26/03/2024)
- (SIM) Corretto primo movimento in rapido della lavorazione per testa sotto. Ora allineata a generazione
- (SIM-GEN) Aggiunta gestione parametro "SECDIST". Distanza di sicurezza tra paratia con rulli e utensile/testa. Parametro da inserire nelle note utensile
- (MLDE-SIM) Modificate collisioni traversa. Ora non comprende carro X1, il quale ha il proprio oggetto di collisione
Versione 2.6c4 (14/03/2024)
- (SIM) Miglioramento visualizzazione spigoli VMILL alla fine della simulazione. Funzione: EgtVolZmapSetShowEdges. N.B.= serve CAM5 2.6c2 NON OBBLIGATORIO
- (GEN) Modifica controlli a preselezione utensile. Margine ridotto da 400m a 200mm.
- (GEN) Corretto controllo preselezione testa H1 quando H2 in lavoro
Versione 2.6c3 (12/03/2024)
- (SIM-GEN) Migliorata gestione movimenti con lama su aggregato su testa sotto
Versione 2.6c2 (04/03/2024) Versione 2.6c2 (04/03/2024)
- (GEN) I commenti iniziali si scrivono in modo standard, per poterli commentare nella macchina di test - (GEN) I commenti iniziali si scrivono in modo standard, per poterli commentare nella macchina di test
- (MLDE-GEN) Aggiunta variabile 'MACH_NAME' in MLDE con nome macchina - (MLDE-GEN) Aggiunta variabile 'MACH_NAME' in MLDE con nome macchina
@@ -11,7 +125,7 @@ Versione 2.6b4 (23/02/2024)
- (MLDE-SIM-GEN) EgtAddToPackagePath spostato in mlde - (MLDE-SIM-GEN) EgtAddToPackagePath spostato in mlde
Versione 2.6b3 (20/02/2024) Versione 2.6b3 (20/02/2024)
- (SIM) Aggiunta funzioni "OnSimulInit" e "OnSimulExit" per orientare vista corretta in caso di macchina con carico destro. N.B.= serve CAM5 2.6b4 - (SIM) Aggiunta funzioni "OnSimulInit" e "OnSimulExit" per orientare vista corretta in caso di macchina con carico destro. N.B.= serve CAM5 2.6b4 NON OBBLIGATORIO
- (SIM-GEN) "BeamData" caricato come libreria con 'require' anziché come file con 'dofile' - (SIM-GEN) "BeamData" caricato come libreria con 'require' anziché come file con 'dofile'
Versione 2.6b2 (15/02/2024) Versione 2.6b2 (15/02/2024)
+1 -1
View File
@@ -3,7 +3,7 @@
local InfoCommon_STD_PP = { local InfoCommon_STD_PP = {
NAME = 'Common_PF1250', -- nome script PP standard NAME = 'Common_PF1250', -- nome script PP standard
VERSION = '2.6c2', -- versione script VERSION = '2.6k3', -- versione script
MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel
} }