-- Descrizione macchina Essetre-ONE by EgalTech s.r.l. 2024/02/07 -- 2021/05/18 ver 2.3e5 Prima versione (in comune con PF). -- 2021/09/02 ver 2.3h1 Diverse correzioni per gestione carrelli con rotazione pezzo. -- 2021/09/27 ver 2.3i2 Recupero modifiche PF1250. -- 2021/10/14 ver 2.3j3 Recupero modifiche PF1250 + gestione pezzi medio-alti. -- 2021/10/18 ver 2.3j6 Sistemata apertura rulli V2 (EJ=3) e V1. Modificato movimento testa/coda pezzo all'apertura pareti. -- 2021/10/27 ver 2.3j7 Correzioni per rotazioni e per deposito sega a catena. -- 2021/11/04 ver 2.3k1 Riportata da PF1250 correzione errore movimento carrelli in ParkRoller. -- 2021/12/03 ver 2.3l3 Correzione per emissione posizione V2 con grande sovramateriale di testa. Aggiunte per G157. -- 2021/12/20 ver 2.3l4 Allineamento con PF. -- 2022/02/18 ver 2.4b3 Allineamento con PFrl. -- 2022/02/21 ver 2.4b5 In generazione CN, con G157 gestione aperture prima di primo rapido e chiusure dopo. -- 2022/03/03 ver 2.4c1 In generazione CN, aggiornata chiusura rulli con G157 che non li fa muovere. -- 2022/03/04 ver 2.4c2 In generazione CN, aggiunta gestione movimento pinze rulli alla pre-rotazione. -- 2022/03/04 ver 2.4c3 In generazione CN, per EmitZmax in OnMachiningEnd aggiunta gestione posizione precedente carrelli. -- 2022/03/04 ver 2.4c5 In generazione CN, correzioni varie per rotazione pezzo. -- 2022/03/08 ver 2.4c6 Riportate ultime modifiche Sidler per rotazione pezzi. -- 2022/03/10 ver 2.4c7 In simulazione apertura paratie al carico sega a catena quando ONE vera, in generazione CN riportate modifiche da PFrl per primo rapido. -- 2022/03/22 Mettere Zmax -20. -- 2022/03/25 ver 2.4c8 Modificata generazione CN postrotazione con anche scambio carrelli. -- 2022/05/03 ver 2.4e1 Si aggiorna ParkX1 al variare degli estremi di X1. -- 2022/05/23 ver 2.4e2 In generazione CN, in OnLinear correzione impostazione EMT.L?o precedente in calcolo piano di interpolazione (non va tolto EMT.X_OFF). -- 2022/05/28 ver 2.4e3 In simulazione movimenti iniziali con sega a catena uniformati con generazione. -- 2022/10/24 ver 2.4j1 Correzione gestione Z di primo movimento di prima lavorazione come primo movimento di lavorazioni successive. -- 2022/11/10 ver 2.4k1 Riportate modifiche PF. -- 2023/02/18 ver 2.5b2 Riportato da PF gestione speciale movimento in rapido solo a inizio lavorazione (corr. #817). Aggiunto solido collisione per eventuale segacatena sotto trave. ------------------------------------- -- NOTE VERSIONI SUCCESSIVE IN GIT -- ------------------------------------- -- Intestazioni require( 'EmtGenerator') EgtEnableDebug( false) PP_VER = '3.1f3' PP_NVER = '3.1.6.3' MIN_MACH_VER = '2.5k1' MACH_NAME = EgtGetCurrMachineName() -- 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 più 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 = 'NUM' -- NUM o TPA o NUM_FLEX Progress = false Mortiser = false -- solo per One (nella Progress la stessa posizione è per ChainSaw) MinMchY1 = 335 MaxMchY1 = 5700.0 ParkMchY1 = 960.0 MinMchY2 = -5700.0 MaxMchY2 = -335 ParkMchY2 = -975.0 MinV1 = 20.0 MaxV1 = 682.0 ParkV1 = 670.0 MinV2 = -682.0 MaxV2 = -20.0 ParkV2 = -670.0 MinDeltaYV = 280 + 0.1 ExtraParkV = 600 MinY1 = MinV1 + MinDeltaYV MaxY1 = MaxMchY1 MaxY2 = MaxV2 - MinDeltaYV MinY2 = MinMchY2 ParkY1 = ParkV1 + MinDeltaYV ParkY2 = ParkV2 - MinDeltaYV MaxHoOpen = 420 MaxVeOpen = 820 RollCageMin = 120 RollCageMax = 250 Clamp5 = false MinW = 0 MaxW = 670 ParkW = 0 MinWOpen = 79 MaxWOpen = 200 MaxWHeight = 300 LoadT = 2131.2 UnloadT = -2400 MillOffs = 170.0 SawOffsX = 110.0 SawOffsY = 0 SawOffsZ = -149.5 SawC1Offs = 0 SawB1Offs = 0 ChSawLen = 94.0 MinX1 = 0 MaxX1 = 2735 MinZ1 = -1550 MaxZ1 = -20 -- per evitare problemi con striscia led MinC1 = -275 MaxC1 = 275 MinB1 = -127 MaxB1 = 127 MinB1b = -119 MaxB1b = 119 ParkX1 = MaxX1 ParkFrnX1 = 300 ParkZ1 = -535 ParkC1 = 90 ParkFrnC1 = -90 ParkB1 = 90 ParkFrnB1 = -90 LimX1RotSaw = 800 LimX1PlRotSaw = 1970 LimX1RotSawTC2 = 800 ParkCSawX1 = 1350 ParkCSawX1S = MinX1 ParkCSawZ1 = -50 ParkCSaw0Z1 = -400 ParkCSawC1 = 90 ParkCSaw0C1 = 0 ParkCSawB1 = 0 ParkLongToolB1 = 0 ParkLongToolC1 = 0 TurnerOffs = 50.0 AggLoad = 50 DeltaTabY = 1550.0 DeltaTabZ = -1060.0 -- per TPA la quota è dal centro di rotazione (va aggiunto MillOffs) DeltaRulliTraveZ = 980 DeltaRulliTappetoZ = -485 DimTabY = 500 DimTabX = 30000 AutomaticRotation = true AutoRotMinLen = 0 DefTcPos1 = 'T3' EstimationRapidMultiplier = 1 ForceToCloseRollersGate = false SecondToolChanger = false DistZClampToTable = 5 -- distanza tra la tavola e il punto più basso della morsa ClampingCoeffMin = nil -- coefficiente di fissaggio, se 0 o nil non fa controllo, per il momento da inizializzare da Ts3Data -- Aggiornamento con dati da TechnoEssetre7 local sTs3Data = EgtGetStringFromIni( 'Beam', 'DATA_DIR', "C:\\TechnoEssetre7\\EgtData", EgtGetIniFile()).."\\Essetre-ONE.data" local sData = sMachDir.."\\Beam\\Ts3Data.lua" if EgtExistsFile( sTs3Data) then EgtCopyFile( sTs3Data, sData) local sTs3DataOld = sTs3Data..'.old' EgtEraseFile( sTs3DataOld) EgtRenameFile( sTs3Data, sTs3DataOld) end if EgtExistsFile( sData) then local Machine = dofile( sData) if Machine then if Machine.Offsets then if Machine.Offsets.TIPO_CN == 0 then NumericalControl = 'NUM' elseif Machine.Offsets.TIPO_CN == 1 then NumericalControl = 'TPA' else NumericalControl = 'NUM_FLEX' end if Machine.Offsets.X1_POS then MinX1 = -Machine.Offsets.X1_POS end if Machine.Offsets.X1_NEG then MaxX1 = -Machine.Offsets.X1_NEG end if Machine.Offsets.PARK_X1POS then ParkFrnX1 = -Machine.Offsets.PARK_X1POS end if Machine.Offsets.PARK_X1NEG then ParkX1 = -Machine.Offsets.PARK_X1NEG end if Machine.Offsets.Z1_NEG then MinZ1 = Machine.Offsets.Z1_NEG end if Machine.Offsets.Z1_POS then MaxZ1 = min( MaxZ1, Machine.Offsets.Z1_POS) end if Machine.Offsets.PARK_Z1 then ParkZ1 = Machine.Offsets.PARK_Z1 end if Machine.Offsets.C1_NEG then MinC1 = Machine.Offsets.C1_NEG end if Machine.Offsets.C1_POS then MaxC1 = Machine.Offsets.C1_POS end if Machine.Offsets.B1_NEG then MinB1 = Machine.Offsets.B1_NEG end if Machine.Offsets.B1_POS then MaxB1 = Machine.Offsets.B1_POS end if Machine.Offsets.B1_NEG1 then MinB1b = Machine.Offsets.B1_NEG1 end if Machine.Offsets.B1_POS1 then MaxB1b = Machine.Offsets.B1_POS1 end if Machine.Offsets.MIN_Y1 then MinMchY1 = Machine.Offsets.MIN_Y1 end if Machine.Offsets.MAX_Y1 then MaxMchY1 = Machine.Offsets.MAX_Y1 end if Machine.Offsets.PARK_Y1 then ParkMchY1 = Machine.Offsets.PARK_Y1 end if Machine.Offsets.MIN_V1 then MinV1 = Machine.Offsets.MIN_V1 end if Machine.Offsets.MAX_V1 then MaxV1 = Machine.Offsets.MAX_V1 end if Machine.Offsets.MIN_Y2 then MinMchY2 = Machine.Offsets.MIN_Y2 end if Machine.Offsets.MAX_Y2 then MaxMchY2 = Machine.Offsets.MAX_Y2 end if Machine.Offsets.PARK_Y2 then ParkMchY2 = Machine.Offsets.PARK_Y2 end if Machine.Offsets.MIN_V2 then MinV2 = Machine.Offsets.MIN_V2 end if Machine.Offsets.MAX_V2 then MaxV2 = Machine.Offsets.MAX_V2 end if Machine.Offsets.CLAMP5 then Clamp5 = ( Machine.Offsets.CLAMP5 == 1) end if Machine.Offsets.MIN_W then MinW = Machine.Offsets.MIN_W end if Machine.Offsets.MAX_W then MaxW = Machine.Offsets.MAX_W end if Machine.Offsets.MINWOPEN then MinWOpen = Machine.Offsets.MINWOPEN end if Machine.Offsets.MAXWOPEN then MaxWOpen = Machine.Offsets.MAXWOPEN end if Machine.Offsets.MAXWHEIGHT then MaxWHeight = Machine.Offsets.MAXWHEIGHT end if Machine.Offsets.DIST_FTZERO then LoadT = Machine.Offsets.DIST_FTZERO end if Machine.Offsets.DELTA_CARICZERO then TurnerOffs = Machine.Offsets.DELTA_CARICZERO end if Machine.Offsets.MIN_DELTAVY then MinDeltaYV = Machine.Offsets.MIN_DELTAVY + 0.1 end 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.OFFSETCLAMAT1 then SawC1Offs= Machine.Offsets.OFFSETCLAMAT1 end if Machine.Offsets.OFFSETBLAMAT1 then SawB1Offs= Machine.Offsets.OFFSETBLAMAT1 end if Machine.Offsets.OFFSETXT1 then DeltaTabY = -Machine.Offsets.OFFSETXT1 end if Machine.Offsets.OFFSETZT1 then DeltaTabZ = Machine.Offsets.OFFSETZT1 + EgtIf( NumericalControl == 'TPA', MillOffs, 0) end if Machine.Offsets.OFFSETZSOTTOTRAVE then DeltaRulliTraveZ = abs( Machine.Offsets.OFFSETZSOTTOTRAVE) end if Machine.Offsets.OFFSETZTAPPETO then DeltaRulliTappetoZ = -abs( Machine.Offsets.OFFSETZTAPPETO) end if Machine.Offsets.RIB_AUTO then AutomaticRotation = ( Machine.Offsets.RIB_AUTO == 1) end if Machine.Offsets.PROGRESS then Progress = ( Machine.Offsets.PROGRESS == 1) end if Machine.Offsets.MORTISER then Mortiser = ( Machine.Offsets.MORTISER == 1) end if Machine.Offsets.SAWOFFSX then SawOffsX = Machine.Offsets.SAWOFFSX end if Machine.Offsets.SAWOFFSZ then SawOffsZ = Machine.Offsets.SAWOFFSZ end if Machine.Offsets.DEFTCPOS1 then DefTcPos1 = ( 'T' .. Machine.Offsets.DEFTCPOS1) end if Machine.Offsets.NOULOAD then MaxUnloadLen = Machine.Offsets.NOULOAD end if Machine.Offsets.MAXFEEDPINZE then MaxFeedPinze = Machine.Offsets.MAXFEEDPINZE end if Machine.Offsets.MAXACC then MaxAcc = Machine.Offsets.MAXACC end if Machine.Offsets.MINACC then MinAcc = Machine.Offsets.MINACC end if Machine.Offsets.COEFF_STIMATEMPI and Machine.Offsets.COEFF_STIMATEMPI > 0 then EstimationRapidMultiplier = Machine.Offsets.COEFF_STIMATEMPI end if Machine.Offsets.CHIUDI_PINZE_2_3_SCAMBIO then ForceToCloseRollersGate = Machine.Offsets.CHIUDI_PINZE_2_3_SCAMBIO == 1 end if Machine.Offsets.WOOD_DENSITY then WoodDensity = Machine.Offsets.WOOD_DENSITY end if Machine.Offsets.MAX_BACK_CLAMP_5 then MaxBackClamp5 = Machine.Offsets.MAX_BACK_CLAMP_5 end if Machine.Offsets.SEC_TC then SecondToolChanger = ( Machine.Offsets.SEC_TC == 1) end if Machine.Offsets.COEFF_CLAMP_CHECK then ClampingCoeffMin = Machine.Offsets.COEFF_CLAMP_CHECK end -- aggiustamenti MinY1 = MinV1 + MinDeltaYV MaxY1 = MaxMchY1 ParkV1 = MaxV1 ParkY1 = ParkV1 + MinDeltaYV MinY2 = MinMchY2 MaxY2 = MaxV2 - MinDeltaYV ParkV2 = MinV2 ParkY2 = ParkV2 - MinDeltaYV ParkX1 = min( ParkX1, MaxX1) ParkFrnX1 = max( ParkFrnX1, MinX1) ParkCSawZ1 = min( ParkCSawZ1, MaxZ1) ParkCSaw0Z1 = min( ParkCSaw0Z1, MaxZ1) Mortiser = ( Mortiser and not Progress) SecondToolChanger = ( SecondToolChanger and not Progress) end end end EmtGeneral { File='Essetre-ONE.nge', Offset = Vector3d(0.0,1360.0,-1730.0), AxisMaxAdjust = 300, AxisMaxRotAdj = 0.5, ExitMaxAdjust = 300, ExitMaxRotAdj = 0.5, AngDeltaMinForHome = 80, Special = 'Common_ONE-PF.mlse', Processor = 'Common_ONE-PF.mlpe'} local sBaseAux = {'BASE/SOLID', 'BASE/SIGN', 'BASE/CONVOYER', 'BASE/BELT', 'BASE/COLLISION', 'BASE/TC1'} if Progress then table.insert( sBaseAux, 'BASE/TC1S') table.insert( sBaseAux, 'BASE/TC2') table.insert( sBaseAux, 'BASE/TC3') elseif SecondToolChanger then table.insert( sBaseAux, 'BASE/TC2') table.insert( sBaseAux, 'BASE/TC2S') table.insert( sBaseAux, 'BASE/TC3') else table.insert( sBaseAux, 'BASE/MTC') if Mortiser then table.insert( sBaseAux, 'BASE/TC3') end end local BaseId = EmtBase { Name = 'Base', Geo = 'BASE/GEO', Aux = sBaseAux} local X1Id = EmtAxis { Name = 'X1', Parent = 'Base', Token = 'X', Type = MCH_AT.LINEAR, Dir = Y_AX(), Pos = Point3d(207.0,-300.0,104.0), Stroke = {MinX1, MaxX1}, Home = ParkX1, Invert = true, Geo = 'X1_AXIS/GEO', Aux = {'X1_AXIS/SOLID', 'X1_AXIS/COLLISION'}} -- *** Testa 1 *** EmtAxis { Name = 'Z1', Parent = 'X1', Token = 'Z', Type = MCH_AT.LINEAR, Dir = Z_AX(), Pos = Point3d(0.0,-140.1,113.0), Stroke = {MinZ1, MaxZ1}, Home = ParkZ1, Geo = 'Z1_AXIS/GEO', Aux = {'Z1_AXIS/SOLID', 'Z1_AXIS/COLLISION'}} EmtAxis { Name = 'C1', Parent = 'Z1', Token = 'C', Type = MCH_AT.ROTARY, Dir = Z_AX(), Pos = Point3d(0.0,0.0,503.0), Stroke = {MinC1, MaxC1}, Home = ParkC1, Geo = 'C1_AXIS/GEO', Aux = {'C1_AXIS/SOLID', 'C1_AXIS/COLLISION'}} EmtAxis { Name = 'B1', Parent = 'C1', Token = 'B', Type = MCH_AT.ROTARY, Dir = X_AX(), Pos = Point3d(-108.4,0.0,MillOffs), Stroke = {MinB1, MaxB1}, Home = ParkB1, Geo = 'B1_AXIS/GEO', Aux = {'B1_AXIS/SOLID', 'B1_AXIS/COLLISION'}} -- Frese local H11Id = EmtHead { Name = 'H11', 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 = 'H11_HEAD/GEO'} -- Lama local H12Id = EmtHead { Name = 'H12', Parent = 'B1', HSet = 'H11', Type = MCH_HT.STD, Pos = Point3d(SawOffsX,SawOffsY,SawOffsZ), TDir = Vector3d( 0, sin( SawB1Offs), cos( SawB1Offs)), ADir = -X_AX(), Rot1W = 0.5, Rot2Stroke = { MinB1b, MaxB1b}, OthColl = {'B1/SOLID', 'C1/SOLID'}, Geo = 'H12_HEAD/GEO'} --EgtSetInfo( H12Id, 'ZMAXONROT', '1,190') -- Sega a catena EmtAxis { Name = 'A', Parent = 'B1', Token = '**', Type = MCH_AT.ROTARY, Dir = Z_AX(), Pos = Point3d( 0, 0, 0), Stroke = { -90.1, 90.1}, Home = 0, Geo = 'A1_AXIS/GEO'} local H13Id if Progress or SecondToolChanger then H13Id = EmtHead { Name = 'H13', Parent = 'A', HSet = 'H11', Type = MCH_HT.STD, Pos = Point3d( 0, 0, -ChSawLen), TDir = -X_AX(), ADir = Z_AX(), Rot1W = 0.2, Rot2Stroke = { -90.1, 90.1}, SolCh = MCH_SCC.ADIR_NEAR, OthColl = {'B1/SOLID', 'C1/SOLID'}, Geo = 'H15_HEAD/GEO'} else H13Id = EmtHead { Name = 'H13', Parent = 'A', HSet = 'H11', Type = MCH_HT.STD, Pos = Point3d( 0, 0, -ChSawLen), TDir = X_AX(), ADir = Z_AX(), Rot1W = 0.2, Rot2Stroke = { -90.1, 90.1}, SolCh = MCH_SCC.ADIR_NEAR, OthColl = {'B1/SOLID', 'C1/SOLID'}, Geo = 'H13_HEAD/GEO'} end EgtSetInfo( H13Id, 'ZSAFEDELTA', '60') EgtSetInfo( H13Id, 'ZMAXONROT', '1,80') -- Mortasatrice sotto la traversa (solo per One base con un solo cambio utensile) local H15Id if not Progress and Mortiser and not SecondToolChanger then H15Id = EmtHead { Name = 'H15', Parent = 'A', HSet = 'H11', Type = MCH_HT.STD, Pos = Point3d( 0, 0, -ChSawLen), TDir = -X_AX(), ADir = Z_AX(), Rot1W = 0.2, Rot2Stroke = { -90.1, 90.1}, SolCh = MCH_SCC.ADIR_NEAR, OthColl = {'B1/SOLID', 'C1/SOLID'}, Geo = 'H15_HEAD/GEO'} EgtSetInfo( H15Id, 'ZSAFEDELTA', '60') EgtSetInfo( H15Id, 'ZMAXONROT', '1,80') end -- *** Carrelli *** -- Morse local Y1Id = EmtAxis { Name = 'Y1', Parent = 'Base', Type = MCH_AT.LINEAR, Dir = -X_AX(), Pos = Point3d(-865.7,2626.8,-866.0), Stroke = { MinY1, MaxY1}, Home = ParkY1, Geo = 'Y1_AXIS/GEO', Aux = 'Y1_AXIS/SOLID'} local PY1Id = EmtAxis { Name = 'PY1', Parent = 'Y1', Type = MCH_AT.LINEAR, Dir = -Y_AX(), Pos = Point3d(-469.6,2367.5,-751.6), Stroke = {0, MaxHoOpen}, Home = MaxHoOpen, Geo = 'PY1_AXIS/GEO', Aux = {'PY1_AXIS/SOLID', 'PY1_AXIS/CLAMP_CHECK'}} local Y2Id = EmtAxis { Name = 'Y2', Parent = 'Base', Type = MCH_AT.LINEAR, Dir = -X_AX(), Pos = Point3d(865.7,2626.8,-866.0), Stroke = { MinY2, MaxY2}, Home = ParkY2, Geo = 'Y2_AXIS/GEO', Aux = 'Y2_AXIS/SOLID'} local PY2Id = EmtAxis { Name = 'PY2', Parent = 'Y2', Type = MCH_AT.LINEAR, Dir = -Y_AX(), Pos = Point3d(469.6,2367.5,-751.6), Stroke = {0, MaxHoOpen}, Home = MaxHoOpen, Geo = 'PY2_AXIS/GEO', Aux = {'PY2_AXIS/SOLID', 'PY2_AXIS/CLAMP_CHECK'}} -- Rulli local V1Id = EmtAxis { Name = 'V1', Parent = 'Base', Type = MCH_AT.LINEAR, Dir = -X_AX(), Pos = Point3d(-875.5,1072.0,-1509.1), Stroke = { MinV1, MaxV1}, Home = ParkV1, Geo = 'V1_AXIS/GEO', Aux = {'V1_AXIS/SOLID', 'V1_AXIS/COLLISION'}} local PV1Id = EmtAxis { Name = 'PV1', Parent = 'V1', Type = MCH_AT.LINEAR, Dir = -Y_AX(), Pos = Point3d(-194.0,2364.7,-879.1), Stroke = {0, MaxHoOpen}, Home = MaxHoOpen, Geo = 'PV1_AXIS/GEO', Aux = 'PV1_AXIS/SOLID'} local QV1Id = EmtAxis { Name = 'QV1', Parent = 'V1', Type = MCH_AT.LINEAR, Dir = Z_AX(), Pos = Point3d(-287.0,2481.0,-943.0), Stroke = {0, MaxVeOpen}, Home = MaxVeOpen, Geo = 'QV1_AXIS/GEO', Aux = 'QV1_AXIS/SOLID'} local V2Id = EmtAxis { Name = 'V2', Parent = 'Base', Type = MCH_AT.LINEAR, Dir = -X_AX(), Pos = Point3d(875.5,1072.0,-1509.1), Stroke = { MinV2, MaxV2}, Home = ParkV2, Geo = 'V2_AXIS/GEO', Aux = {'V2_AXIS/SOLID', EgtIf( Clamp5, 'V2_AXIS/AUX5', 'V2_AXIS/AUX'), 'V2_AXIS/COLLISION'}} local PV2Id = EmtAxis { Name = 'PV2', Parent = 'V2', Type = MCH_AT.LINEAR, Dir = -Y_AX(), Pos = Point3d(194.0,2364.7,-879.1), Stroke = {0, MaxHoOpen}, Home = MaxHoOpen, Geo = 'PV2_AXIS/GEO', Aux = 'PV2_AXIS/SOLID'} local QV2Id = EmtAxis { Name = 'QV2', Parent = 'V2', Type = MCH_AT.LINEAR, Dir = Z_AX(), Pos = Point3d(287.0,2481.0,-943.0), Stroke = {0, MaxVeOpen}, Home = MaxVeOpen, Geo = 'QV2_AXIS/GEO', Aux = 'QV2_AXIS/SOLID'} local WId, PWId, QWId if Clamp5 then WId = EmtAxis { Name = 'W', Parent = 'V2', Type = MCH_AT.LINEAR, Dir = -X_AX(), Pos = Point3d(875.5,1072.0,-1509.1), Stroke = { MinW, MaxW}, Home = ParkW, Geo = 'W_AXIS/GEO', Aux = { 'W_AXIS/SOLID', 'W_AXIS/COLLISION'}} PWId = EmtAxis { Name = 'PW', Parent = 'W', Type = MCH_AT.LINEAR, Dir = -Y_AX(), Pos = Point3d(194.0,2364.7,-879.1), Stroke = {MinWOpen, MaxWOpen}, Home = MaxWOpen, Geo = 'PW_AXIS/GEO', Aux = 'PW_AXIS/SOLID'} QWId = EmtAxis { Name = 'QW', Parent = 'PW', Type = MCH_AT.LINEAR, Dir = Z_AX(), Pos = Point3d(194.0,2364.7,-879.1), Stroke = {0, 30}, Home = 0, Geo = 'QW_AXIS/GEO', Aux = { 'QW_AXIS/SOLID', 'QW_AXIS/COLLISION'}} end -- *** Tavola *** EmtAxis { Name = 'T', Parent = 'Base', --Token = '**', Type = MCH_AT.LINEAR, Dir = - X_AX(), Pos = Point3d(0.0,2450.0,-958.0), Stroke = {-30000, 30000}, Home = LoadT, Geo = 'T_AXIS/GEO'} EmtTable { Name = 'Tab', Parent = 'T', Type = MCH_TT.FLAT, Ref1 = Point3d( - DimTabX, DeltaTabY - DimTabY, DeltaTabZ), Coll = 'Base/BELT', Geo = 'TABLE/GEO', Aux = 'TABLE/SOLID'} -- *** ToolChanger *** local ptTc1 = Point3d( 150, 2914, -217 + ( DeltaTabZ + DeltaRulliTraveZ + 29)) local vtDt1 = Vector3d( 0, 0, - 102.5) if Progress then EmtTcPos { Name = 'T1', Parent = 'Base', Pos = ptTc1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T1b'} EmtTcPos { Name = 'T2', Parent = 'Base', Pos = ptTc1 + 1 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T2'} else EmtTcPos { Name = 'T1', Parent = 'Base', Pos = ptTc1 + Vector3d( SawOffsX, -SawOffsZ, 0), TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T1'} end EmtTcPos { Name = 'T3', Parent = 'Base', Pos = ptTc1 + 2 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T3'} EmtTcPos { Name = 'T4', Parent = 'Base', Pos = ptTc1 + 3 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T4'} EmtTcPos { Name = 'T5', Parent = 'Base', Pos = ptTc1 + 4 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T5'} EmtTcPos { Name = 'T6', Parent = 'Base', Pos = ptTc1 + 5 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T6'} EmtTcPos { Name = 'T7', Parent = 'Base', Pos = ptTc1 + 6 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T7'} EmtTcPos { Name = 'T8', Parent = 'Base', Pos = ptTc1 + 7 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T8'} EmtTcPos { Name = 'T9', Parent = 'Base', Pos = ptTc1 + 8 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T9'} EmtTcPos { Name = 'T10', Parent = 'Base', Pos = ptTc1 + 9 * vtDt1, TDir = -Y_AX(), ADir = -X_AX(), Geo = 'BASE/T10'} if Progress or SecondToolChanger then local ptTc2 = Point3d( 150, -170, -217 + ( DeltaTabZ + DeltaRulliTraveZ + 29)) local vtDt2 = Vector3d( 0, 0, - 102.5) if SecondToolChanger then EmtTcPos { Name = 'T11', Parent = 'Base', Pos = ptTc2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T11b'} EmtTcPos { Name = 'T12', Parent = 'Base', Pos = ptTc2 + 1 * vtDt1, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T12'} else EmtTcPos { Name = 'T11', Parent = 'Base', Pos = ptTc2 + Vector3d( SawOffsX, SawOffsZ, 0), TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T11'} end EmtTcPos { Name = 'T13', Parent = 'Base', Pos = ptTc2 + 2 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T13'} EmtTcPos { Name = 'T14', Parent = 'Base', Pos = ptTc2 + 3 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T14'} EmtTcPos { Name = 'T15', Parent = 'Base', Pos = ptTc2 + 4 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T15'} EmtTcPos { Name = 'T16', Parent = 'Base', Pos = ptTc2 + 5 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T16'} EmtTcPos { Name = 'T17', Parent = 'Base', Pos = ptTc2 + 6 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T17'} EmtTcPos { Name = 'T18', Parent = 'Base', Pos = ptTc2 + 7 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T18'} EmtTcPos { Name = 'T19', Parent = 'Base', Pos = ptTc2 + 8 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T19'} EmtTcPos { Name = 'T20', Parent = 'Base', Pos = ptTc2 + 9 * vtDt2, TDir = Y_AX(), ADir = -X_AX(), Geo = 'BASE/T20'} else local ptTc2a = Point3d( 0.5, 19.7, -216.5 + ( DeltaTabZ + DeltaRulliTraveZ + 29)) local ptTc2b = Point3d( 0.5, 199.7, -364.0 + ( DeltaTabZ + DeltaRulliTraveZ + 29)) EmtTcPos { Name = 'T101', Parent = 'Base', Pos = ptTc2a, TDir = X_AX(), ADir = Z_AX(), Geo = 'BASE/T101'} EmtTcPos { Name = 'T201', Parent = 'Base', Pos = ptTc2b, TDir = Z_AX(), ADir = X_AX(), Geo = 'BASE/T201'} end if Progress or Mortiser or SecondToolChanger then local ptTc3 = Point3d( 480, 506.1, -200.8 + ( DeltaTabZ + DeltaRulliTraveZ + 29)) local sName = EgtIf( Progress or SecondToolChanger, 'T101', 'T301') EmtTcPos { Name = sName, Parent = 'Base', Pos = ptTc3, TDir = -X_AX(), ADir = Z_AX(), Geo = 'BASE/T301'} end -- Aggiusto posizioni geometriche local vtMovB = Vector3d( 0, 0, ( DeltaTabZ + DeltaRulliTraveZ + 80)) -- -( -1060 + 980) EgtMove( EgtGetFirstNameInGroup( BaseId, 'SOLID'), vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( BaseId, 'COLLISION'), vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( BaseId, 'SIGN') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC1') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( BaseId, 'TC1S') 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, 'MTC') or GDB_ID.NULL, vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( X1Id, 'SOLID'), vtMovB, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( X1Id, 'COLLISION'), vtMovB, GDB_RT.GLOB) local vtMovC = Vector3d( 0, 0, ( DeltaTabZ + DeltaRulliTappetoZ + 1545)) -- -( -1060 - 485) EgtMove( EgtGetFirstNameInGroup( BaseId, 'BELT'), vtMovC, GDB_RT.GLOB) local vtMove = Vector3d( 0, ( DeltaTabY - 1550.0), ( DeltaTabZ + 1060.0)) EgtMove( EgtGetFirstNameInGroup( BaseId, 'CONVOYER'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( Y1Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PY1Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PY1Id, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( Y2Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PY2Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PY2Id, 'CLAMP_CHECK'), vtMove + Vector3d(0,0,DistZClampToTable), GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( V1Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PV1Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( QV1Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( V2Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( V2Id, EgtIf( Clamp5, 'AUX5', 'AUX')), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PV2Id, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( QV2Id, 'SOLID'), vtMove, GDB_RT.GLOB) if Clamp5 then EgtMove( EgtGetFirstNameInGroup( WId, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( WId, 'COLLISION'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( PWId, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( QWId, 'SOLID'), vtMove, GDB_RT.GLOB) EgtMove( EgtGetFirstNameInGroup( QWId, 'COLLISION'), vtMove, GDB_RT.GLOB) end -- Assegno identificativi alle spie delle morse PY1LightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PY1Id, 'SOLID') or GDB_ID.NULL, 'Light') PY2LightId = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PY2Id, 'SOLID') or GDB_ID.NULL, 'Light') --------------------------------------------------------------------- -- Funzioni richiamate per modificare i dati macchina in casi particolari --function OnSetTable() --end --------------------------------------------------------------------- function OnSetHead() -- se testa H11 (fresa) o H12 (lama) if EMC.HEAD == 'H11' or EMC.HEAD == 'H12' then if EMC.HEAD == 'H11' then local dRawH = GetRawHeight() EmtModifyAxisHome( 'Z1', ParkZ1 + EgtIf( dRawH > 650, EgtIf( EMC.TOTDIAM < 61, 235, 165), 0)) EmtModifyAxisDirection( 'B1', X_AX()) else EmtModifyAxisHome( 'Z1', ParkZ1) EmtModifyAxisDirection( 'B1', Vector3d( cos( SawC1Offs), -sin( SawC1Offs), 0)) end local nPos = tonumber( string.sub( EMC.TCPOS, 2)) or 0 if nPos <= 10 then EmtModifyAxisHome( 'X1', ParkX1) EmtModifyAxisHome( 'C1', ParkC1) EmtModifyAxisHome( 'B1', ParkB1) else local MyHomeB1, MyHomeC1 -- se cambio utensile verticale if EgtGetHeadId( 'H21') or Progress or SecondToolChanger then MyHomeB1 = ParkFrnB1 MyHomeC1 = ParkFrnC1 -- altrimenti su one CU speciale motosega-utensile lungo else MyHomeB1 = ParkLongToolB1 MyHomeC1 = ParkLongToolC1 end EmtModifyAxisHome( 'X1', ParkFrnX1) EmtModifyAxisHome( 'C1', MyHomeC1) EmtModifyAxisHome( 'B1', MyHomeB1) end -- se testa H13 (sega a catena) 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) local CSawPosA = tonumber( sVal:sub( 3) or '') EmtModifyAxisHome( 'X1', ParkCSawX1) EmtModifyAxisHome( 'Z1', GetChainSawZHomeFromVirtualAxis( CSawPosA)) EmtModifyAxisHome( 'C1', GetChainSawCHomeFromVirtualAxis( CSawPosA)) EmtModifyAxisHome( 'B1', ParkCSawB1) EmtModifyAxisDirection( 'B1', X_AX()) -- se testa H15 (mortasatrice di One) elseif EMC.HEAD == 'H15' then error( 'Error : Mortiser not yet managed') end end --------------------------------------------------------------------- -------------------------- Testa utilizzata ------------------------- function GetHeadSet( sHead) if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' or sHead == 'H17' then return 1 elseif sHead == 'H19' then return 11 elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then return 2 elseif sHead == 'H29' then return 21 else return 0 end end --------------------------------------------------------------------- ---------------------------- Cambio Utensile ------------------------ function GetHeadTCSet( sHead, sTcPos) local nPos = tonumber( string.sub( sTcPos, 2)) or 0 -- testa 1 if sHead == 'H11' or sHead == 'H12' or sHead == 'H13' or sHead == 'H15' then -- testa 1 su CU prossimo a testa 2 if nPos > 10 then return 'Head1_TC2' -- testa 1 su CU prossimo a testa 1 else return 'Head1_TC1' end -- testa 2 su CU prossimo a testa 2 elseif sHead == 'H21' or sHead == 'H22' or sHead == 'H23' then return 'Head2_TC2' -- testa 2 su CU prossimo a testa 1 (non esiste una condfigurazione fatta in questo modo) elseif nPos < 10 then return 'Head2_TC1' else return 0 end end --------------------------------------------------------------------- -- Funzione che restituisce l'altezza del pezzo in lavorazione function GetRawHeight() local nRawId = EgtGetFirstRawPart() if not nRawId then local vLnkRawId = EmtGetAllLinkedRawParts() if vLnkRawId and #vLnkRawId >0 then nRawId = vLnkRawId[1] end end local b3Raw = EgtGetRawPartBBox( nRawId or GDB_ID.NULL) if not b3Raw or b3Raw:isEmpty() then return 0 end return b3Raw:getDimZ() end --------------------------------------------------------------------- -- Funzione che riconosce testa per sega a catena function HeadIsChainSaw( sHead) return ( sHead == 'H13' or sHead == 'H15') end --------------------------------------------------------------------- -- Funzione che riconosce testa per tastatore function HeadIsProbe( sHead) return ( sHead == 'H19' or sHead == 'H29') end --------------------------------------------------------------------- -- Funzione che calcola la posizione Home di Z per la sega a catena dal valore dell'asse virtuale function GetChainSawZHomeFromVirtualAxis( dPosA) -- se A=0 -> T101 -> HomeZ = -400 if abs( dPosA) < 0.1 then return ParkCSaw0Z1 -- altrimenti A=-90 -> T102 o A=90 -> T104 -> HomeZ = -100 else return ParkCSawZ1 end 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 if abs( dPosA) < 0.1 then return ParkCSaw0C1 -- altrimenti A=-90 -> T102 -> HomeC = 90 elseif abs( dPosA + 90) < 0.1 then return 90 -- altrimenti A=90 -> T104 -> HomeC = -90 elseif abs( dPosA - 90) < 0.1 then return -90 end end --------------------------------------------------------------------- -- Funzione che ritorna ZExtra partendo dalla testa e dall'angolo verticale function GetZExtra( sHead, dAngV) if sHead == 'H11' then if abs( dAngV) < 30.1 then return 400 elseif abs( dAngV) < 45.1 then return 300 elseif abs( dAngV) < 60.1 then return 200 elseif abs( dAngV) < 90.1 then return 1 else return 0 end elseif sHead == 'H12' then if abs( dAngV) < 30.1 then return 400 elseif abs( dAngV) < 45.1 then return 300 elseif abs( dAngV) < 60.1 then return 200 elseif abs( dAngV) < 90.1 then return 1 elseif abs( dAngV) < 120 then return -100 else return 0 end end end --------------------------------------------------------------------- -- Funzione per impostare spia stato morsa carrello Y1 function SetPY1Light( bClosed) if not PY1LightId then return end EgtSetColor( PY1LightId, EgtIf( bClosed, 'RED', 'LIME')) if bClosed then EgtSetInfo( PY1LightId, 'On', '1') else EgtRemoveInfo( PY1LightId, 'On') end end --------------------------------------------------------------------- -- Funzione per leggere lo stato della morsa carrello Y1 function GetPY1Light() if not PY1LightId then return false end return ( EgtGetInfo( PY1LightId, 'On') == '1') end --------------------------------------------------------------------- -- Funzione per impostare spia stato morsa carrello Y2 function SetPY2Light( bClosed) if not PY2LightId then return end EgtSetColor( PY2LightId, EgtIf( bClosed, 'RED', 'LIME')) if bClosed then EgtSetInfo( PY2LightId, 'On', '1') else EgtRemoveInfo( PY2LightId, 'On') end end --------------------------------------------------------------------- -- Funzione per leggere lo stato della morsa carrello Y2 function GetPY2Light() if not PY2LightId then return false end return ( EgtGetInfo( PY2LightId, 'On') == '1') end --------------------------------------------------------------------- -- Funzione per resettare tutte le attivazioni della macchina function OnResetMachine() EmtUnlinkAllRawPartsFromGroups() EmtUnlinkAllFixturesFromGroups() SetPY1Light( false) SetPY2Light( false) -- nascondo Vmill local nRawId = EgtGetFirstRawPart() while nRawId do local nVmId = EgtGetFirstNameInGroup( nRawId, 'VMill') local nId = EgtGetFirstInGroup( nRawId) while nId do EgtSetStatus( nId, EgtIf( nId ~= nVmId, GDB_ST.ON, GDB_ST.OFF)) nId = EgtGetNext( nId) end nRawId = EgtGetNextRawPart( nRawId) end EgtSetStatus( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'VMill') or GDB_ID.NULL, GDB_ST.OFF) end