Compare commits

..

43 Commits

Author SHA1 Message Date
luca.mazzoleni e7e820be06 update log mlde e versione 2024-03-05 15:32:39 +01:00
luca.mazzoleni f9b9d97249 Merge branch 'develop' 2024-03-05 15:30:29 +01:00
luca.mazzoleni 16e028b162 - corretto portautensile Standard_LC_108 2024-03-05 15:30:15 +01:00
andrea.villa b1d3882275 Merge remote-tracking branch 'origin/develop' 2024-03-04 10:41:55 +01:00
andrea.villa de461afbc9 - Modificato log con nome macchina
- Allineamento con common ver. 2.6c2
2024-03-04 10:41:38 +01:00
luca.mazzoleni 3f13a7267e - corretto portautensile Standard_LC_108 (geometria di collisione errata) 2024-03-01 12:46:50 +01:00
andrea.villa 8ba4e8bf3f Cambiato output log versione Post 2024-03-01 10:06:05 +01:00
andrea.villa 53d7ec91c8 Merge branch 'main' into develop 2024-02-29 10:00:58 +01:00
andrea.villa 3986246bae Allineamento con common ver. 2.6c1 2024-02-29 10:00:47 +01:00
luca.mazzoleni 25917ff9a8 Merge branch 'main' into develop 2024-02-27 12:22:10 +01:00
luca.mazzoleni 9719ee616f corretta versione e aggiunto compile 2024-02-26 16:07:17 +01:00
luca.mazzoleni 2414169862 - allineamento con common 2.6b4
- in mlde aggiunte chiamate a EgtAddToPackagePath
- eliminate chiamate a EgtGetSourceDir
2024-02-26 13:10:42 +01:00
andrea.villa 473a3a8fe6 Allineamento con common 2.6b3 2024-02-20 11:40:47 +01:00
andrea.villa dcf475d446 - Allineamento con common 2.6b2
- 'GetCurrChainSawingVirtualAxis' in MLDE
2024-02-15 15:39:12 +01:00
luca.mazzoleni 2add45fe3a Merge branch 'develop' 2024-02-09 14:54:57 +01:00
luca.mazzoleni caab876f4e 2.6b1
- Corretto errore in definizione testa H22
- In BeamData migliorata funzione GetBlockedAxis
2024-02-09 14:54:35 +01:00
luca.mazzoleni 1113c02971 Merge remote-tracking branch 'origin/main' into develop 2024-01-30 12:32:07 +01:00
andrea.villa a65d80cbf1 Allineamento con Common 2.6a4 2024-01-25 09:38:56 +01:00
andrea.villa bb5fef1d7b Merge branch 'develop' 2024-01-22 13:30:40 +01:00
andrea.villa 6c37440557 Merge branch 'develop' of https://gitlab.steamware.net/egalware-machines/essetre/Essetre-PF1250MAX into develop 2024-01-22 13:29:50 +01:00
andrea.villa a00ed32933 Essetre-PF1250MAX 2.6a3
- Migliorata preselezione utensile
- Rimosse funzioni ribaltamento pezzo
- Allineamento con Common-PF1250 v.2.6a3
2024-01-22 13:26:53 +01:00
luca.mazzoleni 2f4499b15d Merge branch 'main' into develop 2024-01-22 13:14:04 +01:00
luca.mazzoleni b4646d8fa7 Merge branch 'develop' 2024-01-22 13:13:48 +01:00
luca.mazzoleni 47942a8921 in BeamLib aggiunta la funzione GetBlockedAxis che sostituisce le altre (GetChainSawBlockedAxis e GetSawBlockedAxis) 2024-01-22 13:13:22 +01:00
andrea.villa a4b28964a3 Merge branch 'main' into develop 2024-01-09 16:54:58 +01:00
andrea.villa c97b8dad28 Merge branch 'develop' 2024-01-09 16:54:40 +01:00
andrea.villa 1138140133 2.6a2 Allineamento con Common-PF1250 v.2.6a2 2024-01-09 16:53:48 +01:00
andrea.villa a33867ccec Merge branch 'main' into develop 2024-01-09 14:56:28 +01:00
andrea.villa f38e0cffec Merge branch 'develop' 2024-01-09 14:55:08 +01:00
andrea.villa 166a7666bc Piccole correzioni a messaggi 2024-01-09 14:52:11 +01:00
andrea.villa d03c605285 Merge branch 'develop' 2024-01-09 14:47:27 +01:00
andrea.villa d751b4950f Aggiunato variabile 'WriteAllCoordsOnFirstM101' e allineamento con 2.6a1 common 2024-01-09 12:28:57 +01:00
luca.mazzoleni 2c36caab30 corretto typo nome variabile 2024-01-08 18:15:15 +01:00
luca.mazzoleni 82106271ab Costanti MinForzaPinze e MaxForzaPinze portati in mlde/Ts3data (erano hardcoded) 2024-01-05 18:01:06 +01:00
andrea.villa 4e4d73bb6e Merge branch 'develop' of https://gitlab.steamware.net/egalware-machines/essetre/Essetre-PF1250MAX into develop 2024-01-05 12:44:55 +01:00
andrea.villa 85069971c1 Piccola correzione posizione magazzini sotto-trave 2024-01-05 12:44:52 +01:00
luca.mazzoleni fca3f67082 In BeamData aggiunta GetSawBlockedAxis per fissare asse bloccato per aggregato lama sotto 2024-01-04 16:29:24 +01:00
andrea.villa c51a208c4a Tolta testa H14 per utensili speciali. Si utilizza H11 per frese standard 2024-01-04 12:12:24 +01:00
andrea.villa caf990c23b Corretto movimento testa 2 in ToolDesel e movimento controllo collisione 2023-12-22 13:26:26 +01:00
luca.mazzoleni 8d4ab5ce67 aggiunto portautensile LC da 108 mm 2023-12-22 11:39:01 +01:00
andrea.villa fae1c3e50d - Invertiti magazzini mortasatrice-truciolatore e adeguati solidi di collisione
- Abbasstata testa 2 di 300mm
- Parcheggio motosega portato a 1700mm
2023-12-21 15:39:39 +01:00
andrea.villa cb27d30d6e 2.6a1 : Prima versione con post Common-PF1250 2023-12-20 13:02:35 +01:00
luca.mazzoleni 817880d925 Merge tag '2.5l4' into develop
Finish Release: 2.5l4
2023-12-20 11:56:47 +01:00
14 changed files with 1044 additions and 365 deletions
+1
View File
@@ -15,3 +15,4 @@
/Wall/PocketingData.lua
/Wall/SawingData.lua
/Wall/Ts3Data.lua
.vscode/settings.json
+32 -9
View File
@@ -78,11 +78,9 @@ local BeamData = {
---------------------------------------------------------------------
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PF1250MAX.data"
local sDataBeam = EgtGetSourceDir().."\\Ts3Data.lua"
local sDataWall = EgtGetCurrMachineDir()..'\\Wall\\Ts3Data.lua'
local sDataBeam = EgtGetCurrMachineDir().."\\Beam\\Ts3Data.lua"
if EgtExistsFile( sTs3Data) then
EgtCopyFile( sTs3Data, sDataBeam)
EgtCopyFile( sTs3Data, sDataWall)
local sTs3DataOld = sTs3Data..'.old'
EgtEraseFile( sTs3DataOld)
EgtRenameFile( sTs3Data, sTs3DataOld)
@@ -178,15 +176,40 @@ end
BeamData.GetMinUnloadableRaw = GetMinUnloadableRaw
---------------------------------------------------------------------
local function GetChainSawBlockedAxis( nInd)
if nInd == 1 then
return 'A1=90'
local function GetBlockedAxis( sHead, nToolType, sBlockedAxis)
-- lama
if nToolType == MCH_TY.SAW_STD or nToolType == MCH_TY.SAW_FLAT then
if sHead == 'H22' then
if sBlockedAxis == 'parallel' then
return 'A2=0'
elseif sBlockedAxis == 'perpendicular' then
return 'A2=90'
end
else
return ''
end
-- sega a catena
elseif nToolType == MCH_TY.MORTISE_STD then
if sHead == 'H13' then
if sBlockedAxis == 'parallel' then
return 'A1=0'
elseif sBlockedAxis == 'perpendicular' then
return 'A1=90'
end
else
return ''
end
-- fresa
elseif nToolType == MCH_TY.MILL_STD or nToolType == MCH_TY.MILL_NOTIP then
return ''
-- punta
elseif nToolType == MCH_TY.DRILL_STD or nToolType == MCH_TY.DRILL_LONG then
return ''
else
return 'A1=0'
return ''
end
end
BeamData.GetChainSawBlockedAxis = GetChainSawBlockedAxis
BeamData.GetBlockedAxis = GetBlockedAxis
---------------------------------------------------------------------
return BeamData
+480 -126
View File
@@ -1,12 +1,13 @@
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Processore macchina Essetre-PF1250 by Egalware s.r.l. 2024/01/22
-- Con controllo numerico TPA
-- Carico i dati globali
local sBaseDir = EgtGetSourceDir()
local BD = dofile( sBaseDir .. 'Beam\\BeamData.lua')
-- Carico libreria
local BD = require( 'BeamData')
-- Variabili di modulo
local MLE_INFO = 'Essetre-PF1250.TPA.mlpe ver.'..PP_VER..' by EgalTech s.r.l.'
local CSP_INFO = INFO_STD_PP.NAME..' ver.'..INFO_STD_PP.VERSION..' by EgalWare s.r.l.'
local MACHINE_INFO = MACH_NAME..' ver.'..PP_VER
local TEST_USE = false
---------------------------------------------------------------------
@@ -14,8 +15,8 @@ local TEST_USE = false
---------------------------------------------------------------------
function OnStart()
-- controllo versione programma
if not EMT.VER or EMT.VER < '2.5d1' then
EmtSetLastError( 1200, 'A newer version of the program is required (minimum EgtMachKernel 2.5d1)')
if not EMT.VER or EMT.VER < MIN_MACH_VER then
EmtSetLastError( 1200, 'A newer version of the program is required (minimum EgtMachKernel '..MIN_MACH_VER..')')
end
EMT.USETO1 = false -- abilitazione uso origine tavola
EMT.MODAL = true -- abilitazione emissione modale
@@ -41,11 +42,13 @@ end
function OnProgramStart()
-- Intestazioni
if EMT.INFO then
EmitRemark( EMT.INFO)
MyOutput( '('..EMT.INFO..')')
else
EmitRemark( 'Program Start')
MyOutput( '(Program Start)')
end
EmitRemark( MLE_INFO)
MyOutput( '('.. CSP_INFO..')')
MyOutput( '('.. MACHINE_INFO..')')
-- Se modalità test, aggiungo linee per muovere tappeto e alzare la testa (in automatico viene fatto dal main residente)
if TEST_USE then
MyOutput( 'M199')
@@ -144,8 +147,15 @@ function OnDispositionStart()
' P10='..EmtLenToString( -TurnerOffs, 2)..' P11='..EmtLenToString( MinV1, 2)..' P12='..EmtLenToString( MaxV1, 2)..
' P13='..EmtLenToString( MinV2, 2)..' P14='..EmtLenToString( MaxV2, 2)..
' P15='..EmtLenToString( -DeltaTabY, 2)..' P16='..EmtLenToString( DeltaTabZ - MillOffs, 2)..
' P17='..EmtLenToString( Delta2TabY, 2)..' P18='..EmtLenToString( -Delta2TabZ - Mill2Offs, 2)..
' P22='..EmtLenToString( -MinZ2, 2)
' P17='..EmtLenToString( Delta2TabY, 2)..' P18='..EmtLenToString( -Delta2TabZ - Mill2Offs, 2)
-- se è in configurazione a 3 teste
if EgtGetHeadId( 'H31') then
sOut = sOut .. ' P19='..EmtLenToString( -Delta3TabY, 2)..' P20='..EmtLenToString( Delta3TabZ - Mill3Offs, 2)..
' P21='..EmtLenToString( Mill3Offs, 2).. ' P22='.. EmtLenToString( -ParkInLavZ2, 2)
else
sOut = sOut .. ' P22='..EmtLenToString( -MinZ2, 2)
end
MyOutput( sOut)
-- carico barra
EMT.LOAD = true
@@ -207,7 +217,10 @@ function OnDispositionEnd()
' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( nLoad90) .. ' P6=' .. EmtLenToString( LTrave, 2) ..
' P7=' .. EgtNumToString( TempAccPinze, 2) .. ' P8=' .. EgtNumToString( TempAccPinz2, 2) .. ' P9=' .. EgtNumToString( TempAccPinz1, 2) ..
' P10=' .. EgtNumToString( EMT.PARTTYPE or 0, 0)
-- .. ' P11=' .. EgtNumToString( ForzaPinze, 2) .. ' P12=' .. EgtNumToString( ForzaPinze, 2)
-- su macchine vecchie non si poteva settare forza pinzaggio. Parametro da attivare in MLDE
if EmitAccClamps then
sOut = sOut .. ' P11=' .. EgtNumToString( ForzaPinze, 2) .. ' P12=' .. EgtNumToString( ForzaPinze, 2)
end
MyOutput( sOut)
if EMT.LOAD then
SetStartValue( 1, LBarra)
@@ -221,6 +234,10 @@ function OnDispositionEnd()
' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( 0) .. ' P6=' .. EmtLenToString( EgtIf( IdTrave >= 0, LTrave, LBarra), 2) ..
' P7=' .. EgtNumToString( TempAccPinze, 2) .. ' P8=' .. EgtNumToString( TempAccPinz2, 2) .. ' P9=' .. EgtNumToString( TempAccPinz1, 2)..
' P10=' .. EgtNumToString( EMT.PARTTYPE or 0, 0)
-- su macchine vecchie non si poteva settare forza pinzaggio. Parametro da attivare in MLDE
if EmitAccClamps then
sOut = sOut .. ' P11=' .. EgtNumToString( ForzaPinze, 2) .. ' P12=' .. EgtNumToString( ForzaPinze, 2)
end
MyOutput( sOut)
-- determino la quota di parcheggio della trave
local ParkT = GetParkT()
@@ -228,7 +245,7 @@ function OnDispositionEnd()
EMT.Y1DELTA = EMT.Y1POS - ParkT
EMT.Y2DELTA = nil
EmitBeamHeadData( { T=ParkT, Y1=EMT.Y1POS, SetHead=1, F=0})
end
end
-- se altrimenti disposizione intermedia, eventuale rotazione
elseif IsMidPhase( EMT.PHASE) or IsEnd2Phase( EMT.PHASE) then
-- recupero le rotazioni delle fasi corrente e precedente
@@ -382,7 +399,7 @@ function OnMachiningStart()
-- valore dell'asse virtuale
dPosA = GetCurrChainSawingVirtualAxis()
-- imposto home dell'asse C1 (A=0 -> T101, A=90 -> T104)
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA)
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA, EMT.TTOTLEN)
EmtModifyAxisHome( 'C1', MyParkCSawC1)
-- se lama su aggregato testa sotto, aggiusto subito angolo scelto per asse virtuale A
elseif EMT.HEAD == 'H22' then
@@ -420,6 +437,17 @@ function OnMachiningStart()
EmitParkRoller( dPosT, false)
EmitDouZMax( EMT.DOU_TO_ZMAX)
end
-- controllo seguente trovato nella 3T. Da verificare
-- determino subito se taglio di separazione di pezzo a caduta
EMT.PREFALLCUT = nil
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Split') then
local ClId = EgtGetFirstNameInGroup( EMT.MCHID, 'CL')
local P1Id = EgtGetFirstNameInGroup( ClId or GDB_ID.NULL, 'P1')
local sAE1 = EgtGetInfo( P1Id or GDB_ID.NULL, 'AE1') or ''
if sAE1 == '0,Fall' then
EMT.PREFALLCUT = true
end
end
end
---------------------------------------------------------------------
@@ -509,9 +537,11 @@ function OnPathStart()
--MyOutput( 'CNT='.. tostring( EMT.CNT or 0))
-- se utensile non cambiato, salvo eventuali precedenti rotanti
if EMT.TOOL == EMT.PREVTOOL and not EMT.ZMAX then
EMT.L3pp = EMT.L3op
EMT.R1pp = EMT.R1p
EMT.R2pp = EMT.R2p
else
EMT.L3pp = nil
EMT.R1pp = nil
EMT.R2pp = nil
end
@@ -625,6 +655,7 @@ function OnRapid()
if EMT.MCHFIRST and not EMT.OPEISDISP then
MyAdjustLinearAxes()
EmtAdjustRotaryAxes()
local HomeZ1 = EgtGetAxisHomePos( 'Z1')
local HomeR1 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'C1', 'C2'))
local HomeR2 = EgtGetAxisHomePos( EgtIf( nHSet == 1, 'B1', 'B2'))
local PrevR1 = EMT.R1p or EMT.R1pp or HomeR1
@@ -667,28 +698,54 @@ function OnRapid()
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
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, S=Speed})
local bXSpec = EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY))
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, B=ParkB1, C=ParkC1, S=Speed})
else
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=MaxZ1, S=Speed})
end
EmitMoveDataHead( 1, { B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
-- caso standard
else
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
-- se sega a catena
if EMT.HEAD == 'H13' then
EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=HomeZ1, B=HomeR2, C=HomeR1, TRad=dTRad, TLen=dTLen, S=Speed})
-- utensili standard
else
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=EMT.L3, B=ParkB1, C=ParkC1, S=Speed})
end
end
if EMT.HEAD ~= 'H13' then
EmitMoveDataHead( 1, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 1, { B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
else
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
end
end
EmitMoveStartHead( 1)
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 then
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN + 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
dZ2 = min( dZ2, MaxZ2)
dZ2 = min( dZ2, MinZ2)
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=dX2, Z=MinZ2, B=ParkB2, C=ParkC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
@@ -699,7 +756,12 @@ function OnRapid()
dZ2 = max( dZ2, MinZ2)
local dC2 = EMT.R1
local dB2 = EMT.R2
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=dX2, Z=MinZ2, B=ParkB2, C=ParkC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveStartHead( 2)
-- aspetto esecuzione movimento testa 2
@@ -710,10 +772,15 @@ function OnRapid()
end
-- aspetto esecuzione movimento testa 1
EmitMoveWaitHead( 1)
-- altrimenti testa 2
else
-- se altrimenti testa 2
elseif nHSet == 2 then
-- selezione testa (non posso muovere X)
EmitMoveDataHead( 2, { X=ParkX2, S=Speed})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=ParkX2, Z=ParkZ2, B=ParkB2, C=ParkC2, S=Speed})
else
EmitMoveDataHead( 2, { X=ParkX2, S=Speed})
end
EmitMoveStartHead( 2)
EmitMoveWaitHead( 2)
EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3))
@@ -730,10 +797,34 @@ function OnRapid()
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
end
-- se pezzo a destra, dichiaro cabina sinistra da parcheggiare
if not EMT.Y1DELTA then
EMT.V1NEXTPOS = ParkV1
-- altrimenti testa 3
else
-- selezione testa (posso muovere X solo a Zmax)
local MaxZ3 = EgtGetAxisMax( 'Z3')
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 3, { X=EMT.L2, Z=MaxZ3, B=ParkB3, C=0, S=Speed})
else
EmitMoveDataHead( 3, { X=EMT.L2, Z=MaxZ3, S=Speed})
end
EmitMoveStartHead( 3)
EmitMoveWaitHead( 3)
EmitMoveWaitChars( EgtIf( bOnlyCharY, 1, 3))
-- se necessario allargo le cabine
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, EMT.R1, EMT.R2) or
EMT.V1POS < EMT.V1NEXTPOS - 1 or EMT.V2POS > EMT.V2NEXTPOS + 1 then
local dPosT = EMT.TPOS or EMT.L1op
EmitParkRoller( dPosT, bSplitCut)
end
-- eseguo movimenti
local Speed = EMT.S
EmitMoveDataHead( 3, { Z=EMT.L3, S=Speed})
EmitMoveDataHead( 3, { 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)
end
-- dati aggancio a trave
local BhData = { T=EMT.L1, SetHead=0}
@@ -777,7 +868,11 @@ function OnRapid()
EmitParkedLines()
-- se sfrido grande, emetto comando speciale
if EMT.HOVM > 99 then
MyOutput( ';M107')
if EgtGetHeadId( 'H31') then
MyOutput( 'M107')
else
MyOutput( ';M107')
end
end
-- altrimenti lavorazione successiva
else
@@ -810,10 +905,6 @@ function OnRapid()
EmitMoveWaitChars( nMoveType)
end
EMT.MDCHAR = {}
-- se pezzo a destra, dichiaro cabina sinistra da parcheggiare
if not EMT.Y1DELTA then
EMT.V1NEXTPOS = ParkV1
end
-- se necessario allargo le cabine
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, EMT.R1, EMT.R2) or
EMT.V1POS < EMT.V1NEXTPOS - 1 or EMT.V2POS > EMT.V2NEXTPOS + 1 then
@@ -824,7 +915,11 @@ function OnRapid()
if EMT.MCHUSERNOTES and EMT.MCHUSERNOTES:find( 'Cut', 1, true) then
-- se sfrido grande, emetto comando speciale
if EMT.LB - EMT.LT > 99 then
MyOutput( ';M107')
if EgtGetHeadId( 'H31') then
MyOutput( 'M107')
else
MyOutput( ';M107')
end
end
-- emetto M175 per accelerare il carico della barra successiva
MyOutput( ';M175')
@@ -841,12 +936,21 @@ function OnRapid()
-- se fresa o lama
if EMT.HEAD ~= 'H13' then
local CurrZ1 = EMT.L3pp or MyMaxZ1
local CurrB1 = PrevR2
local CurrC1 = PrevR1
-- muovo asse X
local bXSpec = EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY))
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), Z=CurrZ1, B=CurrB1, C=CurrC1, S=Speed})
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( HomeC1 - EMT.R1) > 30.1 or abs( HomeB1 - EMT.R2) > 30.1) then
-- muovo asse X
local bXSpec = ( EMT.L2 < -DeltaTabY)
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), S=Speed})
EmitMoveDataHead( 1, { B=0, S=Speed})
-- se non bisogna scrivere tutti gli assi, comunque ribadisco X in caso di lama. Altrimenti ho già scritto prima
if not WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, EMT.L2), S=Speed})
end
EmitMoveDataHead( 1, { Z=MyMaxZ1, B=0, S=Speed})
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
@@ -858,12 +962,21 @@ function OnRapid()
end
-- altrimenti sega a catena
else
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
EmitMoveDataHead( 1, { X=-ParkCSawX1, Z=dSafeZ1, B=HomeB1, C=HomeC1, TRad=dTRad, TLen=dTLen, S=Speed})
end
-- Porto la Z alla giusta quota
if EMT.L3 > HomeZ1 + 1 and abs( EMT.R2) > 89.9 then
EmitMoveDataHead( 1, { X=EMT.L2, S=Speed})
EmitMoveDataHead( 1, { Z=HomeZ1, S=Speed})
end
EmitMoveDataHead( 1, { Z=HomeZ1, B=EMT.R2, S=Speed})
EmitMoveDataHead( 1, { Z=EMT.L3, B=EMT.R2, S=Speed})
-- se motosega molto lunga, ruoto prima di muovermi in X
if EMT.TTOTLEN >= MinLengthLongCSaw then
EmitMoveDataHead( 1, { C=EMT.R1, S=Speed})
end
end
end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
@@ -874,11 +987,17 @@ function OnRapid()
local dB2 = EMT.R2
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
EmitMoveDataHead( 2, { X=SafeX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=SafeX2, Z=MinZ2, B=ParkB2, C=ParkC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
EmitMoveDataHead( 2, { X=SafeX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
EmitMoveDataHead( 2, { B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN + EMT.HB)
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN + EgtIf( BD.RIGHT_LOAD, -EMT.HB, EMT.HB))
local dZ2 = EgtClamp( -Head2Z + MillOffs + Mill2Offs + EMT.L3, MinZ2, MaxZ2)
EmitMoveDataHead( 2, { X=dX2, Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
@@ -893,7 +1012,12 @@ function OnRapid()
local dB2 = EMT.R2
if EMT.ZMAX then
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=SafeX2, Z=-dSafeZ2, B=ParkB2, C=ParkC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
else
EmitMoveDataHead( 2, { Z=-dSafeZ2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { X=dX2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
end
EmitMoveDataHead( 2, { X=dX2, Z=-dZ2, B=dB2, C=dC2, TPos=EMT.DOU_TPOS, S=EMT.DOU_SPEED})
@@ -907,10 +1031,18 @@ function OnRapid()
-- aspetto esecuzione movimento testa 1
EmitMoveWaitHead( 1)
-- altrimenti testa 2
else
elseif nHSet == 2 then
local MyMinZ2 = EgtGetAxisMin( 'Z2')
local CurrZ2 = EMT.L3pp or MyMinZ2
local CurrB2 = PrevR2
local CurrC2 = PrevR1
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
local Speed = EMT.S
if EMT.ZMAX then
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 2, { X=SafeX2, Z=CurrZ2, B=CurrB2, C=CurrC2, S=Speed})
end
EmitMoveDataHead( 2, { Z=-dSafeZ2, S=Speed})
EmitMoveDataHead( 2, { X=EMT.L2, S=Speed})
end
@@ -920,6 +1052,33 @@ function OnRapid()
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
-- aspetto esecuzione movimento testa 2
EmitMoveWaitHead( 2)
-- altrimenti testa 3
else
-- selezione testa (posso muovere X solo a Zmax)
local MyMaxZ3 = EgtGetAxisMax( 'Z3')
local dSafeZ3 = EgtGetAxisHomePos( 'Z3')
local HomeC3 = EgtGetAxisHomePos( 'C3')
local HomeB3 = EgtGetAxisHomePos( 'B3')
local Speed = EMT.S
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local CurrB3 = PrevR2
local CurrC3 = PrevR1
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, B=CurrB3, C=CurrC3, S=Speed})
else
EmitMoveDataHead( 3, { X=EMT.L2, Z=MyMaxZ3, S=Speed})
end
EmitMoveDataHead( 3, { Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
else
EmitMoveDataHead( 3, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
end
EmitMoveStartHead( 3)
-- eventuale preselezione successiva testa 2
PreselectNextDiffHead( EMT.MCHID, EMT.HEAD)
-- aspetto esecuzione movimento testa 3
EmitMoveWaitHead( 3)
end
-- dati aggancio a trave
local BhData = { T=EMT.L1}
@@ -975,7 +1134,7 @@ function OnRapid()
if EMT.HEAD == 'H12' or EMT.HEAD == 'H16' then Speed = 1.65 * EMT.S end
EmitMoveDataHead( 1, { X=EMT.L2, Z=EMT.L3, B=EMT.R2, C=EMT.R1, S=Speed})
EmitMoveStartHead( 1)
local dX2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY - EMT.L2 + EMT.TLEN + 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 dC2 = EMT.R1
local dB2 = EMT.R2
@@ -1016,10 +1175,9 @@ function OnRapid()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
MyOutput( 'M105 P1='..GetFaceCode()..' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..GetHeadSetCode()..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M98')
sOut = 'M6 ' .. EgtIf( EMT.HEAD ~= 'H21', 'T101', 'T202') .. AdjustTcPos( true)
MyOutput( sOut)
MyOutput( 'M6 ' .. GetHeadToolCode() .. AdjustTcPos( true))
MyOutput( 'G24' .. EMT.IPLGLSTR)
-- forzo successiva emissione assi rotanti
EMT.R1p = nil
@@ -1032,7 +1190,12 @@ function OnRapid()
local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
if #sAxes > 0 then
MyOutput( 'G0' .. sAxes)
if EmitRapidInG1 then
local sFeed = ' F30000'
MyOutput( 'G1' .. sAxes .. sFeed)
else
MyOutput( 'G0' .. sAxes)
end
end
-- se altrimenti risalita a Z max a fine lavorazione
elseif EMT.FLAG == 3 then
@@ -1042,7 +1205,10 @@ function OnRapid()
EmtAdjustRotaryAxes()
-- se Split lascio agganciata solo la pinza Y2 alla fine dei movimenti
local bSplitCut = ( EMT.MCHUSERNOTES:find( 'Split', 1, true) ~= nil)
EmitZmax( true, true, EMT.R1p, EMT.R2p, bSplitCut)
-- se lavorazione successiva sopra con testa diversa, porto in home la testa corrente
local nNextTopHSet = GetNextTopHSet( EMT.MCHID)
local bTopGoHome = ( nHSet ~= 2 and nNextTopHSet ~= 0 and nHSet ~= nNextTopHSet)
EmitZmax( true, true, EMT.R1p, EMT.R2p, bSplitCut, bTopGoHome)
-- aggiorno quota finale trave dopo Zmax
EMT.L1o = EMT.TPOS
EMT.ZMAX = true
@@ -1051,7 +1217,7 @@ function OnRapid()
-- non previsto
-- altrimenti errore
else
error( "Unknown Rapid flag")
EmtSetLastError( 1212, "Unknown Rapid flag")
end
-- aggiorno valori come precedenti
EMT.TPOS = EMT.L1o
@@ -1080,24 +1246,22 @@ function OnLinear()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..EgtIf( EMT.HEAD ~= 'H21', '1', '2')..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M105 P1=' .. GetFaceCode() .. ' P2='..GetHeadSetCode()..' P3='..EgtIf( EMT.DOU_TYPE, 2, 0))
MyOutput( 'M98')
local sPos = EMT.TCPOS:gsub( 'T', '')
if #sPos == 1 then
sPos = '00' .. sPos
elseif #sPos == 2 then
sPos = '0' .. sPos
elseif sPos == '101' and abs( EMT.R3 - 90) < 0.1 then
sPos = '104'
end
local sOut = 'M6 ' .. EgtIf( EMT.HEAD ~= 'H21', 'T101', 'T202') .. sPos
MyOutput( sOut)
MyOutput( 'M6 ' .. GetHeadToolCode() .. AdjustTcPos( true))
MyOutput( 'G24' .. EMT.IPLGLSTR)
-- emissione movimento
EMT.R1p = nil
EMT.R2p = nil
sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3')..
EmtGetAxis('R2')..EmtGetAxis('R1')
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
EMT.MOVE = 0
@@ -1214,17 +1378,15 @@ end
---------------------------------------------------------------------
function CalcForzaPinze( dH, dS, dL, dT)
local MinForza = 400 -- [Kgf]
local MaxForza = 1000 -- [Kgf]
local MassaRef = 1500 -- [Kg]
local dMinJoin = BD.GetMinJoin( dS, dH, dT)
if dMinJoin < 0.9 * BD.MIN_JOIN_L then
return MinForza
return MinForzaPinze
else
local KgMtCubo= 550 -- densità legno [Kg / metro cubo]
local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg]
local Forza = Massa / MassaRef * MaxForza
return EgtClamp( Forza, MinForza, MaxForza)
local Forza = Massa / MassaRef * MaxForzaPinze
return EgtClamp( Forza, MinForzaPinze, MaxForzaPinze)
end
end
@@ -1469,7 +1631,10 @@ function PrepareMoveChar( sCmd, nInd)
elseif Cmd[1] == '11' then
EMT.ISY1 = CalcCharStatusN( Cmd[2])
EMT.FSY1 = EMT.ISY1
EMT.BV = EgtIf( Cmd[2] ~= '0', 1, 2)
-- se pinza due in presa, non attivo la 1
if EMT.BV ~= 2 then
EMT.BV = EgtIf( Cmd[2] ~= '0', 1, 2)
end
if #EMT.MDCHAR > 0 then EMT.MDCHAR[#EMT.MDCHAR].FinStatY1 = EMT.FSY1 end
elseif Cmd[1] == '12' then
EMT.ISY2 = CalcCharStatusN( Cmd[2])
@@ -1784,7 +1949,7 @@ end
function GetV1ToCloseTPA()
local dMaxHeadPos = EMT.MAXMAX[1] + ( EMT.HOVM or 0) - ( EMT.X_OFF or 0)
local dMinTailPos = EMT.MAXMIN[1] + EMT.LB + EgtIf( IsStartOrMidPhase( EMT.PHASE), 0, ( EMT.HOVM or 0)) - ( EMT.X_OFF or 0)
--MyOutput( string.format( 'V1 MaxHeadPos=%.3f MinTailPos=%.3f BarLen=%.3f HeadOvm=%.3f', dMaxHeadPos, dMinTailPos, EMT.LB, ( EMT.HOVM or 0)))
--MyOutput( string.format( 'V1 MaxHeadPos=%.3f MinTailPos=%.3f BarLen=%.3f HeadOvm=%.3f V1NextPos=%.3f', dMaxHeadPos, dMinTailPos, EMT.LB, ( EMT.HOVM or 0), EMT.V1NEXTPOS))
return ( dMaxHeadPos <= EMT.V1NEXTPOS + RollCageMin and dMinTailPos >= EMT.V1NEXTPOS + RollCageMax)
end
@@ -1801,29 +1966,42 @@ function MyAdjustLinearAxes()
local MyL1o = EMT.L1
local MyL2o = EMT.L2
local MyL3o = EMT.L3
local nHSet = GetHeadSet( EMT.HEAD)
if EMT.REFLOC then
local vtE
if EMT.HEAD ~= 'H13' then
local dAddLen = 0
if EMT.HEAD == 'H12' then
dAddLen = -SawOffsZ
elseif EMT.HEAD == 'H16' then
dAddLen = -Saw2OffsZ
end
if EMT.HEAD ~= 'H21' then
-- se testa 1
if nHSet == 1 then
if EMT.HEAD == 'H13' then
local Len = ( EMT.TDIST or ChSawLen) + MillOffs
local LenRef = MillOffs
vtE = Vector3d( EMT.ADIR) * Len - Z_AX() * LenRef
else
local dAddLen = 0
if EMT.HEAD == 'H12' then
dAddLen = -SawOffsZ
elseif EMT.HEAD == 'H16' then
dAddLen = -Saw2OffsZ
end
local Len = EMT.TLEN + dAddLen + MillOffs
local LenRef = MillOffs
vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef
else
local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs
vtE = Vector3d( EMT.TDIR) * Len + Z_AX() * LenRef
end
-- se testa 2
elseif nHSet == 2 then
local dAddLen = 0
if EMT.HEAD == 'H22' then
dAddLen = -Saw2OffsZ
end
local Len = EMT.TLEN + dAddLen + Mill2Offs
local LenRef = Mill2Offs
vtE = Vector3d( EMT.TDIR) * Len + Z_AX() * LenRef
-- se testa 3
else
local Len = ( EMT.TDIST or ChSawLen) + MillOffs
local LenRef = MillOffs
vtE = Vector3d( EMT.ADIR) * Len - Z_AX() * LenRef
local Len = EMT.TLEN + Mill3Offs
local LenRef = Mill3Offs
vtE = Vector3d( EMT.TDIR) * Len - Z_AX() * LenRef
end
EMT.L1 = EMT.L1 - vtE:getX()
EMT.L2 = EMT.L2 - vtE:getY()
EMT.L3 = EMT.L3 - vtE:getZ()
@@ -1838,7 +2016,7 @@ function MyAdjustLinearAxes()
EMT.L3o = MyL3o
if not EMT.REFLOC then
if EMT.HEAD ~= 'H21' then
if EMT.HEAD ~= 'H21' and EMT.HEAD ~= 'H22' then
EMT.L2 = -EMT.L2
else
EMT.L3 = -EMT.L3
@@ -1913,7 +2091,16 @@ function CalcInterpPlane()
-- origine del piano
local xS = EMT.START[1] + LoadT
if EMT.X_OFF then xS = xS + EMT.X_OFF end
local ptS = Point3d( xS, 0, 0) + EgtIf( EMT.HEAD ~= 'H21', Vector3d( 0, DeltaTabY, DeltaTabZ), Vector3d( 0, Delta2TabY, Delta2TabZ))
local ptS = Point3d( xS, 0, 0)
local nHSet = GetHeadSet( EMT.HEAD)
if nHSet == 1 then
ptS = ptS + Vector3d( 0, DeltaTabY, DeltaTabZ)
elseif nHSet == 2 then
ptS = ptS + Vector3d( 0, Delta2TabY, Delta2TabZ)
else
ptS = ptS + Vector3d( 0, Delta3TabY, Delta3TabZ)
end
-- calcolo per piano generico
local vtE
if EMT.HEAD ~= 'H13' then
@@ -1956,12 +2143,41 @@ function GetFaceCode()
end
---------------------------------------------------------------------
function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
function GetHeadSetCode()
local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead == 1 then
return '1'
elseif nSetHead == 2 then
return '2'
elseif nSetHead == 3 then
return '3'
else
EmtSetLastError( 1211, 'Error Unknown Head Set')
end
end
---------------------------------------------------------------------
function GetHeadToolCode()
local nSetHead = GetHeadSet( EMT.HEAD)
if nSetHead == 1 then
return 'T101'
elseif nSetHead == 2 then
return 'T202'
elseif nSetHead == 3 then
return 'T303'
else
EmtSetLastError( 1211, 'Error Unknown Head Set')
end
end
---------------------------------------------------------------------
function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut, bTopGoHome)
if bReset then
EmitResetMachining()
end
local nSetHead = GetHeadSet( EMT.HEAD)
-- se testa 1
if EMT.HEAD ~= 'H21' and EMT.HEAD ~= 'H22' then
if nSetHead == 1 then
-- posizioni sicure
local dMaxZ1 = EgtGetAxisMax( 'Z1')
local dHomeX1 = EgtGetAxisHomePos( 'X1')
@@ -1985,13 +2201,16 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
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})
end
if EMT.L2o > DeltaTabY then
if EgtIf( BD.RIGHT_LOAD, ( EMT.L2 > -DeltaTabY), ( EMT.L2 < -DeltaTabY)) then
EmitMoveDataHead( 1, { X=-DeltaTabY, Fmt=1})
end
EmitMoveDataHead( 1, { C=dHomeC1, Fmt=1})
EmitMoveDataHead( 1, { B=dHomeB1, Fmt=1})
end
EmitMoveDataHead( 1, { Z=dMaxZ1, Fmt=1})
if bTopGoHome then
EmitMoveDataHead( 1, { X=-ParkX1, Fmt=1})
end
EmitMoveStartHead( 1)
-- se lavorazione in doppio
if EMT.DOU_TYPE == 2 or EMT.DOU_TYPE == 3 then
@@ -2001,30 +2220,49 @@ function EmitZmax( bReset, bEnd, PrevR1, PrevR2, bSplitCut)
EmitMoveWaitHead( 1)
-- altrimenti sega a catena
else
-- salzo in Z sicurezza raddrizzando la B
EmitMoveDataHead( 1, { Z=ParkCSawZ1, B=dHomeB1, Fmt=1})
-- salgo in Z sicurezza raddrizzando la B
local dSafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
EmitMoveDataHead( 1, { Z=dSafeZ1, B=dHomeB1, 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)
EmitMoveWaitHead( 1)
end
-- altrimenti testa 2
else
-- se altrimenti testa 2
elseif nSetHead == 2 then
-- posizioni sicure
local dSafeX2 = EgtGetAxisHomePos( 'X2')
local dSafeZ2 = EgtGetAxisHomePos( 'Z2')
local dSafeB2 = EgtGetAxisHomePos( 'B2')
local dSafeC2 = EgtGetAxisHomePos( 'C2')
local dHomeX2 = EgtGetAxisHomePos( 'X2')
local dHomeZ2 = EgtGetAxisHomePos( 'Z2')
local dHomeB2 = EgtGetAxisHomePos( 'B2')
local dHomeC2 = EgtGetAxisHomePos( 'C2')
-- se necessario allargo le cabine
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, dSafeC2, dSafeB2) then
if RollerParkingNeeded( EMT.HEAD, PrevR1, PrevR2, dHomeC2, dHomeB2) then
local dPosT = EgtIf( bEnd, EMT.L1o, EMT.TPOS or EMT.L1op)
EmitParkRoller( dPosT, bSplitCut)
end
-- eseguo la discesa a Z2max
EmitMoveDataHead( 2, { Z=-dSafeZ2, Fmt=1})
EmitMoveDataHead( 2, { B=dSafeB2, C=dSafeC2, Fmt=1})
EmitMoveDataHead( 2, { X=dSafeX2, Fmt=1})
EmitMoveDataHead( 2, { Z=-dHomeZ2, Fmt=1})
EmitMoveDataHead( 2, { B=dHomeB2, C=dHomeC2, Fmt=1})
EmitMoveDataHead( 2, { X=dHomeX2, Fmt=1})
EmitMoveStartHead( 2)
EmitMoveWaitHead( 2)
-- altrimenti testa 3
else
-- posizioni sicure
local dMaxZ3 = EgtGetAxisMax( 'Z3')
local dHomeX3 = EgtGetAxisHomePos( 'X3')
local dHomeB3 = EgtGetAxisHomePos( 'B3')
-- eseguo la salita a Z3max
EmitMoveDataHead( 3, { Z=dMaxZ3, Fmt=1})
if bTopGoHome then
EmitMoveDataHead( 3, { X=-dHomeX3, B=dHomeB3, Fmt=1})
end
EmitMoveStartHead( 3)
EmitMoveWaitHead( 3)
end
end
@@ -2052,6 +2290,10 @@ end
---------------------------------------------------------------------
function EmitResetMachining()
MyOutput( 'G27')
if EMT.PREFALLCUT then
MyOutput( 'M29')
EMT.PREFALLCUT = nil
end
local sP12 = ''
if EMT.TOOL ~= GetNextTool( EMT.MCHID) then sP12 = EgtIf( EMT.HEAD ~= 'H21', ' P1=0'..EgtIf( EMT.DOU_TYPE, ' P2=0', ''), ' P2=0') end
local sP4 = EgtIf( EMT.MCHUSERNOTES:find( 'Split', 1, true), ' P4=1', '')
@@ -2168,32 +2410,105 @@ end
---------------------------------------------------------------------
function PreselectNextDiffHead( nMchId, sHead)
-- se in uso testa 1, verifico di non scendere troppo in Z per evitare collisioni
local nHSet = GetHeadSet( sHead)
if nHSet == 1 then
if EMT.MAXMIN[3] < MinZ1ToChangeH2 then return end
end
-- recupero lavorazione successiva
-- recupero lavorazione successiva, se non esiste esco subito
local nNextMchId = EgtGetNextActiveOperation( nMchId)
while nNextMchId do
if EgtGetOperationType( nNextMchId) ~= MCH_OY.DISP then break end
nNextMchId = EgtGetNextActiveOperation( nNextMchId)
end
if not nNextMchId then return end
-- se esiste ed appartiene a gruppo diverso
-- se esiste lavorazione successiva
if EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
local nHSet = GetHeadSet( sHead)
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
-- se utensile su altra testa
if nNextHSet ~= nHSet then
local sNextTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
local dNextTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
-- se sto lavorando con testa 1
if nHSet == 1 then
-- se preselezione testa 2
if nNextHSet == 2 then
-- se agregato lama speciale non preseleziono mai
if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then return end
-- se la Z di lavoro è più bassa del cambio della minima Z
if EMT.MAXMIN[3] < MinZ1ToChangeH2 then
-- verifico quota del TC
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + 400) then return end
end
-- se preselezione testa 3
else
; -- non devo fare nulla
end
-- se sto lavorando con testa 2
elseif nHSet == 2 then
-- se preselezione testa 1
if nNextHSet == 1 then
-- se sopra Z oltre la faccia sotto della trave, controllo il cambio utensile
if EMT.MAXMIN[3] > Delta2TabZ then
local nNextTc = GetTcForTopHeadTool( sNextTcPos) -- utensile da caricare
local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1) -- utensile da depositare
-- se deposito e carico da diversi TC non faccio preselezione
if nNextTc ~= nPrevTc and nPrevTc ~= 0 then return
-- altrimenti se operazione su stesso TC
else
-- TC su montante destro oppure non so cosa c'è montato
if nNextTc == 1 or nPrevTc ~= 0 then
if BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - 400) then return end
if not BD.RIGHT_LOAD and EMT.MAXMIN[2] < ( Delta2TabY - MaxHoOpen - 400) then return end
end
-- TC su montante sinistro oppure non so cosa c'è montato
if nNextTc == 2 or nPrevTc ~= 0 then
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + MaxHoOpen + 400) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( Delta2TabY + 400) then return end
end
end
end
-- se preselezione testa 3
else
; -- non devo fare nulla
end
-- altrimenti (testa 3)
else
-- se preselezione testa 1
if nNextHSet == 1 then
-- TC su montante destro
if nPrevTc == 1 then return
-- TC su montante sinistro
else
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end
end
-- se preselezione testa 2
else
-- se agregato lama speciale non preseleziono mai
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)
if EMT.MAXMIN[3] < MinZ1ToChangeH2 then
if BD.RIGHT_LOAD and EMT.MAXMAX[2] > ( DeltaTabY + MaxHoOpen + 400) then return end
if not BD.RIGHT_LOAD and EMT.MAXMAX[2] > DeltaTabY then return end
end
end
end
-- faccio preselezione ( se sono arrivato qui, vuol dire che posso preselezionare)
if nNextHSet == 1 then
-- Recupero quota X1 (nostro L2)
local dNextX = GetStartMachiningXaxis( nNextMchId)
-- Emetto preselezione
if sNextHead == 'H11' then
EmitMoveDataHead( 1, { X=dNextX, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
if dNextTotLen < LongTool then
EmitMoveDataHead( 1, { X=dNextX, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
else
local nNextTc = GetTcForTopHeadTool( sNextTcPos)
EmitMoveDataHead( 1, { X=dNextX, B=ParkLongB1, C=EgtIf( nPrevTc ~= 2, ParkLongTc1C1, ParkLongTc2C1), TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
end
EmitMoveStartHead( 1)
elseif sNextHead == 'H12' or sNextHead == 'H16' then
EmitMoveDataHead( 1, { X=dNextX, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
@@ -2201,19 +2516,13 @@ function PreselectNextDiffHead( nMchId, sHead)
elseif sNextHead == 'H13' then
-- recupero il valore dell'asse virtuale bloccato A
local dPosA = GetCurrChainSawingVirtualAxis()
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA)
local bXSpec = ( dNextX < -DeltaTabY)
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA, EMT.TTOTLEN)
local bXSpec = EgtIf( BD.RIGHT_LOAD, ( dNextX > -DeltaTabY), ( dNextX < -DeltaTabY))
EmitMoveDataHead( 1, { X=EgtIf( bXSpec, -DeltaTabY, dNextX), B=ParkCSawB1, C=MyParkCSawC1, TPos=AdjustTcPos( false, sNextTcPos, dPosA), Fmt=2})
EmitMoveStartHead( 1)
end
else
-- non si può preselezionare lama su aggregato da sotto
-- Se è già montata, non preseleziono altro utensile fino all'effettiva lavorazione altro utensile
if sNextHead == 'H22' or EMT.PREVHEAD_H2 == 'H22' then
return
else
EmitMoveDataHead( 2, { B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
end
EmitMoveDataHead( 2, { B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, sNextTcPos), Fmt=2})
EmitMoveStartHead( 2)
end
end
@@ -2224,6 +2533,33 @@ function PreselectNextDiffHead( nMchId, sHead)
EgtTdbSetCurrTool( EMT.TOOL)
end
---------------------------------------------------------------------
function GetNextTopHSet( nMchId)
local nNextTopHSet = 0
-- recupero lavorazione successiva
local nNextMchId = EgtGetNextActiveOperation( nMchId)
while nNextMchId do
if EgtGetOperationType( nNextMchId) ~= MCH_OY.DISP then
if EgtSetCurrMachining( nNextMchId) then
local sNextTool = EgtGetMachiningParam( MCH_MP.TOOL)
if EgtTdbSetCurrTool( sNextTool) then
local sNextHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nNextHSet = GetHeadSet( sNextHead)
if nNextHSet ~= 2 then
nNextTopHSet = nNextHSet
break
end
end
end
end
nNextMchId = EgtGetNextActiveOperation( nNextMchId)
end
-- ripristino stato corrente
EgtSetCurrMachining( EMT.MCHID)
EgtTdbSetCurrTool( EMT.TOOL)
return nNextTopHSet
end
---------------------------------------------------------------------
function GetFmaxClamp()
return EmtLenToString( EMT.FMAXPINZE / 1000, 0)
@@ -2263,7 +2599,13 @@ end
---------------------------------------------------------------------
function EmitMoveDataHead( nHead, MoData)
local sOut = EgtIf( nHead == 1, 'M101', 'M102') .. ' P1=1'
local sOut = 'M101'
if nHead == 2 then
sOut = 'M102'
elseif nHead == 3 then
sOut = 'M103'
end
sOut = sOut .. ' P1=1'
if MoData.X then sOut = sOut .. ' P2=' .. EmtLenToString( MoData.X, 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
@@ -2281,13 +2623,25 @@ end
---------------------------------------------------------------------
function EmitMoveStartHead( nHead)
local sOut = EgtIf( nHead == 1, 'M101', 'M102') .. ' P1=2'
local sOut = 'M101'
if nHead == 2 then
sOut = 'M102'
elseif nHead == 3 then
sOut = 'M103'
end
sOut = sOut .. ' P1=2'
MyOutput( sOut)
end
---------------------------------------------------------------------
function EmitMoveWaitHead( nHead)
local sOut = EgtIf( nHead == 1, 'M101', 'M102') .. ' P1=3'
local sOut = 'M101'
if nHead == 2 then
sOut = 'M102'
elseif nHead == 3 then
sOut = 'M103'
end
sOut = sOut .. ' P1=3'
MyOutput( sOut)
end
+239 -129
View File
@@ -1,18 +1,22 @@
-- Processore macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Processore standard macchine tipo PF1250 by EgalWare s.r.l. 2024/01/22
-- Funzioni generiche indipendenti dal controllo
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
-- Carico libreria
local BD = require( 'BeamData')
---------------------------------------------------------------------
-- *** GENERATION ***
---------------------------------------------------------------------
local sBaseDir = EgtGetSourceDir()
local sBaseDir = EgtGetCurrMachineDir()
if NumericalControl == 'NUM' then
error( 'Numerical Control error : NUM not yet managed')
elseif NumericalControl == 'TPA' then
dofile( sBaseDir .. 'Essetre-PF1250.TPA.mlpe')
dofile( sBaseDir .. '\\Common-PF1250.TPA.mlpe')
else
error( 'Numerical Control error : unkwnown type')
end
@@ -20,7 +24,46 @@ end
---------------------------------------------------------------------
-- *** SIMULATION ***
---------------------------------------------------------------------
local COLL_SAFE_DIST = 4
local COLL_SAFE_DIST = 3
---------------------------------------------------------------------
function OnSimulInit()
-- se macchina con carico destro, imposto offset direzioni di vista standard
if BD.RIGHT_LOAD then
local nOrigViewOffs = EgtGetViewOrizzOffsStep()
local dOrigViewAngV, dOrigViewAngH = EgtGetGenericView()
if nOrigViewOffs ~= 2 then
EgtSetViewOrizzOffsStep( 2)
if dOrigViewAngV < 0.1 then
EgtSetView( SCE_VD.TOP, false)
elseif dOrigViewAngV > 179.9 then
EgtSetView( SCE_VD.BOTTOM, false)
else
local dViewAngH = dOrigViewAngH + EgtIf( dOrigViewAngH > 180, 2 * 90, 0)
EgtSetGenericView( dOrigViewAngV, dViewAngH, false)
end
end
end
end
---------------------------------------------------------------------
function OnSimulExit()
-- se macchina con carico destro, annullo offset direzioni di vista standard
if BD.RIGHT_LOAD then
local nOrigViewOffs = EgtGetViewOrizzOffsStep()
local dOrigViewAngV, dOrigViewAngH = EgtGetGenericView()
if nOrigViewOffs == 2 then
EgtSetViewOrizzOffsStep( 0)
if dOrigViewAngV < 0.1 then
EgtSetView( SCE_VD.TOP, false)
elseif dOrigViewAngV > 179.9 then
EgtSetView( SCE_VD.BOTTOM, false)
else
EgtSetGenericView( dOrigViewAngV, dOrigViewAngH - 2 * 90, false)
end
end
end
end
---------------------------------------------------------------------
function OnSimulStart()
@@ -63,6 +106,11 @@ function OnSimulStart()
AddToCollisionCheck( 'X2', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'C2', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'B2', 'COLLISION', EMT.COLLOBJ)
if EgtGetHeadId('H31') then
AddToCollisionCheck( 'Z3', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'C3', 'COLLISION', EMT.COLLOBJ)
AddToCollisionCheck( 'B3', 'COLLISION', EMT.COLLOBJ)
end
DumpCollisionCheck( EMT.COLLOBJ, 'Collision Objects :', 4)
-- Preparo lista solidi macchina con cui possono collidere gli oggetti sopra riportati (in aggiunta a VMill)
EMT.MCODET = {}
@@ -72,12 +120,20 @@ function OnSimulStart()
{ Grp = 'Base', Sub = 'COLLISION', Name = 'COL1'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'COL2'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW2'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'SPTOOLS'},
{ Grp = 'Base', Sub = 'COLLISION', Name = 'AGGREBLADEUNDER'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'COL1'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'CHAIN'},
{ Grp = 'Z2', Sub = 'COLLISION', Name = 'COL2'}}
if EgtGetHeadId('H31') then
table.insert( McdData, { Grp = 'X1', Sub = 'COLLISION', Name = 'STM'})
table.insert( McdData, { Grp = 'X3', Sub = 'COLLISION', Name = 'STM'})
end
-- inserisco gruppi opzionali
if SecondChain then table.insert( McdData, { Grp = 'Base', Sub = 'COLLISION', Name = 'CHSAW2'}) end
if TcSpecialTools then table.insert( McdData, {Grp = 'Base', Sub = 'COLLISION', Name = 'SPTOOLS'}) end
if TcAggreBladeUnder then table.insert( McdData, {Grp = 'Base', Sub = 'COLLISION', Name = 'AGGREBLADEUNDER'}) end
EgtOutLog( 'MCODET Objects :', 4)
local nMcdNullCnt = 0
for i = 1, #McdData do
@@ -250,8 +306,8 @@ function OnSimulDispositionStart()
EMT.SCRAP = nil
end
EMT.LB = b3Bar:getDimX()
EMT.LT = b3Raw:getDimX()
EMT.LP = b3Part:getDimX()
EMT.LR = b3Raw:getDimX()
EMT.LT = b3Part:getDimX()
EMT.CUTID = EgtGetInfo( EgtGetFirstPartInRawPart( nPartRawId or GDB_ID.NULL) or GDB_ID.NULL, 'CUTID', 'i') or 0
EMT.Y1SPEC = nil
-- se vero inizio, assegno solidi per verifica collisione
@@ -391,10 +447,19 @@ function OnSimulToolSelect( dPosA)
EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN)
EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES)
-- recupero il gruppo
local nSetHead = GetHeadSet( EMT.NEXTHEAD)
-- se fresa o lama su testa 1, reset assi rotanti
if EMT.HEAD == 'H11' or EMT.HEAD == 'H14' or EMT.HEAD == 'H12' or EMT.HEAD == 'H13' or EMT.HEAD == 'H16' then
if nSetHead == 1 then
-- se ho la testa 3, la mando a parcheggio
if EgtGetHeadId( 'H31') then
EgtSetAxisPos( 'X3', ParkX3)
end
EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1')
-- se testa 3 parcheggio la 1
elseif nSetHead == 3 then
EgtSetAxisPos( 'X1', ParkX1)
end
-- se sega a catena, imposto subito angolo scelto per asse virtuale A
if EMT.HEAD == 'H13' then
@@ -402,8 +467,8 @@ function OnSimulToolSelect( dPosA)
dPosA = dPosA or GetNextChainSawingVirtualAxis( EMT.MCHID)
-- imposto il valore di A
EgtSetAxisPos( 'A1', dPosA)
-- imposto home dell'asse C1 (A=0 -> T101, A=90 -> T104)
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA)
-- imposto home dell'asse C1 (A1=0 -> T101, A1=90 -> T104)
local MyParkCSawC1 = GetChainSawCHomeFromVirtualAxis( dPosA, EMT.TTOTLEN)
EmtModifyAxisHome( 'C1', MyParkCSawC1)
EgtSetAxisPos( 'C1', MyParkCSawC1)
-- Imposto visualizzazione
@@ -415,7 +480,7 @@ function OnSimulToolSelect( dPosA)
dPosA = dPosA or GetNextSawingVirtualAxis( EMT.MCHID)
-- imposto il valore di A
EgtSetAxisPos( 'A2', dPosA)
-- imposto home dell'asse C1 (A=0 -> T101, A=90 -> T104)
-- imposto home dell'asse C1 (A2=0 -> T101, A2=90 -> T104)
local MyParkSawC2 = GetSawCHomeFromVirtualAxis( dPosA)
EmtModifyAxisHome( 'C2', MyParkSawC2)
EgtSetAxisPos( 'C2', MyParkSawC2)
@@ -438,7 +503,7 @@ function OnSimulToolSelect( dPosA)
-- se attivo Collision Check
EMT.SAFEDIST = COLL_SAFE_DIST
if EMT.COLLOBJ then
local nInd = EgtIf( EMT.HEAD ~= 'H21' and EMT.HEAD ~= 'H22', 1001, 1011)
local nInd = EgtIf( nSetHead ~= 2, 1001, 1011)
AddToolToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd, true)
AddToolHolderToCollisionObj( EMT.TOOL, EMT.HEAD, EMT.EXIT, nInd + 1)
for i, Coll in ipairs( EMT.COLLOBJ or {}) do
@@ -456,7 +521,7 @@ function OnSimulToolDeselect( dPrevA)
-- recupero il gruppo
local nSetHead = GetHeadSet( EMT.NEXTHEAD)
-- per testa gruppo 2
if nSetHead == 2 then
if nSetHead == 2 and EMT.PREVTCPOS_H2 then
-- deposito lama su aggregato testa sotto
if EMT.PREVHEAD_H2 == 'H22' then
-- simulo movimento
@@ -464,8 +529,8 @@ function OnSimulToolDeselect( dPrevA)
if dPrevA then
ParkC2 = GetSawCHomeFromVirtualAxis( dPrevA)
end
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.RAPROT, 'C2', ParkC2, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
end
-- breve pausa
EgtPause( 100)
@@ -474,9 +539,9 @@ function OnSimulToolDeselect( dPrevA)
-- nascondo l'utensile sulla testa
EgtSetStatus( EgtGetHeadId( EMT.PREVHEAD_H2 or '') or GDB_ID.NULL, GDB_ST.OFF)
-- se testa gruppo 1
else
elseif nSetHead == 1 and EMT.PREVTCPOS_H1 then
-- deposito utensile fresa
if EMT.PREVHEAD_H1 == 'H11' or EMT.PREVHEAD_H1 == 'H14' then
if EMT.PREVHEAD_H1 == 'H11' then
-- simulo movimento
local nPrevTc = GetTcForTopHeadTool( EMT.PREVTCPOS_H1)
if EMT.PREVTTOTLEN_H1 < LongTool then
@@ -504,7 +569,7 @@ function OnSimulToolDeselect( dPrevA)
-- simulo movimento
local ParkC1 = EgtGetAxisHomePos( 'C1')
if dPrevA then
ParkC1 = GetChainSawCHomeFromVirtualAxis( dPrevA)
ParkC1 = GetChainSawCHomeFromVirtualAxis( dPrevA, EMT.TTOTLEN)
end
SimulMoveAxes( 'B1', ParkCSawB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X1', ParkCSawX1, MCH_SIM_STEP.RAPID)
@@ -521,14 +586,27 @@ function OnSimulToolDeselect( dPrevA)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
end
-- se passo da testa 1 a 3 o viceversa
if nNextSetHead == 3 then
-- deposito eventuale sega a catena
if EMT.PREVHEAD_H1 == 'H13' then
-- visualizzo utensile su TcPos
ShowToolInTcPos( EMT.PREVTCPOS_H1, true)
-- nascondo l'utensile sulla testa
EgtSetMode( EgtGetHeadId( EMT.PREVHEAD_H1 or '') or GDB_ID.NULL, GDB_MD.HIDDEN)
end
SimulMoveAxis( 'X1', ParkX1, MCH_SIM_STEP.RAPID)
elseif nNextSetHead == 1 then
SimulMoveAxis( 'X3', ParkX3, MCH_SIM_STEP.RAPID)
end
-- movimento per prendere nuovo utensile
-- prendo utensile fresa
if EMT.NEXTHEAD == 'H11' or EMT.NEXTHEAD == 'H14' then
if EMT.NEXTHEAD == 'H11' then
-- simulo movimento
SimulMoveAxes( 'B1', ParkB1, MCH_SIM_STEP.RAPROT, 'C1', ParkC1, MCH_SIM_STEP.RAPROT)
local dPosX = EgtIf( GetTcForTopHeadTool( EMT.NEXTTCPOS) ~= 2, ParkX1, ParkTc2X1)
SimulMoveAxis( 'X1', dPosX, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', 0, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
-- prendo utensile lama
elseif EMT.NEXTHEAD == 'H12' then
-- simulo movimento
@@ -549,12 +627,15 @@ function OnSimulToolDeselect( dPrevA)
-- simulo movimento
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.RAPROT, 'C2', ParkC2, MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
-- prendo utensile seconda lama
-- prendo utensile lama su aggregato
elseif EMT.NEXTHEAD == 'H22' then
-- aggiungo utensile per verifica collisione
AddToolToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, 1011, false)
AddToolHolderToCollisionObj( EMT.NEXTTOOL, EMT.NEXTHEAD, EMT.NEXTEXIT, 1011 + 1)
-- simulo movimento
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.RAPROT, 'C2', EgtGetAxisHomePos( 'C2'), MCH_SIM_STEP.RAPROT)
SimulMoveAxis( 'X2', ParkSawX2, MCH_SIM_STEP.RAPID)
end
SimulMoveAxes( 'B2', ParkSawB2, MCH_SIM_STEP.COLLROT, 'C2', ParkSawC2, MCH_SIM_STEP.COLLROT)
end
end
---------------------------------------------------------------------
@@ -574,7 +655,7 @@ function OnSimulMachiningStart()
if EMT.HEAD == 'H22' and EMT.HEAD == EMT.PREVHEAD_H2 then
local dPrevA = EgtGetAxisPos( 'A2')
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
local dPosA = tonumber( sVal:sub( 4))
local dPosA = tonumber( sVal:sub( 4)) or 0
if abs( dPosA - dPrevA) > 1 then
ExecParkRoller( nil, nil, nil, nil, false, bAgg)
OnSimulToolDeselect( dPrevA)
@@ -596,6 +677,12 @@ function OnSimulMachiningStart()
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
EMT.MCHNAME = EgtGetOperationName( EMT.MCHID)
@@ -690,13 +777,13 @@ end
---------------------------------------------------------------------
function OnSimulPathEnd()
-- rimozione sfridi
RemoveScraps()
ExecRemoveScraps()
-- se non ci sono comandi ausiliari associati e richiesta risalita a Zmax
if EMT.AUXTOT == 0 and EMT.TO_ZMAX then
if EMT.MCHSPLIT and not EMT.TO_FALL then
EMT.SPLIT_Y1DELTA = EMT.Y1DELTA
EMT.Y1DELTA = nil
SetPY1Light( false)
ExecMovePY1( false)
end
ExecMoveZmax( EMT.MCHSPLIT)
EMT.TO_ZMAX = nil
@@ -706,19 +793,19 @@ end
---------------------------------------------------------------------
function OnSimulPathStartAux()
-- eseguo il comando
ExecAuxCmd( EMT.AUX)
ExecAuxCmd( EMT.AUX, true)
-- se ultimo comando e lavorazione di split, sgancio il carro Y1
if EMT.AUXIND == EMT.AUXTOT and EMT.MCHSPLIT and not EMT.TO_FALL then
EMT.SPLIT_Y1DELTA = EMT.Y1DELTA
EMT.Y1DELTA = nil
SetPY1Light( false)
ExecMovePY1( false)
end
end
---------------------------------------------------------------------
function OnSimulPathEndAux()
-- eseguo il comando
ExecAuxCmd( EMT.AUX)
ExecAuxCmd( EMT.AUX, false)
-- se ultimo comando e richiesta risalita a Zmax
if EMT.AUXIND == EMT.AUXTOT and EMT.TO_ZMAX then
ExecMoveZmax( EMT.MCHSPLIT)
@@ -812,16 +899,20 @@ function OnSimulMoveStart()
if EMT.HEAD ~= 'H13' then
-- se movimento iniziale da Zmax con lama o fresa
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
local bXSpec = EgtIf( BD.RIGHT_LOAD, EMT.L2 < DeltaTabY, EMT.L2 > DeltaTabY)
-- 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
local bXSpec = ( EMT.L2 > DeltaTabY)
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'B1', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID, 'B1', 0, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X1', EMT.L2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
-- caso standard
else
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
SimulMoveAxis( 'X1', EgtIf( bXSpec, DeltaTabY, EMT.L2), MCH_SIM_STEP.RAPID)
end
SimulMoveAxis( 'Z1', EMT.L3, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
@@ -838,16 +929,29 @@ function OnSimulMoveStart()
-- se movimento iniziale da Zmax
if EMT.ZMAX or ( EMT.FLAG == 2 and EMT.FLAG2 == 1) then
SimulMoveAxes( 'Z1', Z1Home, MCH_SIM_STEP.RAPID, 'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
-- se motosega molto lunga, ruoto prima di muovermi in X
if EMT.TTOTLEN >= MinLengthLongCSaw then
SimulMoveAxis( 'C1', EMT.R1, MCH_SIM_STEP.COLLROT)
end
end
end
-- altrimenti testa 2
else
-- Porto la X alla giusta quota
local X2Pos = EgtGetAxisPos( 'X2')
-- se altrimenti testa 2
elseif nSetHead == 2 then
local B2Home = EgtGetAxisHomePos( 'B2')
local C2Home = EgtGetAxisHomePos( 'C2')
local Z2Home = EgtGetAxisHomePos( 'Z2')
local X2Home = EgtGetAxisHomePos( 'X2')
if X2Pos > X2Home - 1 then
if EMT.ZMAX then
-- se bisogna scrivere tutti gli assi
if WriteAllCoordsOnFirstM101 then
SimulMoveAxes( 'X2', SafeX2, MCH_SIM_STEP.RAPID, 'B2', B2Home, MCH_SIM_STEP.COLLROT, 'C2', C2Home, MCH_SIM_STEP.COLLROT)
end
SimulMoveAxis( 'Z2', Z2Home, MCH_SIM_STEP.RAPID)
SimulMoveAxis( 'X2', EMT.L2, MCH_SIM_STEP.RAPID)
end
-- altrimenti testa 3
else
; -- non devo fare alcunchè di speciale
end
end
-- se lavorazione split, muovo per riaggancio del carro Y1
@@ -872,7 +976,7 @@ function OnSimulMoveStart()
else
EMT.AuxAxes = 4 + 4
EMT.A5n = 'X2'
local X2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY + EMT.L2 + EMT.TLEN + EMT.HB)
local X2 = Delta2TabY + EMT.DOU_TLEN - ( -DeltaTabY + EMT.L2 + EMT.TLEN + EgtIf( BD.RIGHT_LOAD, -EMT.HB, EMT.HB))
if EMT.MCHTYPE == MCH_MY.DRILLING and EMT.FLAG == 101 then
EMT.DOU_DRILL_END = -( EMT.L2p - EMT.L2)
X2 = X2 + 2 * EMT.DOU_DRILL_END
@@ -928,17 +1032,28 @@ function OnSimulMoveStart()
end
end
-- se necessario ...
if EMT.MCHFIRST then
if EMT.MCHFIRST and EMT.EnabAxes ~= false then
if nSetHead == 1 then
SimulMoveAxes( 'X1', EMT.L2, MCH_SIM_STEP.RAPID,
'Z1', EMT.L3, MCH_SIM_STEP.RAPID,
'C1', EMT.R1, MCH_SIM_STEP.RAPROT,
'B1', EMT.R2, MCH_SIM_STEP.RAPROT)
else
'C1', EMT.R1, MCH_SIM_STEP.COLLROT,
'B1', EMT.R2, MCH_SIM_STEP.COLLROT)
if EMT.DOU_TYPE and EMT.AuxAxes == 8 then
SimulMoveAxes( 'X2', EMT.A5, MCH_SIM_STEP.RAPID,
'Z2', EMT.A6, MCH_SIM_STEP.RAPID,
'C2', EMT.A7, MCH_SIM_STEP.COLLROT,
'B2', EMT.A8, MCH_SIM_STEP.COLLROT)
end
elseif nSetHead == 2 then
SimulMoveAxes( 'X2', EMT.L2, MCH_SIM_STEP.RAPID,
'Z2', EMT.L3, MCH_SIM_STEP.RAPID,
'C2', EMT.R1, MCH_SIM_STEP.RAPROT,
'B2', EMT.R2, MCH_SIM_STEP.RAPROT)
'C2', EMT.R1, MCH_SIM_STEP.COLLROT,
'B2', EMT.R2, MCH_SIM_STEP.COLLROT)
else
SimulMoveAxes( 'X3', EMT.L2, MCH_SIM_STEP.RAPID,
'Z3', EMT.L3, MCH_SIM_STEP.RAPID,
'C3', EMT.R1, MCH_SIM_STEP.COLLROT,
'B3', EMT.R2, MCH_SIM_STEP.COLLROT)
end
end
if nRes ~= 0 then
@@ -950,12 +1065,16 @@ end
---------------------------------------------------------------------
function OnSimulMoveEnd()
-- rimozione eventuali sfridi
if EMT.FLAG == 301 then
ExecRemoveScraps()
end
-- se primo rapido della lavorazione
if EMT.MCHFIRST and EMT.MOVE == 0 then
-- se lavorazione split, dichiaro carro Y1 riagganciato
if EMT.SPLIT_Y1DELTA then
EMT.SPLIT_Y1DELTA = nil
SetPY1Light( true)
ExecMovePY1( true)
end
-- chiusura o apertura rulli V1
if GetV1ToClose() then
@@ -989,7 +1108,7 @@ function OnSimulMoveEnd()
-- se Zmax dopo fine lavorazione
if EMT.MOVE == 0 and EMT.FLAG == 3 then
-- eventuale rimozione sfridi
RemoveScraps()
ExecRemoveScraps()
-- eseguo
ExecMoveZmax( EMT.MCHSPLIT)
EMT.TO_ZMAX = nil
@@ -1001,13 +1120,9 @@ function OnSimulCollision()
-- se prima collisione della lavorazione, la segnalo
if EMT.MCHNAME ~= EMT.LAST_MCHNAME_COLLIDE then
local Class = ''
if EMT.SIMCOBIND == 1001 then
if EMT.SIMCOBIND == 1001 or EMT.SIMCOBIND == 1011 then
Class = 'T_'..EMT.HEAD
elseif EMT.SIMCOBIND == 1011 then
Class = 'T_'..EMT.HEAD
elseif EMT.SIMCOBIND == 1002 then
Class = 'TH_'..EMT.HEAD
elseif EMT.SIMCOBIND == 1012 then
elseif EMT.SIMCOBIND == 1002 or EMT.SIMCOBIND == 1012 then
Class = 'TH_'..EMT.HEAD
else
Class = EMT.COLLOBJ[EMT.SIMCOBIND].Cl
@@ -1022,7 +1137,7 @@ function OnSimulCollision()
end
---------------------------------------------------------------------
function ExecAuxCmd( sCmd)
function ExecAuxCmd( sCmd, bPathStart)
-- analizzo il comando
local Cmd = EgtSplitString( sCmd)
if Cmd[1] == '0' then
@@ -1035,29 +1150,31 @@ function ExecAuxCmd( sCmd)
end
EgtOutText( Cmd[2])
elseif Cmd[1] == '1' then
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
sV1, MoveV1, MCH_SIM_STEP.RAPID,
sV2, MoveV2, MCH_SIM_STEP.RAPID)
if not bOk then
if not bOk1 then
if VerifyY1Y2Stroke( Cmd[2], tonumber( Cmd[3])) == nil then
EgtOutLog( 'Error on ExecAuxCmd : ' .. sCmd)
if Cmd[2] ~= 'Z' then
ExecOpenRoller( 1)
ExecOpenRoller( 2)
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
sV1, MoveV1, MCH_SIM_STEP.RAPID,
sV2, MoveV2, MCH_SIM_STEP.RAPID)
if not bOk then
if not bOk1 then
if VerifyY1Y2Stroke( Cmd[2], tonumber( Cmd[3])) == nil then
EgtOutLog( 'Error on ExecAuxCmd : ' .. sCmd)
end
elseif not bOk2 then
VerifyV1V2Stroke( sV1, MoveV1)
elseif not bOk3 then
VerifyV1V2Stroke( sV2, MoveV2)
end
elseif not bOk2 then
VerifyV1V2Stroke( sV1, MoveV1)
elseif not bOk3 then
VerifyV1V2Stroke( sV2, MoveV2)
end
end
elseif Cmd[1] == '2' then
-- Verifico movimento carrello con trave agganciata
VerifyOneChariotSlide( Cmd[2], Cmd[3], Cmd[4], Cmd[5])
-- Eseguo i movimenti necessari
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
ExecOpenRoller( 1)
ExecOpenRoller( 2)
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3, bOk4 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
Cmd[4], tonumber( Cmd[5]), MCH_SIM_STEP.RAPID,
@@ -1079,8 +1196,8 @@ function ExecAuxCmd( sCmd)
-- Verifico movimento carrelli con trave agganciata
VerifyTwoChariotsSlide( Cmd[2], Cmd[3], Cmd[4], Cmd[5], Cmd[6], Cmd[7])
-- Eseguo i movimenti necessari
if EMT.SPLIT then ExecOpenRoller( 1) end
if EMT.UNLOADING or EMT.TO_FALL then ExecOpenRoller( 2) end
ExecOpenRoller( 1)
ExecOpenRoller( 2)
local sV1, MoveV1, sV2, MoveV2 = CalcMoveV1V2ForAuxCmd( Cmd)
local bOk, bOk1, bOk2, bOk3, bOk4, bOk5 = SimulMoveAxes( Cmd[2], tonumber( Cmd[3]), MCH_SIM_STEP.RAPID,
Cmd[4], tonumber( Cmd[5]), MCH_SIM_STEP.RAPID,
@@ -1100,13 +1217,13 @@ function ExecAuxCmd( sCmd)
end
end
elseif Cmd[1] == '4' then
ExecMoveHome( Cmd[2] == '1', EMT.MCHSPLIT)
ExecMoveHome( Cmd[2] == '1', EgtIf( bPathStart, false, EMT.MCHSPLIT))
elseif Cmd[1] == '11' then
SimulMoveAxes( 'PY1', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY1Light( Cmd[2] ~= '0')
local bClose = Cmd[2] ~= '0'
if bPathStart and EMT.MCHSPLIT and not EMT.FALL and GetPY2Light() then bClose = false end
ExecMovePY1( bClose)
elseif Cmd[1] == '12' then
SimulMoveAxes( 'PY2', EgtIf( Cmd[2] == '0', MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY2Light( Cmd[2] ~= '0')
ExecMovePY2( Cmd[2] ~= '0')
elseif Cmd[1] == '21' then
local nY1Delta = tonumber( Cmd[2])
local nY2Delta = tonumber( Cmd[3])
@@ -1158,7 +1275,7 @@ end
function ExecStartHome()
-- Testa 1
EgtResetAxisPos( 'X1')
EgtSetAxisPos( 'Z1', MaxZ1)
EgtResetAxisPos( 'Z1')
EgtResetAxisPos( 'C1')
EgtResetAxisPos( 'B1')
-- Testa 2
@@ -1172,6 +1289,7 @@ end
function ExecMoveHome( bNearV, bMchSplit)
-- risalita a Zmax
ExecMoveZmax( bMchSplit)
EMT.TO_ZMAX = nil
-- se testa sotto
if GetHeadSet( EMT.HEAD) == 2 then
if not SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID) then
@@ -1222,7 +1340,7 @@ function ExecMoveZmax( bMchSplit)
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)
end
if 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)
end
SimulMoveAxis( 'C1', HomeC, MCH_SIM_STEP.COLLROT)
@@ -1231,8 +1349,9 @@ function ExecMoveZmax( bMchSplit)
SimulMoveAxis( 'Z1', MaxZ1, MCH_SIM_STEP.RAPID)
-- altrimenti sega a catena
else
-- salzo in Z sicurezza raddrizzando la B
SimulMoveAxes( 'Z1', ParkCSawZ1, MCH_SIM_STEP.RAPID, 'B1', HomeB, MCH_SIM_STEP.COLLROT)
-- salgo in Z sicurezza raddrizzando la B
local SafeZ1 = EgtIf( EMT.TTOTLEN < MinLengthLongCSaw, ParkCSawZ1, ParkLongCSawZ1)
SimulMoveAxes( 'Z1', SafeZ1, MCH_SIM_STEP.RAPID, 'B1', HomeB, MCH_SIM_STEP.COLLROT)
SimulMoveAxes( 'X1', HomeX, MCH_SIM_STEP.RAPID, 'C1', HomeC, MCH_SIM_STEP.COLLROT)
end
-- se lavorazione in doppio
@@ -1248,11 +1367,15 @@ function ExecMoveZmax( bMchSplit)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
EMT.DOU_TO_ZMAX = nil
end
-- altrimenti testa sotto
else
-- se altrimenti testa sotto
elseif nSetHead == 2 then
SimulMoveAxis( 'Z2', ParkZ2, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B2', ParkB2, MCH_SIM_STEP.COLLROT, 'C2', ParkC2, MCH_SIM_STEP.COLLROT)
SimulMoveAxis( 'X2', ParkX2, MCH_SIM_STEP.RAPID)
-- altrimenti testa 3
else
SimulMoveAxes( 'Z3', MaxZ3, MCH_SIM_STEP.RAPID)
SimulMoveAxes( 'B3', ParkB3, MCH_SIM_STEP.COLLROT)
end
EMT.ZMAX = true
end
@@ -1266,14 +1389,14 @@ function ExecUnloading()
-- li sposto per lasciare spazio al nuovo pezzo
local nId = EgtGetFirstInGroup( nVmGrpId)
while nId do
EgtMove( nId, Vector3d( 0, -( EMT.HB + 50.0), 0), GDB_RT.GLOB)
EgtMove( nId, Vector3d( 0, EgtIf( BD.RIGHT_LOAD, ( EMT.HB + 50.0), -( EMT.HB + 50.0)), 0), GDB_RT.GLOB)
nId = EgtGetNext( nId)
end
-- creo un nuovo layer e vi inserisco il nuovo pezzo
local nLayId = EgtGroup( nVmGrpId, EgtGetGlobFrame( vMillId))
EgtRelocate( vMillId, nLayId)
local vtMove = Vector3d( 0, -1600, 0)
if EMT.FALL then vtMove = Vector3d( 0, -2600, -1150) end
local vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 1600, -1600), 0)
if EMT.FALL then vtMove = Vector3d( 0, EgtIf( BD.RIGHT_LOAD, 3200, -2600), -1150) end
EgtMove( nLayId, vtMove, GDB_RT.GLOB)
EgtSetLevel( vMillId, GDB_LV.USER)
-- aggiungo gli spigoli
@@ -1305,6 +1428,18 @@ function ExecUnloading()
end
end
---------------------------------------------------------------------
function ExecMovePY1( bClose)
SimulMoveAxes( 'PY1', EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY1Light( bClose)
end
---------------------------------------------------------------------
function ExecMovePY2( bClose)
SimulMoveAxes( 'PY2', EgtIf( not bClose, MaxHoOpen, EMT.HB), MCH_SIM_STEP.RAPID)
SetPY2Light( bClose)
end
---------------------------------------------------------------------
local function LinkRemainingPartsToY1()
local nCurrOrd = GetPhaseOrd( EMT.PHASE)
@@ -1334,6 +1469,9 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
-- Parcheggi pinze
local MyParkY1 = ParkY1 + EgtIf( bAgg, AggLoad, 0)
local MyParkY2 = ParkY2
-- Apro i rulli, se necessario
if abs( ParkV1 - PosV1) > 0.1 then ExecOpenRoller( 1) end
if abs( ParkV2 - PosV2) > 0.1 then ExecOpenRoller( 2) end
-- Eseguo spostamenti
if EMT.Y1DELTA and EMT.Y2DELTA then
local DiffY1 = MyParkY1 - PosY1
@@ -1387,7 +1525,7 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV1 = ParkV1 - PosV1
local DiffY1 = MyParkY1 - PosY1
local MoveY1 = EgtIf( DiffY1 > 0.1, MoveV1, 0)
local TryMoveY1 = ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LP, 0)
local TryMoveY1 = ParkV1 - PosT - EgtIf( bSpliCut or EMT.FALL, EMT.LT, 0)
if ( PosT > ParkV2 - ExtraParkV and PosT < ParkV1 and PosY1 + TryMoveY1 < MaxY1) then MoveY1 = max( MoveY1, TryMoveY1) end
-- se appena eseguito taglio di separazione
if bSpliCut then
@@ -1417,8 +1555,8 @@ function ExecParkRoller( PosY1, PosY2, PosV1, PosV2, bSpliCut, bAgg)
local MoveV2 = ParkV2 - PosV2
local DiffY2 = MyParkY2 - PosY2
local MoveY2 = EgtIf( DiffY2 < -0.1, MoveV2, 0)
local TryMoveY2 = ParkV2 - PosT - EMT.LP
if ( PosT + EMT.LP < ParkV1 + ExtraParkV and PosT + EMT.LP > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end
local TryMoveY2 = ParkV2 - PosT - EMT.LT
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,
'V1', ParkV1, MCH_SIM_STEP.RAPID,
'V2', ParkV2, MCH_SIM_STEP.RAPID,
@@ -1453,14 +1591,14 @@ function ExecOpenRoller( nInd)
end
---------------------------------------------------------------------
function RemoveScraps()
function ExecRemoveScraps()
-- se attivo VMILL, lavorazione ed è richiesto di eliminare gli sfridi
if EMT.VMILL and #EMT.VMILL > 0 and not EMT.OPEISDISP and EMT.VMRS then
local vMillId = EMT.VMILL[1]
local nPart = EgtVolZmapPartCount( vMillId)
if nPart > 1 then
-- ricerca del pezzo con massimo volume
local dTCenX = -EgtGetAxisPos( 'T') - EMT.LP / 2
local dTCenX = -EgtGetAxisPos( 'T') - EMT.LT / 2
local nPartMax = 0
local dVolMax = 0
for i = 1, nPart do
@@ -1484,7 +1622,6 @@ function RemoveScraps()
end
EMT.VMRS = false
end
end
---------------------------------------------------------------------
@@ -1653,14 +1790,14 @@ end
---------------------------------------------------------------------
function GetV1ToClose()
--EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LP or 0))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0))
return ( EMT.MAXMAX[1] <= EMT.V1NEXTPOS + RollCageMin and EMT.MAXMIN[1] + EMT.LB >= EMT.V1NEXTPOS + RollCageMax)
end
---------------------------------------------------------------------
function GetV2ToClose()
--EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LP or 0))
--EgtOutLog( string.format( 'LB=%.3f LT=%.3f', EMT.LB, EMT.LT or 0))
return ( EMT.MAXMAX[1] <= EMT.V2NEXTPOS - RollCageMax and EMT.MAXMIN[1] + EMT.LB >= EMT.V2NEXTPOS - RollCageMin)
end
@@ -1676,42 +1813,21 @@ end
---------------------------------------------------------------------
function LoadFirstTool( nHSet, sTcPosDef)
if nHSet ~= 1 and nHSet ~= 2 then return end
EgtUnloadTool( EgtIf( nHSet == 1, 'H11', 'H21'), 1)
if GetHeadSetFromTcPos( sTcPosDef) ~= nHSet then return end
local sTool, sHead, sTcPos = FindFirstToolOnHeadSet( nHSet)
local sTool, sHead, sTcPos, sTTotLen, sBlockedAxis = FindFirstToolOnHeadSet( nHSet)
if not sTool then
local vTools = EgtGetToolsInCurrSetupPos( sTcPosDef)
if vTools and vTools[1] then
sTool = vTools[1]
sTcPos = sTcPosDef
if nHSet == 1 then
-- seconda lama
if SecondSaw and sTcPos == 'T21' then
sHead = 'H16'
-- utensili speciali
elseif TcSpecialTools and sTcPos == 'T121' then
sHead = 'H14'
-- motoseghe
elseif sTcPos == 'T101' or sTcPos == 'T111' then
sHead = 'H13'
-- utensili standard o prima lama
else
sHead = EgtIf( sTcPos == 'T1', 'H12', 'H11')
end
else
-- lama su aggregato da sotto
if TcAggreBladeUnder and sTcPos == 'T201' then
sHead = 'H22'
-- utensili standard da sotto
else
sHead = 'H21'
end
end
sHead = GetAdjHeadFromTcPos( nHSet, sTcPos)
end
end
if sTool then
-- imposto correttamente i dati di testa
local OrigEMC = EMC
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTLEN = 0}
EMC = { HEAD = sHead, TOOL = sTool, TCPOS = sTcPos, TOTLEN = sTTotLen, BLOCKEDAXIS = sBlockedAxis}
OnSetHead()
EMC = OrigEMC
-- carico l'utensile
@@ -2130,7 +2246,7 @@ function FindFirstToolOnHeadSet( nHSet)
local CurrMachId = EgtGetCurrMachining()
local CurrTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
-- cerco lavorazione con utensile su gruppo testa indicato
local sTool, sHead, sTcPos
local sTool, sHead, sTcPos, sTTotLen, sBlockedAxis
local OpId = EgtGetFirstActiveOperation()
while OpId do
local nType = EgtGetOperationType( OpId)
@@ -2142,6 +2258,8 @@ function FindFirstToolOnHeadSet( nHSet)
if GetHeadSet( sHead) == nHSet then
sTool = sTest
sTcPos = EgtTdbGetCurrToolParam( MCH_TP.TCPOS)
sTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
sBlockedAxis = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
break
end
end
@@ -2153,7 +2271,7 @@ function FindFirstToolOnHeadSet( nHSet)
EgtSetCurrMachining( CurrMachId or GDB_ID.NULL)
EgtTdbSetCurrTool( CurrTool or '')
-- restituisco risultato
return sTool, sHead, sTcPos
return sTool, sHead, sTcPos, sTTotLen, sBlockedAxis
end
---------------------------------------------------------------------
@@ -2171,14 +2289,6 @@ function GetToolTcPos( sTool)
return sTcPos
end
---------------------------------------------------------------------
function GetCurrChainSawingVirtualAxis()
-- recupero il valore dell'asse virtuale bloccato A
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) or 'A1=0'
local dPosA = tonumber( sVal:sub( 4)) or 0
return dPosA
end
---------------------------------------------------------------------
function GetNextChainSawingVirtualAxis( MchId)
-- recupero la lavorazione successiva
@@ -2254,7 +2364,7 @@ end
---------------------------------------------------------------------
function RollerParkingNeeded( sHead, dAng1p, dAng2p, dAng1, dAng2)
if sHead == 'H11' or sHead == 'H14' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
elseif sHead == 'H21' or sHead == 'H22' then
return ( abs( dAng1 - dAng1p) > 1 or ( abs( dAng2 - dAng2p) > 1 and abs( dAng1 % 180.0) > 1))
+48 -23
View File
@@ -1,12 +1,11 @@
-- Special Operations macchina Essetre-PF1250 by EgalTech s.r.l. 2023/11/21
-- Special Operations macchina Essetre-PF1250 by Egalware s.r.l. 2024/01/22
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
-- Carico i dati globali
local sBaseDir = EgtGetSourceDir()
local BD = dofile( sBaseDir .. 'Beam\\BeamData.lua')
-- Carico libreria
local BD = require( 'BeamData')
---------------------------------------------------------------------
-- *** Special Z moves ***
@@ -44,13 +43,15 @@ function OnSpecialGetMaxZ()
-- Sistemazione dati di input
local vtTp = Vector3d( EMC.TDIRp)
local bFromZmax = false
-- recupero il gruppo
local nSetHead = GetHeadSet( EMC.HEAD)
if vtTp:isSmall() then
vtTp = X_AX()
bFromZmax = true
if EMC.HEAD == 'H11' or EMC.HEAD == 'H14' or EMC.HEAD == 'H12' or EMC.HEAD == 'H16' then
if nSetHead == 1 then
EMC.R1p = ParkC1
EMC.R2p = ParkB1
elseif EMC.HEAD == 'H21' or EMC.HEAD == 'H22' then
elseif nSetHead == 2 then
EMC.R1p = ParkC2
EMC.R2p = ParkB2
end
@@ -60,7 +61,7 @@ function OnSpecialGetMaxZ()
local bBSameSign = (( EMC.R2p < 10 and EMC.R2 < 10) or ( EMC.R2p > -10 and EMC.R2 > -10))
-- Calcolo in funzione della testa e dei parametri
if EMC.HEAD == 'H11' or EMC.HEAD == 'H14' then
if EMC.HEAD == 'H11' then
if bBSameSign and vtTp:getX() > -0.1 and vtT:getX() > -0.1 then
EMC.MAXZ = MaxZ1
else
@@ -115,9 +116,9 @@ end
---------------------- OnSpecialMoveZup -----------------------------
function OnSpecialMoveZup()
--EgtOutLog( 'OnSpecialMoveZup : ' .. EMC.HEAD .. '.' .. tostring( EMC.EXIT))
-- Inizializzazioni
EMC.ERR = 0
EMC.MODIF = false
@@ -131,7 +132,7 @@ function OnSpecialMoveZup()
-- se fresa su testa1 o testa 2
if EMC.HEAD == 'H11' or EMC.HEAD == 'H14' or EMC.HEAD == 'H21' or EMC.HEAD == 'H22' then
if EMC.HEAD == 'H11' or EMC.HEAD == 'H21' or EMC.HEAD == 'H22' then
;
-- se lama
else
@@ -251,6 +252,22 @@ local function GetNextStartOrRestPhase( nPhase)
return nNextPhase
end
---------------------------------------------------------------------
local function IsFirstMachiningOfStart( nMchId)
-- se non è fase inizio di pezzo, ritorno risultato negativo
if not IsStartOrRestPhase( EMC.PHASE) then
return false
end
-- recupero la precedente operazione attiva
local nPrevOperId = EgtGetPrevActiveOperation( nMchId)
-- se non esiste o non è una disposizione, ritorno risultato negativo
if not nPrevOperId or EgtGetOperationType( nPrevOperId) ~= MCH_OY.DISP then
return false
end
-- è la prima
return true
end
---------------------------------------------------------------------
local function UpdateMinJoin()
MinJoin = BD.GetMinJoin( EMC.SB, EMC.HB, EMC.LB)
@@ -486,7 +503,7 @@ end
---------------------------------------------------------------------
function OnPostApplyMachining()
EgtOutLog( ' Lavorazione : ' .. EgtGetName( EMC.MCHID), 1)
EgtOutLog( ' Lavorazione : ' .. EgtGetName( EMC.MCHID) .. ' (' .. tostring( EMC.MCHID) .. ')')
-- Inizializzo codice di errore
EMC.ERR = 0
@@ -667,6 +684,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
EMC.SB = b3Tot:getDimY()
EMC.HB = b3Tot:getDimZ()
EMC.LT = b3Raw:getDimX()
EgtOutLog( ' BarLen='..EgtNumToString( EMC.LB, 1), 3)
-- Aggiorno limiti di presa
UpdateMinJoin()
@@ -746,6 +764,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
-- Altrimenti, non muovo i carrelli rispetto alla trave ma impongo la posizione dei rulli
else
SpecOutputCNT()
local vCmd = {}
table.insert( vCmd, { 21, EgtIf( EMC.Y1DELTA, EMC.Y1DELTA, 0), EgtIf( EMC.Y2DELTA, EMC.Y2DELTA, 0)})
table.insert( vCmd, { 22, dRollBack, -dRollFront})
@@ -779,7 +798,7 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload)
return false
end
-- eseguo la separazione
EgtOutLog( 'MaxLenLeft=' .. EgtNumToString( dMaxLenLeft, 1))
EgtOutLog( 'MaxLenLeft=' .. EgtNumToString( dMaxLenLeft, 1), 1)
vCmd = SpecCalcSplit( b3Raw:getDimX(), dMaxLenLeft)
end
-- Se taglio finale di grezzo a perdere
@@ -846,26 +865,32 @@ function SpecialCalcMachiningEncumbrance( nMchId, bPreCut)
for i = 1, #vAxMin do
vAxMid[i] = ( vAxMin[i] + vAxMax[i]) / 2
end
-- recupero il gruppo
local nSetHead = GetHeadSet( sHead)
-- Calcolo dell'ingombro della testa rispetto allo Zero Macchina (assi rotanti fissi, C=4, B=5, A=6)
local b3Enc
if sHead ~= 'H21' and sHead ~= 'H22' then
if nSetHead == 1 then
EgtSetAxisPos( 'C1', vAxMid[4])
EgtSetAxisPos( 'B1', vAxMid[5])
if sHead == 'H13' then
EgtSetAxisPos( 'A1', vAxMid[6])
end
b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C1'), GDB_BB.ONLY_VISIBLE)
else
elseif nSetHead == 2 then
EgtSetAxisPos( 'C2', vAxMid[4])
EgtSetAxisPos( 'B2', vAxMid[5])
if sHead == 'H22' then
EgtSetAxisPos( 'A2', vAxMid[6])
end
b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C2'), GDB_BB.ONLY_VISIBLE)
else -- 'H31'
EgtSetAxisPos( 'C3', vAxMid[4])
EgtSetAxisPos( 'B3', vAxMid[5])
b3Enc = EgtGetBBoxGlob( EgtGetAxisId( 'C3'), GDB_BB.ONLY_VISIBLE)
end
local dMinFrontEng = EgtIf( sHead ~= 'H21' and sHead ~= 'H22', 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 dMinBackEng = EgtIf( sHead ~= 'H21' and sHead ~= 'H22', 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
EgtOutLog( ' RollFront = ' .. EgtNumToString( dRollFront, 1) .. ' RollBack = ' .. EgtNumToString( dRollBack, 1), 3)
-- Calcolo della posizione della Punta Utensile rispetto allo Zero Macchina
@@ -1052,8 +1077,8 @@ function SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1Del
return {}
end
-- al carico si deve ignorare l'ingombro delle lavorazioni di testa per il pinzaggio
if EMC.LOAD then EMC.HCING = 0 end
-- al carico o con prima lavorazione di un pezzo si deve ignorare l'ingombro delle lavorazioni di testa per il pinzaggio
if EMC.LOAD or IsFirstMachiningOfStart( EMC.MCHID) then EMC.HCING = 0 end
return SpecAdjustCarriages( WorkTab)
@@ -1614,7 +1639,7 @@ local function PosY1FromY2B( TabI, vCmd)
end
-- questo movimento serve solo a gestire (in modo complesso) il caso [ri]
MaxDispl( TabI, vCmd, 'M4')
else
else
-- **[rp]** = raggiungo il punto medio Y1New dell'intervallo
EmitComment( vCmd, '[Y1B-rp] ')
if not SpecTestSomeMoveInCmds( vCmd) and not EMC.Y2DELTA then
@@ -1715,7 +1740,7 @@ local function PosY1Y2A( TabI, vCmd)
PosY1FromY2A( TabI, vCmd)
bXW = false
end
else
else
-- in **accentramento**
-- sempre se intervallo per Y2 raggiungibile in una sola fase
if ( TabI.dTPosI + TabI.dY2DeltaMinF) - TabI.MaxY2V2 < TabI.dY1PosI - TabI.MyMinY1V1 then
@@ -2117,8 +2142,8 @@ function SpecAdjustCarrB1( WorkTab)
if not SpecTestSomeMoveInCmds( vCmd) then
table.insert( vCmd, { 3, 'Y1', dY1PosI, 'Y2', dY2PosI, 'T', WorkTab.dTPosI, EMC.CNT})
end
table.insert( vCmd, { 11, 1}) -- chiudo Y1
table.insert( vCmd, { 12, 1}) -- Chiudo Y2
table.insert( vCmd, { 11, 1}) -- chiudo Y1
-- imposto i nuovi parametri di aggancio
table.insert( vCmd, { 21, dY1DeltaF, dY2DeltaF})
EgtOutLog( ' Y1DeltaF=' .. EgtNumToString( dY1DeltaF) .. ' Y2DeltaF=' .. EgtNumToString( dY2DeltaF), 1)
@@ -2189,8 +2214,8 @@ function SpecAdjustCarrB2( WorkTab)
if not SpecTestSomeMoveInCmds( vCmd) then
table.insert( vCmd, { 3, 'Y1', dY1PosI, 'Y2', dY2PosI, 'T', WorkTab.dTPosI, EMC.CNT})
end
table.insert( vCmd, { 11, 1}) -- chiudo Y1
table.insert( vCmd, { 12, 1}) -- Chiudo Y2
table.insert( vCmd, { 11, 1}) -- chiudo Y1
-- imposto i nuovi parametri di aggancio
table.insert( vCmd, { 21, dY1DeltaF, dY2DeltaF})
EgtOutLog( ' Y1DeltaF=' .. EgtNumToString( dY1DeltaF) .. ' Y2DeltaF=' .. EgtNumToString( dY2DeltaF), 1)
@@ -2250,7 +2275,7 @@ function SpecAdjustCarrC( WorkTab)
WorkTab.dY1DeltaMaxF = EMC.LB - ( MinJoin + MyTCING)
-- se Y1 deve accentrarsi
if WorkTab.dY1DeltaI > WorkTab.dY1DeltaMaxF then
WorkTab.dY1DeltaMinF = EMC.LB - 2 * MinJoin + MyTCING
WorkTab.dY1DeltaMinF = EMC.LB - 2 * MinJoin - MyTCING
end
end
-- posizioni obiettivo dei carrelli al centro dei rispettivi intervalli di validità
+36
View File
@@ -0,0 +1,36 @@
REM Compilazione degli script macchina Egaltech 2024.02.22
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 bit e copia file da non compilare
@echo off
REM chiedo all'utente la versione da assegnare alla macchina da compilare
set /p "machineVersion=Inserisci versione: "
REM variabili per costruire i percorsi delle cartelle
set "machineName=Essetre-PF1250MAX"
set "deployFolder=C:\MachinesDeploy"
set "machinePath=%deployFolder%\%machineName%\"
set "fullPathSource=%deployFolder%\%machineName%\%machineVersion%\%machineName%"
set "fullPathZip=%deployFolder%\%machineName%\%machineVersion%"
REM elimino eventuale cartella esistente
rmdir /s /Q %fullPathZip%
REM copio i sorgenti nel percorso di destinazione
ROBOCOPY . %fullPathSource%\ /E /XF "Compile.bat" /XF ".gitignore" /XD ".git" /XF "UpdateLog.txt"
REM copio i sorgenti nel percorso temporaneo per i compilati
ROBOCOPY . %fullPathSource%\bin\%machineName%\ /E /XF "Compile.bat" /XF ".gitignore" /XD ".git" /XF "UpdateLog.txt"
REM copio i file compilati nel percorso temporaneo per i compilati
\EgtProg\Dll32\luac54 -o %fullPathSource%\bin\%machineName%\Common-PF1250.mlpe Common-PF1250.mlpe
\EgtProg\Dll32\luac54 -o %fullPathSource%\bin\%machineName%\Common-PF1250.mlse Common-PF1250.mlse
\EgtProg\Dll32\luac54 -o %fullPathSource%\bin\%machineName%\Common-PF1250.TPA.mlpe Common-PF1250.TPA.mlpe
REM comprimo i file compilati in uno zip pronto per essere distribuito
tar.exe acvf %fullPathZip%\%machineName%.zip -C %fullPathSource%\bin\ %machineName%\*.*
REM elimino il percorso temporaneo
rmdir /s /Q %fullPathSource%\bin\
Binary file not shown.
-4
View File
@@ -20,8 +20,6 @@ H11.1=Standard.nge
H11.1:MILL_NOTIP=MillNoTip.nge
H12.1=Saw.nge
H13.1=ChainSaw.nge
H14.1=Standard.nge
H14.1:MILL_NOTIP=MillNoTip.nge
H16.1=Saw.nge
H21.1=Standard.nge
H21.1:MILL_NOTIP=MillNoTip.nge
@@ -53,8 +51,6 @@ H11=6608
H12=6615
; Chainsaw
H13=6616
; 5 axis head
H14=6608
; 5 axis second saw
H16=6623
; Second 5 axis bottom head
+143 -70
View File
@@ -1,18 +1,53 @@
-- Descrizione macchina Essetre-PF1250MAX by EgalWare s.r.l. 2023/12/07
-- Descrizione macchina Essetre-PF1250MAX by EgalWare s.r.l. 2024/02/20
-- 2023/12/07 ver 2.5l1 Prima versione. Derivata da PF1250 ver 2.5l4
-- 2023/12/15 ver 2.5l2 Corretti vari offset in simulazione
-- 2023/12/18 ver 2.5l3 Ultimata gestione aggregato lama da sotto
-- Spostato alcune funzioni proprie del C.U. nel MLDE (per post-proc common)
-- Spostato magazzini sotto traversa ( di 200mm) come da modifica meccanica
-- 2023/12/20 ver 2.6a1 Prima versione con post Common-PF1250
-- Invertiti magazzini mortasatrice-truciolatore e adeguati solidi di collisione
-- Abbassata testa 2 di 300mm
-- Parcheggio motosega portato a -1700mm
-- In BeamData aggiunta GetSawBlockedAxis per fissare asse bloccato per aggregato lama sotto.
-- Costanti MinForzaPinze e MaxForzaPinze portati in mlde/Ts3data (erano hardcoded - Common)
-- Aggiunto variabile 'WriteAllCoordsOnFirstM101' e allineamento con 2.6a1 common
-- 2023/12/20 ver 2.6a2 Allineamento con Common-PF1250 v.2.6a2
-- 2024/01/22 ver 2.6a3 Migliorata preselezione utensile
-- Rimosse funzioni ribaltamento pezzo
-- Allineamento con Common-PF1250 v.2.6a3
-- In BeamData aggiunta la funzione GetBlockedAxis che sostituisce le altre (GetChainSawBlockedAxis e GetSawBlockedAxis)
-- 2024/01/25 ver 2.6a4 Allineamento con Common 2.6a4
-- 2024/02/09 ver 2.6b1 Corretto errore in definizione testa H22
-- In BeamData migliorata funzione GetBlockedAxis
-- 2024/02/12 ver 2.6b2 Allineamento con common 2.6b2
-- 2024/02/20 ver 2.6b3 Allineamento con common 2.6b3
-- 2024/02/26 ver 2.6b4 Allineamento con common ver. 2.6b4; in mlde aggiunte chiamate EgtAddToPackagePath
-- 2024/02/29 ver 2.6c1 Allineamento con common ver. 2.6c1
-- 2024/03/04 ver 2.6c2 Modificato log con nome macchina
-- Allineamento con common ver. 2.6c2
-- 2024/03/05 ver 2.6c3 Corretto portautensile Standard_LC_108.
-- Intestazioni
require( 'EmtGenerator')
EgtEnableDebug( false)
PP_VER = '2.5l3'
PP_VER = '2.6c3'
MIN_MACH_VER = '2.5k1'
MACH_NAME = 'Essetre-PF1250MAX'
EgtOutLog ( '** Essetre-PF1500rl '..PP_VER..' (MinMach '.. MIN_MACH_VER ..') **', 1)
-- Carico i dati globali
local sMachDir = EgtGetCurrMachineDir()
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
EgtAddToPackagePath( sMachDir .. '\\?.lua')
INFO_STD_PP = require( 'Version')
-- prendo la versione kernel minima necessaria piu' nuova tra macchina e script comuni
if INFO_STD_PP.MIN_MACH_VER_PP_COMMON > MIN_MACH_VER then
MIN_MACH_VER = INFO_STD_PP.MIN_MACH_VER_PP_COMMON
end
EgtOutLog ( '** ' .. MACH_NAME..' '..PP_VER..' ** ( '..INFO_STD_PP.NAME..': '..INFO_STD_PP.VERSION..' - MinMach: '.. MIN_MACH_VER ..') **', 1)
-- Parametri macchina
NumericalControl = 'TPA' -- NUM o TPA
@@ -75,15 +110,19 @@ MinB1b = -119
MaxB1b = 119
ParkX1 = 250
ParkTc2X1 = 3100
ParkZ1 = -535
ParkZ1 = -525
ParkC1 = -90
ParkB1 = -90
ParkCSawX1 = 1500
ParkCSawZ1 = -200
ParkCSawX1 = 1700
ParkCSawZ1 = -100
ParkCSaw0Z1 = -400
ParkCSawC1 = -90
ParkCSaw0C1 = 0
ParkCSawB1 = 0
MinLengthLongCSaw = 580 -- gestione speciale per motosega molto lunga. Lunghezza al di sopra della quale è considerata motosega lunga
ParkLongCSawZ1 = -50 -- gestione speciale per motosega molto lunga. Parcheggio asse Z
ParkLongCSawC1 = 0 -- gestione speciale per motosega molto lunga. Parcheggio asse C
ParkLongCSawB1 = -90 -- gestione speciale per motosega molto lunga. Parcheggio asse B
LongTool = 400
ParkLongTc1C1 = 0
ParkLongTc2C1 = -180
@@ -107,7 +146,7 @@ ParkSawX2 = MinX2
ParkSawZ2 = 0
ParkSaw0Z2 = 0
ParkSawC2 = -90
ParkSaw0C2 = 0
ParkSaw0C2 = -90
ParkSawB2 = 0
MinDistToolX1X2 = 40
TurnerOffs = 120.0
@@ -118,23 +157,27 @@ DeltaRulliTraveZ = -1203
DimTabY = 1400
DimTabX = 24000
Delta2TabY = -1185.9
Delta2TabZ = 393 - Mill2Offs -- per TPA : 378.0 - Mill2Offs -- per NUM : 223
Delta2TabZ = 693 - Mill2Offs -- per TPA : 378.0 - Mill2Offs -- per NUM : 223
Head2X = 0
Head2Y = DeltaTabY - Delta2TabY
Head2Z = DeltaTabZ - Delta2TabZ
DefTcPos1 = 'T1'
DefTcPos2 = 'T300'
DefTcPos2 = 'T220'
CoeffVM = 0.5
MinForzaPinze = 400 -- [Kgf]
MaxForzaPinze = 1000 -- [Kgf]
Tc2Active = true -- magazzino prima sega a catena
SecondSaw = true -- seconda lama su aggregato su TC3 presente
SecondChain = true -- magazzino seconda sega a catena
TcSpecialTools = true -- magarzzino per utensili speciali. In genere truciolatore
TcAggreBladeUnder = true -- lama su aggregato per testa da sotto
EmitAccClamps = true
WriteAllCoordsOnFirstM101 = true
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PF1250MAX.data"
local sDataBeam = EgtGetSourceDir().."\\Beam\\Ts3Data.lua"
local sDataWall = EgtGetSourceDir().."\\Wall\\Ts3Data.lua"
local sDataBeam = sMachDir.."\\Beam\\Ts3Data.lua"
local sDataWall = sMachDir.."\\Wall\\Ts3Data.lua"
if EgtExistsFile( sTs3Data) then
EgtCopyFile( sTs3Data, sDataBeam)
EgtCopyFile( sTs3Data, sDataWall)
@@ -149,6 +192,7 @@ if EgtExistsFile( sDataBeam) then
--NumericalControl = EgtIf( Machine.Offsets.TIPO_CN == 0, 'NUM', 'TPA')
if Machine.Offsets.X1_POS then MinX1 = -Machine.Offsets.X1_POS end
if Machine.Offsets.X1_NEG then MaxX1 = -Machine.Offsets.X1_NEG end
if Machine.Offsets.PARK_X1 then ParkX1 = Machine.Offsets.PARK_X1 end
if Machine.Offsets.Z1_NEG then MinZ1 = Machine.Offsets.Z1_NEG end
if Machine.Offsets.Z1_POS then MaxZ1 = min( MaxZ1, Machine.Offsets.Z1_POS) end
if Machine.Offsets.PARK_Z1 then ParkZ1 = Machine.Offsets.PARK_Z1 end
@@ -160,9 +204,11 @@ if EgtExistsFile( sDataBeam) then
if Machine.Offsets.B1_POS1 then MaxB1b = Machine.Offsets.B1_POS1 end
if Machine.Offsets.X2_NEG then MinX2 = Machine.Offsets.X2_NEG end
if Machine.Offsets.X2_POS then MaxX2 = Machine.Offsets.X2_POS end
if Machine.Offsets.PARK_X2 then ParkX2 = Machine.Offsets.PARK_X2 end
if Machine.Offsets.Z2_POS then MinZ2 = -Machine.Offsets.Z2_POS end
if Machine.Offsets.Z2_NEG then MaxZ2 = -Machine.Offsets.Z2_NEG end
if Machine.Offsets.PARK_Z2 then ParkZ2 = -Machine.Offsets.PARK_Z2 end
if Machine.Offsets.PARK_Z2_INLAV then ParkInLavZ2 = -Machine.Offsets.PARK_Z2_INLAV end
if Machine.Offsets.C2_NEG then MinC2 = Machine.Offsets.C2_NEG end
if Machine.Offsets.C2_POS then MaxC2 = Machine.Offsets.C2_POS end
if Machine.Offsets.B2_NEG then MinB2 = Machine.Offsets.B2_NEG end
@@ -183,10 +229,10 @@ if EgtExistsFile( sDataBeam) then
if Machine.Offsets.DIST_UNLOAD then UnloadT = Machine.Offsets.DIST_UNLOAD end
if Machine.Offsets.PIVOT_T1 then MillOffs = Machine.Offsets.PIVOT_T1 end
if Machine.Offsets.PIVOT_T2 then Mill2Offs = Machine.Offsets.PIVOT_T2 end
if Machine.Offsets.OFFSETCLAMAT1 then SawC1Offs = Machine.Offsets.OFFSETCLAMAT1 end
if Machine.Offsets.OFFSETBLAMAT1 then SawB1Offs = Machine.Offsets.OFFSETBLAMAT1 end
if Machine.Offsets.OFFSETCLAMAT2 then Saw2C1Offs = Machine.Offsets.OFFSETCLAMAT2 end
if Machine.Offsets.OFFSETBLAMAT2 then Saw2B1Offs = Machine.Offsets.OFFSETBLAMAT2 end
if Machine.Offsets.OFFSETCLAMAT1 then SawC1Offs= Machine.Offsets.OFFSETCLAMAT1 end
if Machine.Offsets.OFFSETBLAMAT1 then SawB1Offs= Machine.Offsets.OFFSETBLAMAT1 end
if Machine.Offsets.OFFSETCLAMAT2 then Saw2C1Offs= Machine.Offsets.OFFSETCLAMAT2 end
if Machine.Offsets.OFFSETBLAMAT2 then Saw2B1Offs= Machine.Offsets.OFFSETBLAMAT2 end
if Machine.Offsets.OFFSETXT1 then DeltaTabY = -Machine.Offsets.OFFSETXT1 end
if Machine.Offsets.OFFSETZT1 then DeltaTabZ = Machine.Offsets.OFFSETZT1 + MillOffs end
if Machine.Offsets.OFFSETXT2 then Delta2TabY = Machine.Offsets.OFFSETXT2 end
@@ -199,6 +245,8 @@ if EgtExistsFile( sDataBeam) then
if Machine.Offsets.SAW2OFFSZ then Saw2OffsZ = Machine.Offsets.SAW2OFFSZ end
if Machine.Offsets.DEFTCPOS1 then DefTcPos1 = ( 'T' .. Machine.Offsets.DEFTCPOS1) end
if Machine.Offsets.DEFTCPOS2 then DefTcPos2 = ( 'T' .. Machine.Offsets.DEFTCPOS2) end
if Machine.Offsets.MINPRESS then MinForzaPinze = Machine.Offsets.MINPRESS end
if Machine.Offsets.MAXPRESS then MaxForzaPinze = Machine.Offsets.MAXPRESS end
-- aggiustamenti
MinY1 = MinV1 + MinDeltaYV
MaxY1 = MaxMchY1
@@ -225,8 +273,8 @@ EmtGeneral {
ExitMaxAdjust = 300,
ExitMaxRotAdj = 0.5,
AngDeltaMinForHome = 80,
Special = 'Essetre-PF1250.mlse',
Processor = 'Essetre-PF1250.mlpe'}
Special = 'Common-PF1250.mlse',
Processor = 'Common-PF1250.mlpe'}
local sBaseAux = {'BASE/SOLID', 'BASE/CONVOYER', 'BASE/COLLISION', 'BASE/TC1', 'BASE/TCR', 'BASE/TC3'}
if Tc2Active then table.insert( sBaseAux, 5, 'BASE/TC2') end
if TcSpecialTools then table.insert( sBaseAux, 'BASE/TC4') end
@@ -311,23 +359,6 @@ local H12Id = EmtHead {
Geo = 'H12_HEAD/GEO'}
EgtSetInfo( H12Id, 'ZEXTRA', '160,60')
EgtSetInfo( H12Id, 'ZMAXONROT', '1,190')
-- Utensili speciali
if TcSpecialTools then
local H14Id = EmtHead {
Name = 'H14',
Parent = 'B1',
HSet = 'H11',
Type = MCH_HT.STD,
Pos = Point3d(0,0,0),
TDir = Z_AX(),
ADir = -Y_AX(),
Rot1W = 0.2,
Rot2Stroke = { MinB1, MaxB1},
OthColl = {'B1/SOLID', 'C1/SOLID'},
Geo = 'H14_HEAD/GEO'}
EgtSetInfo( H14Id, 'ZEXTRA', '160,60')
EgtSetInfo( H14Id, 'ZMAXONROT', '1,190')
end
-- Lama 2
if SecondSaw then
local H16Id = EmtHead {
@@ -429,10 +460,10 @@ EmtAxis {
Home = 0,
Geo = 'A2_AXIS/GEO'}
local vtMoveZ2 = Vector3d( 0, 0, Head2Z + 1481.0)
local vtMoveZ2 = Vector3d( 0, 0, Head2Z + 1781.0)
EgtMove( EgtGetFirstNameInGroup( Z2Id, 'SOLID'), vtMoveZ2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( Z2Id, 'COLLISION'), vtMoveZ2, GDB_RT.GLOB)
local vtMoveX2 = Vector3d( 0, Head2Y - 3735.9, Head2Z + 1481.0)
local vtMoveX2 = Vector3d( 0, Head2Y - 3735.9, Head2Z + 1781.0)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'SOLID'), vtMoveX2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( X2Id, 'COLLISION'), vtMoveX2, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( C2Id, 'SOLID'), vtMoveX2, GDB_RT.GLOB)
@@ -467,10 +498,8 @@ if TcAggreBladeUnder then
Rot2Stroke = { MinB2b, MaxB2b},
OthColl = {'B2/SOLID', 'C2/SOLID'},
Geo = 'H22_HEAD/GEO'}
EgtSetInfo( H21Id, 'ABOVE', '0')
EgtSetInfo( H21Id, 'ZHOMEDOWN', '1')
EgtSetInfo( H22Id, 'ZEXTRA', '160,60')
EgtSetInfo( H22Id, 'ZMAXONROT', '1,190')
EgtSetInfo( H22Id, 'ABOVE', '0')
EgtSetInfo( H22Id, 'ZHOMEDOWN', '1')
end
-- *** Carrelli ***
-- Morse
@@ -762,7 +791,7 @@ if Tc2Active then
ADir = X_AX(),
Geo = 'BASE/T30'}
end
local ptTc3 = Point3d( 680, 529, -200.8 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
local ptTc3 = Point3d( 600, 529, -200.8 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
EmtTcPos {
Name = 'T101',
Parent = 'Base',
@@ -770,22 +799,22 @@ EmtTcPos {
TDir = -X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T101'}
local ptTc4 = Point3d( 650, 909, -115 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
EmtTcPos {
Name = 'T121',
Parent = 'Base',
Pos = ptTc4,
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T121'}
local ptTc5 = Point3d( 650, 1249, -200.8 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
local ptTc4 = Point3d( 750, 909, -200.8 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
EmtTcPos {
Name = 'T111',
Parent = 'Base',
Pos = ptTc5,
Pos = ptTc4,
TDir = -X_AX(),
ADir = Z_AX(),
Geo = 'BASE/T111'}
local ptTc5 = Point3d( 750, 1309, -115 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
EmtTcPos {
Name = 'T121',
Parent = 'Base',
Pos = ptTc5,
TDir = Z_AX(),
ADir = X_AX(),
Geo = 'BASE/T121'}
local ptTcS = Point3d( -1, -22.3, -1723 + ( DeltaTabZ - DeltaRulliTraveZ + 55))
EmtTcPos {
Name = 'T201',
@@ -881,10 +910,10 @@ EgtMove( EgtGetFirstNameInGroup( BaseId, 'SIGN') or GDB_ID.NULL, vtMovB, GDB_RT.
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC1') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC2') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC3') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC4') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC5') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
if TcSpecialTools then EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC4') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) end
if SecondChain then EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC5') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) end
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TCR') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
EgtMove( EgtGetFirstNameInGroup( BaseId, 'TCS') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB)
if TcSpecialTools then EgtMove( EgtGetFirstNameInGroup( BaseId, 'TCS') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) end
EgtMove( EgtGetFirstNameInGroup( X1Id, 'SOLID'), vtMovB, GDB_RT.GLOB)
local vtMove = Vector3d( 0, ( DeltaTabY - 2550.0), ( DeltaTabZ + 1258.0))
EgtMove( EgtGetFirstNameInGroup( BaseId, 'CONVOYER'), vtMove, GDB_RT.GLOB)
@@ -913,7 +942,7 @@ PY2LightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( Y2Id, 'SOLID') or G
---------------------------------------------------------------------
function OnSetHead()
-- se testa H11 (fresa)
if EMC.HEAD == 'H11' or EMC.HEAD == 'H14' then
if EMC.HEAD == 'H11' then
local nTc = GetTcForTopHeadTool( EMC.TCPOS)
if nTc ~= 2 then
EmtModifyAxisHome( 'X1', ParkX1)
@@ -949,13 +978,9 @@ function OnSetHead()
elseif EMC.HEAD == 'H13' then
-- aggiustamenti per distanza
local dDist = EgtIf( EMC.DIST and abs( EMC.DIST) > 1, EMC.DIST, ChSawLen)
EmtModifyExitPosition( EMC.HEAD, EMC.EXIT, Point3d( 0, 0, -dDist))
local vtMove = Point3d( 0, 0, -dDist) - Point3d( EMC.EXITPOS)
local ExitId = EgtGetFirstNameInGroup( EgtGetHeadId( EMC.HEAD), 'T'..tostring( EMC.EXIT))
EgtMove( ExitId, vtMove)
-- recupero valore asse A bloccato
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS)
CSawPosA = tonumber( sVal:sub( 4) or '')
EmtModifyExitPosition( EMC.HEAD, EMC.EXIT or 1, Point3d( 0, 0, -dDist))
-- recupero il valore dell'asse virtuale bloccato A
local CSawPosA = GetCurrChainSawingVirtualAxis()
EmtModifyAxisHome( 'X1', ParkCSawX1)
EmtModifyAxisHome( 'Z1', GetChainSawZHomeFromVirtualAxis( CSawPosA))
EmtModifyAxisStroke( 'C1', {MinC1, MaxC1})
@@ -970,6 +995,17 @@ function OnSetHead()
EmtModifyAxisHome( 'C1', ParkC1)
EmtModifyAxisHome( 'B1', ParkB1)
EmtModifyAxisDirection( 'B1', Vector3d( cos( Saw2C1Offs), sin( Saw2C1Offs), 0))
-- se testa H21 (fresa sotto)
elseif EMC.HEAD == 'H21' then
EmtModifyAxisHome( 'C2', ParkC2)
EmtModifyAxisDirection( 'B2', X_AX())
-- se testa H22 (lama su aggregato sotto)
elseif EMC.HEAD == 'H22' then
-- recupero valore asse A2 bloccato
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) or 'A1=0'
local SawUnderPosA2 = tonumber( sVal:sub( 4) or '') or 0
EmtModifyAxisHome( 'C2', GetSawCHomeFromVirtualAxis( SawUnderPosA2))
EmtModifyAxisDirection( 'B2', Vector3d( cos( SawUnderC2Offs), -sin( SawUnderC2Offs), 0))
end
end
@@ -991,7 +1027,7 @@ end
---------------------------------------------------------------------
function GetHeadSet( sHead)
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H14' or sHead == 'H16' then
if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H16' then
return 1
elseif sHead == 'H21' or sHead == 'H22' then
return 2
@@ -1025,6 +1061,36 @@ function GetHeadSetFromTcPos( sTcPos)
return 0, 0
end
---------------------------------------------------------------------
-- Funzione che ritorna il nome della testa in base alla posizione utensile (ATT: deve rispecchiare il setup)
function GetAdjHeadFromTcPos( nHeadSet, sTcPos)
if nHeadSet == 1 then
-- seconda lama
if SecondSaw and sTcPos == 'T21' then
return 'H16'
-- utensili speciali
elseif TcSpecialTools and sTcPos == 'T121' then
return 'H11'
-- motoseghe
elseif sTcPos == 'T101' or sTcPos == 'T111' then
return 'H13'
-- utensili standard o prima lama
else
return EgtIf( sTcPos == 'T1', 'H12', 'H11')
end
elseif nHeadSet == 2 then
-- lama su aggregato da sotto
if TcAggreBladeUnder and sTcPos == 'T201' then
return 'H22'
-- utensili standard da sotto
else
return 'H21'
end
else
return ''
end
end
---------------------------------------------------------------------
---------------------------------------------------------------------
-- Funzione che riconosce testa per sega a catena
function HeadIsChainSaw( sHead)
@@ -1034,10 +1100,10 @@ end
---------------------------------------------------------------------
-- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale
function GetChainSawZHomeFromVirtualAxis( dPosA)
-- se A=0 -> T101 -> HomeZ = -400
-- se A1=0 -> T101 -> HomeZ = -400
if abs( dPosA) < 0.1 then
return ParkCSaw0Z1
-- altrimenti A=-90 -> T102 o A=90 -> T104 -> HomeZ = -100
-- altrimenti A1=-90 -> T102 o A=90 -> T104 -> HomeZ = -100
else
return ParkCSawZ1
end
@@ -1046,10 +1112,10 @@ end
---------------------------------------------------------------------
-- Funzione che calcola l'angolo Home di C per la sega a catena dal valore dell'asse virtuale
function GetChainSawCHomeFromVirtualAxis( dPosA)
-- se A=0 -> T101 -> HomeC = 0
-- se A1=0 -> T101 -> HomeC = 0
if abs( dPosA) < 0.1 then
return ParkCSaw0C1
-- altrimenti A=90 -> T104 -> HomeC = -90
-- altrimenti A1=90 -> T104 -> HomeC = -90
else
return ParkCSawC1
end
@@ -1058,10 +1124,10 @@ end
---------------------------------------------------------------------
-- Funzione che calcola l'angolo Home di C per la lama su aggregato dal valore dell'asse virtuale
function GetSawCHomeFromVirtualAxis( dPosA)
-- se A1=0 -> 201 -> HomeC = 0
-- se A2=0 -> 201 -> HomeC = -90
if abs( dPosA) < 0.1 then
return ParkSaw0C2
-- altrimenti A1=90 -> T204 -> HomeC = -90
-- altrimenti A2=90 -> T204 -> HomeC = -90
else
return ParkSawC2
end
@@ -1071,7 +1137,7 @@ function GetSawCHomeFromVirtualAxis( dPosA)
-- Funzione che ritorna ZExtra partendo dalla testa e dall'angolo verticale
function GetZExtra( sHead, dAngV)
-- se testa standard
if sHead == 'H11' or sHead == 'H14' then
if sHead == 'H11' then
if abs( dAngV) < 30.1 then
return 400
elseif abs( dAngV) < 45.1 then
@@ -1137,6 +1203,13 @@ function GetPY2Light()
return ( EgtGetInfo( PY2LightId, 'On') == '1')
end
---------------------------------------------------------------------
function GetCurrChainSawingVirtualAxis()
-- recupero il valore dell'asse virtuale bloccato A
local sVal = EgtGetMachiningParam( MCH_MP.BLOCKEDAXIS) or 'A1=0'
local dPosA = tonumber( sVal:sub( 4)) or 0
return dPosA
end
---------------------------------------------------------------------
-- Funzione per resettare tutte le attivazioni della macchina
+3 -3
View File
@@ -31,8 +31,8 @@ local GS = {}
local PositionTable = {}
local bTc2Active = ( EgtGetFirstNameInGroup( EgtGetBaseId( 'Base'), 'TC2') ~= nil)
local SecondSaw = ( EgtGetHeadId( 'H16') ~= nil)
local SecondChain = ( EgtGetFirstNameInGroup( EgtGetBaseId( 'Base'), 'TC5') ~= nil)
local TcSpecialTools = ( EgtGetHeadId( 'H14') ~= nil)
local SecondChain = ( EgtGetFirstNameInGroup( EgtGetBaseId( 'Base'), 'TC4') ~= nil)
local TcSpecialTools = ( EgtGetFirstNameInGroup( EgtGetBaseId( 'Base'), 'TC5') ~= nil)
local TcAggreBladeUnder = ( EgtGetFirstNameInGroup( EgtGetBaseId( 'Base'), 'TCS') ~= nil)
local bFullOpt = bTc2Active and SecondSaw and SecondChain and TcSpecialTools and TcAggreBladeUnder -- se ha tutti gli optional attivati
@@ -52,7 +52,7 @@ if bFullOpt then
{Pos = "Pos13", TcPos = "T13", Head = "H11", Group = "G1"},
{Pos = "Pos14", TcPos = "T101", Head = "H13", Group = "G2"}, -- motosega
{Pos = "Pos15", TcPos = "T111", Head = "H13", Group = "G2"}, -- motosega 2
{Pos = "Pos16", TcPos = "T121", Head = "H14", Group = "G2"}, -- utensile speciale
{Pos = "Pos16", TcPos = "T121", Head = "H11", Group = "G2"}, -- utensile speciale
{Pos = "Pos17", TcPos = "T21", Head = "H16", Group = "G3"}, -- TC 2
{Pos = "Pos18", TcPos = "T22", Head = "H11", Group = "G3"},
{Pos = "Pos19", TcPos = "T23", Head = "H11", Group = "G3"},
Binary file not shown.
+51
View File
@@ -0,0 +1,51 @@
==== Common_PF1250 Update Log ====
Versione 2.6c2 (04/03/2024)
- (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
Versione 2.6c1 (29/02/2024)
- (SIM) Gestione rimozione VMILL per tagli a cubetti Zig-Zag
Versione 2.6b4 (23/02/2024)
- (MLDE-SIM-GEN) EgtAddToPackagePath spostato in mlde
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-GEN) "BeamData" caricato come libreria con 'require' anziché come file con 'dofile'
Versione 2.6b2 (15/02/2024)
- (SIM-GEN) Primo movimento in X per testa 2 a SafeX2 anziché a ParkX2
Versione 2.6b1 (07/02/2024)
- (MLDE-SIM-GEN) Inserito parametro 'MinLengthLongCSaw' per gestione motosega molto lunga
- (MLDE) funzione 'GetCurrChainSawingVirtualAxis' spostata in MLDE
Versione 2.6a5 (31/01/2024)
- (SIM) Migliorata simulazione apertura/chiusura morse in caso di separazione
- (SIM-GEN) Migliorata gestione movimenti con motosega e adeguato simulazione
- (GEN) Corretta scrittura assi in caso di 'WriteAllCoordsOnFirstM101' per testa 2
- (SIM-GEN) Caricamento BeamData come local
Versione 2.6a4 (25/01/2024)
- (SIM-GEN) Corretto movimento in caso di cambio assi rotanti tra due lavorazioni
- (GEN) Corretta emissione coordinate assi in caso di 'WriteAllCoordsOnFirstM101'
Versione 2.6a3 (22/01/2024)
- (SIM-GEN) Correzione gestione apertura/chiusura rulli sul fine barra (#1630) e in generale
- (GEN) Modificato flag 'EmitRapidInG0' in 'EmitRapidInG1' per decidere se scrivere G1 anziché G0. Se flag a nil, scrive i rapidi in G0
- (SIM) Correzione movimenti pinze prima di separazione
Versione 2.6a2 (19/01/2024)
- (GEN) Corretta inversione coordinata X per Lama su aggregato da sotto
- (SIM) Se modalità 'WriteAllCoordsOnFirstM101', oltre alla X si scive quota di parcheggio assi B2 e C2 come in generazione
- (SIM-GEN) Tolta gestione rotazione pezzo (di derivazione PF), in macchina non è previsto ribaltamento
- (GEN) Migliorata gestione preselezione utensile
- (MLDE-GEN) Aggiunto flag 'EmitRapidInG0' per decidere se scrivere G0 anziché G1. Se flag a nil, scrive i rapidi in G1
Versione 2.6a1 (09/01/2024)
- Prima versione post-proc comune tra macchine PF1250 e PF1500
- (SIM-GEN) Corretto movimento testa 2 in ToolDesel e movimento controllo collisione
- (GEN) Tolta testa H14 per utensili speciali. Si utilizza H11 per frese standard
- (MLDE-GEN) Costanti 'MinForzaPinze' e 'MaxForzaPinze' portati in mlde/Ts3data (erano hardcoded)
- (MLDE-SIM-GEN) Aggiunto parametro 'WriteAllCoordsOnFirstM101' per decidere se stampare tutti gli assi sulla prima M101
+10
View File
@@ -0,0 +1,10 @@
-- Version.lua by EgalWare s.r.l. 2024/01/22
-- Gestione della versione dei file comuni post-processori macchine PF1250 e PF1500 di Essetre
local InfoCommon_STD_PP = {
NAME = 'Common_PF1250', -- nome script PP standard
VERSION = '2.6c2', -- versione script
MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel
}
return InfoCommon_STD_PP
+1 -1
View File
@@ -37,7 +37,7 @@ local WallData = {
-- Aggiornamento con dati da TechnoEssetre7
local sTs3Data = EgtGetStringFromIni( 'Wall', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-PF1250.data"
local sData = EgtGetSourceDir().."\\Ts3Data.lua"
local sData = EgtGetCurrMachineDir().."\\Wall\\Ts3Data.lua"
if EgtExistsFile( sTs3Data) then
EgtCopyFile( sTs3Data, sData)
local sTs3DataOld = sTs3Data..'.old'