diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index ac95151..8ec7293 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -150,7 +150,7 @@ local Q_MAX_ELEVATION = '' -- d local Q_SAW_PLUS_CHAIN = '' -- i local Q_FORCE_CHAINSAW = '' -- i local Q_CHAINSAW_FROM_SIDE = '' -- i -local Q_MILL_AS_BLADE_CONVENTIONAL = '' -- i +local Q_CONVENTIONAL_MILLING = '' -- i local Q_CLEAN_CORNER = '' -- 1 local Q_FLOATING_AGGREGATE = '' -- i @@ -201,7 +201,7 @@ local function AssignQIdent( Proc) Q_FORCE_CHAINSAW = 'Q12' -- TODO da riportare a Q13 quando รจ sistemata la gestione del movimento in macchina nell'attacco laterale Q_CHAINSAW_FROM_SIDE = 'Q999' - Q_MILL_AS_BLADE_CONVENTIONAL = '' + Q_CONVENTIONAL_MILLING = '' Q_CLEAN_CORNER = '' Q_FLOATING_AGGREGATE = '' @@ -209,7 +209,7 @@ local function AssignQIdent( Proc) Q_FORCE_BLADE = 'Q01' -- i Q_DEPTH_CHAMFER = 'Q04' -- d Q_ONLY_CHAMFER = 'Q05' -- i - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then Q_DEPTH_CHAMFER = 'Q01' -- d Q_ONLY_CHAMFER = 'Q02' -- i @@ -230,7 +230,7 @@ local function AssignQIdent( Proc) Q_BLADE_ON_ALONG_FACE = 'Q04' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i Q_DEPTH_CHAMFER = 'Q07' -- d - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i Q_CLEAN_CORNER = 'Q15' -- i Q_FLOATING_AGGREGATE = 'Q16' -- i elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then @@ -239,25 +239,26 @@ local function AssignQIdent( Proc) Q_SIDE_ROUGH_TOOL = 'Q01' -- i Q_CONTOUR_SMALL_TOOL = 'Q02' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33 then Q_ANTISPLINT_TYPE = 'Q06' -- i - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then Q_CONTOUR_SMALL_TOOL = 'Q01' -- i Q_USE_MILL = 'Q02' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i elseif ( Proc.Grp == 4) and Proc.Prc == 37 then Q_ANTISPLINT_TYPE = 'Q06' -- i - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i elseif ( Proc.Grp == 4) and Proc.Prc == 39 then Q_CONTOUR_SMALL_TOOL = 'Q01' -- i Q_USE_MILL = 'Q02' -- i Q_ANTISPLINT_TYPE = 'Q06' -- i - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90 then Q_ANTISPLINT_TYPE = 'Q03' -- i Q_SIDE_ROUGH_TOOL = 'Q04' -- i - Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i + Q_CONVENTIONAL_MILLING = 'Q14' -- i end -- le altre features gestite non hanno parametri Q end @@ -2886,7 +2887,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local dOffs = ( i - 1) * dStep if vtN:getZ() < dVzLimDwnUp then dOffs = dOffs + dSawThick end -- forzatura lavorazione discorde in base a parametro Q su feature - local nQ14Param = EgtGetInfo( Proc.Id, Q_MILL_AS_BLADE_CONVENTIONAL, 'd') or 0 + local nQ14Param = EgtGetInfo( Proc.Id, Q_CONVENTIONAL_MILLING, 'd') or 0 local bForceInvert = nQ14Param == 1 or ( nQ14Param == 2 and vtN:getX() < 0.1 and Proc.AffectedFaces.Bottom) if bForceInvert and i == 1 then dStartDist, dEndDist = dEndDist, dStartDist @@ -8335,7 +8336,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- leggo i parametri Q per utilizzare la fresa di fianco e/o lama local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 local bUseBlade = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 - local bOk, sMyWarn, _, AddedIds = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) + -- forzatura lavorazione discorde in base a parametro Q su feature + local nQ14Param = EgtGetInfo( Proc.Id, Q_CONVENTIONAL_MILLING, 'd') or 0 + local bOk, sMyWarn, _, AddedIds = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool, nQ14Param) -- se non sono riuscito a farlo di lama, riprovo con la fresa if not bOk and bUseBlade then bUseBlade = false diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 8ebb9e4..14bcb2b 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -320,7 +320,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster) +function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster, nUseConventionalMilling) -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) @@ -1412,6 +1412,28 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto lato di lavoro e inversione EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bSide, true, false)) + + -- si aggiusta la direzione di lavoro in base a rotazione utensile e preferenza utente (nUseConventionalMilling da fuori o Q14) + EgtMdbSetCurrMachining( sMilling) + local bIsCurrentToolCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + if nUseConventionalMilling == nil then + nUseConventionalMilling = EgtGetInfo( Proc.Id, 'Q14', 'd') or 0 + end + local bUseConventionalMilling = false + if nUseConventionalMilling == 1 or ( nUseConventionalMilling == 2 and vtN[vOrd[i]]:getX() < 0.1 and Proc.AffectedFaces.Bottom) then + bUseConventionalMilling = true + end + if bIsCurrentToolCCW ~= bUseConventionalMilling then + local dCurrStartAddLen = EgtGetMachiningParam( MCH_MP.STARTADDLEN) + local dCurrEndAddLen = EgtGetMachiningParam( MCH_MP.ENDADDLEN) + local bCurrInvert = EgtGetMachiningParam( MCH_MP.INVERT) + local nCurrWorkside = EgtGetMachiningParam( MCH_MP.WORKSIDE) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dCurrEndAddLen) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dCurrStartAddLen) + EgtSetMachiningParam( MCH_MP.INVERT, not bCurrInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nCurrWorkside == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) + end + -- imposto offset radiale (nullo se concavo o di lato) local dOffsR = EgtIf( k < nO, ( nO - k) * dStep, EgtIf( bConvex, - BD.CUT_EXTRA, 0)) if bSide then dOffsR = 0 end @@ -1867,6 +1889,28 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto lato di lavoro e inversione EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.INVERT, true) + + -- si aggiusta la direzione di lavoro in base a rotazione utensile e preferenza utente (nUseConventionalMilling da fuori o Q14) + EgtMdbSetCurrMachining( sMilling) + local bIsCurrentToolCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + if nUseConventionalMilling == nil then + nUseConventionalMilling = EgtGetInfo( Proc.Id, 'Q14', 'd') or 0 + end + local bUseConventionalMilling = false + if nUseConventionalMilling == 1 or ( nUseConventionalMilling == 2 and vtN[vOrd[i]]:getX() < 0.1 and Proc.AffectedFaces.Bottom) then + bUseConventionalMilling = true + end + if bIsCurrentToolCCW ~= bUseConventionalMilling then + local dCurrStartAddLen = EgtGetMachiningParam( MCH_MP.STARTADDLEN) + local dCurrEndAddLen = EgtGetMachiningParam( MCH_MP.ENDADDLEN) + local bCurrInvert = EgtGetMachiningParam( MCH_MP.INVERT) + local nCurrWorkside = EgtGetMachiningParam( MCH_MP.WORKSIDE) + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dCurrEndAddLen) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dCurrStartAddLen) + EgtSetMachiningParam( MCH_MP.INVERT, not bCurrInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( nCurrWorkside == MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) + end + -- calcolo la componente dNz non in base alla classificazione della feature (sopra, sotto, fianchi) ma alla componente maggiore -- local dNz = EgtIf( nSide == 0, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) -- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())