From 87f7aad2f0f6869d647344efd5e06cf57e1a3aa0 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 12 Mar 2026 15:14:30 +0100 Subject: [PATCH] - Revert modifica fatta al ParkRoller - Ora calcola la lunghezza del pezzo sulla lavorazioen di precut con DELTA_LT --- Common_PF1250.TPA.mlpe | 18 ++++++++++++++++-- Common_PF1250.mlpe | 21 +++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Common_PF1250.TPA.mlpe b/Common_PF1250.TPA.mlpe index e6ede9e..cd939f1 100644 --- a/Common_PF1250.TPA.mlpe +++ b/Common_PF1250.TPA.mlpe @@ -358,6 +358,7 @@ function OnRawMoveData() EMT.HT = b3Part:getDimY() EMT.ST = b3Part:getDimZ() EMT.HOVM = EgtGetInfo( EMT.RAWID, 'HOVM', 'd') or 0 + EMT.XMINT = b3Part:getMin():getX() EMT.PARTTYPE = 0 local sMaterial = EgtGetInfo( PartId, 'MATERIAL') if sMaterial and sMaterial:find( 'CLT-', 1, true) == 1 then @@ -405,6 +406,7 @@ function OnMachiningStart() EMT.MCHNAME = EgtGetOperationName( EMT.MCHID) EMT.MCHTYPE = EgtGetMachiningParam( MCH_MP.TYPE) EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) + EMT.MCHPRECUT = ( EMT.MCHUSERNOTES:find( 'Precut;', 1, true) ~= nil) EMT.MCHCUT = ( EMT.MCHUSERNOTES:find( 'Cut;', 1, true) ~= nil) -- se sega a catena, aggiusto subito angolo scelto per asse virtuale A @@ -584,6 +586,15 @@ function OnPathStart() -- primo posizionamento sempre in globale EMT.REFLOC = nil EMT.IPLGL = false + + + -- se taglio di precut verifico quanto è più lungo il grezzo rispetto al pezzo (non tiene conto dell'ultimo cubetto) + EMT.DELTA_LT = 0 + if EMT.MCHPRECUT then + local dCosA = sqrt( max( 1 - EMT.EXTR[1] * EMT.EXTR[1], 0)) + EMT.DELTA_LT = max( EMT.XMINT - Point3d( EMT.MMAX):getX() - dCosA * EMT.TDIAM / 2, 0) + end + -- leggo se ancora presa iniziale carrello --EMT.CNT = EgtGetInfo( EMT.PATHID, 'CNT', 'i') --MyOutput( 'CNT='.. tostring( EMT.CNT or 0)) @@ -2231,6 +2242,9 @@ end --------------------------------------------------------------------- function GetV1ToCloseTPA() + if EMT.MCHPRECUT or EMT.MCHCUT then + return false + end local dMaxHeadPos = EMT.MAXMAX[1] + ( EMT.HOVM or 0) - ( EMT.X_OFF or 0) local dMinTailPos = EMT.MAXMIN[1] + EMT.LB + EgtIf( IsStartOrMidPhase( EMT.PHASE), 0, ( EMT.HOVM or 0)) - ( EMT.X_OFF or 0) --MyOutput( string.format( 'V1 MaxHeadPos=%.3f MinTailPos=%.3f BarLen=%.3f HeadOvm=%.3f V1NextPos=%.3f', dMaxHeadPos, dMinTailPos, EMT.LB, ( EMT.HOVM or 0), EMT.V1NEXTPOS)) @@ -2718,8 +2732,8 @@ function EmitParkRoller( dPosT, bSplitCut) local dPosY2 = dPosT + EMT.Y2DELTA local DiffY2 = MyParkY2 - dPosY2 local dMoveY2 = EgtIf( DiffY2 < -0.1, dMoveV2, 0) - local dTryMoveY2 = max( ParkV2 - dPosT - EMT.LB - EMT.HOVM, MinY2 - dPosY2 + 10) - if ( dPosT + EMT.LB + EMT.HOVM < ParkV1 + ExtraParkV and dPosT + EMT.LB + EMT.HOVM > ParkV2 and dPosY2 + dTryMoveY2 > MinY2) then dMoveY2 = min( dMoveY2, dTryMoveY2) end + local dTryMoveY2 = max( ParkV2 - dPosT - EMT.LT - EMT.DELTA_LT - EMT.HOVM, MinY2 - dPosY2 + 10) + if ( dPosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM < ParkV1 + ExtraParkV and dPosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM > ParkV2 and dPosY2 + dTryMoveY2 > MinY2) then dMoveY2 = min( dMoveY2, dTryMoveY2) end --MyOutput( string.format( 'PosT=%.3f LT=%.3f PosY2=%.3f V2POS=%.3f', dPosT, EMT.LT, dPosY2, EMT.V2POS)) MDChar.Y2 = dPosY2 + dMoveY2 MDChar.MovType = 2 diff --git a/Common_PF1250.mlpe b/Common_PF1250.mlpe index 951abfe..0ff263f 100644 --- a/Common_PF1250.mlpe +++ b/Common_PF1250.mlpe @@ -352,6 +352,10 @@ function OnSimulDispositionStart() EMT.LB = b3Bar:getDimX() EMT.LR = b3Raw:getDimX() EMT.LT = b3Part:getDimX() + if b3Part:getMin() then + EMT.XMINT = b3Part:getMin():getX() + ( EgtGetAxisPos( 'T') - EgtGetAxisHomePos( 'T')) + end + EMT.HOVM = EgtGetInfo( nPartRawId or GDB_ID.NULL, 'HOVM', 'd') or 0 EMT.CUTID = EgtGetInfo( EgtGetFirstPartInRawPart( nPartRawId or GDB_ID.NULL) or GDB_ID.NULL, 'CUTID', 'i') or 0 EMT.Y1SPEC = nil -- se vero inizio, assegno solidi per verifica collisione @@ -489,6 +493,7 @@ function OnSimulToolSelect( dPosA) if EMT.TOOL == '' then return end -- recupero dati utensile EMT.TOOLTYPE = EgtTdbGetCurrToolParam( MCH_TP.TYPE) + EMT.TDIAM = EgtTdbGetCurrToolParam( MCH_TP.DIAM) EMT.TLEN = EgtTdbGetCurrToolParam( MCH_TP.LEN) EMT.TTOTLEN = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) @@ -799,6 +804,8 @@ function OnSimulMachiningStart() EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' EMT.VMRS = ( EMT.MCHTYPE ~= MCH_MY.DRILLING and not EMT.MCHUSERNOTES:find( 'VMRS=0;', 1, true)) EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil) + EMT.MCHPRECUT = ( EMT.MCHUSERNOTES:find( 'Precut;', 1, true) ~= nil) + EMT.MCHCUT = ( EMT.MCHUSERNOTES:find( 'Cut;', 1, true) ~= nil) -- recupero TASKID e CUTID della feature lavorata (CUTID va recuperato qui per le pareti) local vId = EgtGetMachiningGeometry() if vId and #vId > 0 and #vId[1] > 0 then @@ -940,6 +947,13 @@ function OnSimulPathStart() if DumpCollisionObj then DumpCollisionObj( ' ==> CollisionObj :', 4) end + -- se taglio di precut verifico quanto è più lungo il grezzo rispetto al pezzo (non tiene conto dell'ultimo cubetto) + EMT.DELTA_LT = 0 + if EMT.MCHPRECUT then + local dCosA = sqrt( max( 1 - EMT.EXTR[1] * EMT.EXTR[1], 0)) + EMT.DELTA_LT = max( EMT.XMINT - Point3d( EMT.MMAX):getX() - dCosA * EMT.TDIAM / 2, 0) + EgtOutLog( 'PreCutDeltaLT='..EgtNumToString( EMT.DELTA_LT, 3), 5) + end end --------------------------------------------------------------------- @@ -2074,8 +2088,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 = max( ParkV2 - PosT - EMT.LB, MinY2 - PosY2 + 10) - if ( PosT + EMT.LB < ParkV1 + ExtraParkV and PosT + EMT.LB > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end + local TryMoveY2 = max( ParkV2 - PosT - EMT.LT - EMT.DELTA_LT - EMT.HOVM, MinY2 - PosY2 + 10) + if ( PosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM < ParkV1 + ExtraParkV and PosT + EMT.LT + EMT.DELTA_LT + EMT.HOVM > ParkV2 and PosY2 + TryMoveY2 > MinY2) then MoveY2 = min( MoveY2, TryMoveY2) end if not SimulMoveAxes( 'T', PosT + MoveY2, MCH_SIM_STEP.RAPID, 'V1', ParkV1, MCH_SIM_STEP.RAPID, 'V2', ParkV2, MCH_SIM_STEP.RAPID, @@ -2308,6 +2322,9 @@ end --------------------------------------------------------------------- function GetV1ToClose() + if EMT.MCHPRECUT or EMT.MCHCUT then + return false + end --EgtOutLog( string.format( 'L1m=%.3f L1M=%.3f V2NP=%.3f LB=%.3f', EMT.MAXMIN[1], EMT.MAXMAX[1], EMT.V2NEXTPOS, EMT.LB)) --EgtOutLog( string.format( '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)