From 0deff05bad89ec2920c87f1b5ba3c744f53651ec Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 19 Jan 2024 08:19:09 +0100 Subject: [PATCH] Versione stabile 2.6a2 --- Common-PF1250.TPA.mlpe | 111 ++++++++++++++++++++++++++++++++++------- Common-PF1250.mlse | 46 +---------------- UpdateLog.txt | 5 +- 3 files changed, 97 insertions(+), 65 deletions(-) diff --git a/Common-PF1250.TPA.mlpe b/Common-PF1250.TPA.mlpe index aaab63b..5222da6 100644 --- a/Common-PF1250.TPA.mlpe +++ b/Common-PF1250.TPA.mlpe @@ -1183,7 +1183,12 @@ function OnRapid() local sAxes = EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. EmtGetAxis('R2')..EmtGetAxis('R1') if #sAxes > 0 then - MyOutput( 'G0' .. sAxes) + if EmitRapidInG0 then + MyOutput( 'G0' .. sAxes) + else + local sFeed = ' F30000' + MyOutput( 'G1' .. sAxes .. sFeed) + end end -- se altrimenti risalita a Z max a fine lavorazione elseif EMT.FLAG == 3 then @@ -1241,8 +1246,15 @@ function OnLinear() -- emissione movimento EMT.R1p = nil EMT.R2p = nil - sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. - EmtGetAxis('R2')..EmtGetAxis('R1') + if EmitRapidInG0 then + sOut = 'G0'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1') + else + local sFeed = ' F30000' + sOut = 'G1'..EmtGetAxis('L1')..EmtGetAxis('L2')..EmtGetAxis('L3').. + EmtGetAxis('R2')..EmtGetAxis('R1')..sFeed + end + MyOutput( sOut) -- aggiorno precedenti EMT.MOVE = 0 @@ -2387,27 +2399,94 @@ end --------------------------------------------------------------------- function PreselectNextDiffHead( nMchId, sHead) - -- se in uso testa 1, verifico di non scendere troppo in Z per evitare collisioni (per testa 3 non serve il controllo) - 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) - if nNextHSet ~= nHSet and nNextHSet ~= 3 and ( nHSet ~= 3 or nNextHSet ~= 1) then + -- 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) @@ -2417,7 +2496,7 @@ function PreselectNextDiffHead( nMchId, sHead) 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( nTc ~= 2, ParkLongTc1C1, ParkLongTc2C1), TPos=AdjustTcPos( false, sNextTcPos), Fmt=2}) + 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 @@ -2432,13 +2511,7 @@ function PreselectNextDiffHead( nMchId, sHead) 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 diff --git a/Common-PF1250.mlse b/Common-PF1250.mlse index a59bded..3c802f5 100644 --- a/Common-PF1250.mlse +++ b/Common-PF1250.mlse @@ -253,49 +253,6 @@ local function GetNextStartOrRestPhase( nPhase) return nNextPhase end ---------------------------------------------------------------------- -function GetPhaseRot( nPhase) - return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'ROT', 'i') or 0) -end - ---------------------------------------------------------------------- -local function IsLastMachiningBeforeRotation( nMchId) - -- se ultima fase, ritorno risultato negativo - if EMC.PHASE == EgtGetPhaseCount() then - return false - end - -- recupero la successiva operazione attiva - local nNextOperId = EgtGetNextActiveOperation( nMchId) - -- se non esiste o non è una disposizione, ritorno risultato negativo - if not nNextOperId or EgtGetOperationType( nNextOperId) ~= MCH_OY.DISP then - return false - end - -- recupero le rotazioni della fase corrente e della prossima fase - local nRot = GetPhaseRot( EMC.PHASE) - local nNextRot = GetPhaseRot( EMC.PHASE + 1) - -- ritorno se sono diverse - return ( nRot ~= nNextRot) -end - ---------------------------------------------------------------------- -local function IsFirstMachiningAfterRotation( nMchId) - -- se prima fase, ritorno risultato negativo - if EMC.PHASE == 1 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 - -- recupero le rotazioni della fase corrente e della fase precedente - local nRot = GetPhaseRot( EMC.PHASE) - local nPrevRot = GetPhaseRot( EMC.PHASE - 1) - -- ritorno se sono diverse - return ( nRot ~= nPrevRot) -end - --------------------------------------------------------------------- local function UpdateMinJoin() MinJoin = BD.GetMinJoin( EMC.SB, EMC.HB, EMC.LB) @@ -545,7 +502,7 @@ function OnPostApplyMachining() return -- se precedente operazione è disposizione elseif EgtGetOperationType( nPrevOpeId) == MCH_OY.DISP then - if EMC.PHASE == 1 or ( IsMidPhase( EMC.PHASE) and IsFirstMachiningAfterRotation( EMC.MCHID)) then + if EMC.PHASE == 1 then -- posizioni home EMC.TPOS = nil EMC.Y1DELTA = nil @@ -766,7 +723,6 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload) -- Se inizio o appena dopo rotazione, eseguo il carico if not EMC.TPOS then local dPosT = LoadT - if IsFirstMachiningAfterRotation( EMC.MCHID) then dPosT = dPosT + TurnerOffs end local vCmd = SpecCalcLoad( dPosT, dDistFront, max( dDistBack, MinJoin, EMC.LB - ( MaxY1 - MinY1) + 6)) EMC.LOAD = true local vCmd2 = SpecCalcCarriages( dDistFront, dDistBack, dRollFront, dRollBack, dY1DeltaMaxSP, dY2DeltaMinUL, nChar) diff --git a/UpdateLog.txt b/UpdateLog.txt index 112cd1b..fd3d3a6 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -7,6 +7,9 @@ Versione 2.6a1 (09/01/2024) - (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 -Versione 2.6a2 (09/01/2024) +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