diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 1547b03..73e0c28 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -176,7 +176,7 @@ end --------------------------------------------------------------------- function VerifyTool( MachiningType, sType, Params, bH2) if MachiningType == MCH_MY.DRILLING then - if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then + if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'Drill_AT') or EgtStartsWith( sType, 'AngleDrill') then return VerifyDrill( Params.Diam, Params.Depth, bH2) elseif EgtStartsWith( sType, 'Pocket') then return VerifyDrillPocket( Params.Diam, Params.Depth, bH2) @@ -213,7 +213,7 @@ end function ReturnParams( MachiningType, MachiningName, sType, ToolParams) if MachiningType == MCH_MY.DRILLING then local _, sOrigType = EgtEndsWith( sType, '_H2') - return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen + return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen elseif MachiningType == MCH_MY.SAWING then return MachiningName, ToolParams.H2 elseif MachiningType == MCH_MY.MILLING then @@ -379,9 +379,9 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead) end --------------------------------------------------------------------- -function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2) - local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2) - if not MachiningName or MachiningName == '' then +function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission) + local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2) + if ( not MachiningName or MachiningName == '') and not bAngleTransmission then MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) end if MachiningName and MachiningName ~= '' then diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 61f5964..9ef5a1e 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -169,7 +169,12 @@ function ProcessDrill.Classify( Proc, b3Raw) -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then if not bOpen then - return true, true, false + -- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione + if BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and vtExtr:getZ() < -0.999 then + return true, false, false + else + return true, true, false + end else return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) end @@ -242,8 +247,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) -- verifico possibilità di foratura da sotto local bDownDrill = ( BD.TURN or ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))) + -- se presente rinvio angolare + local bDrillAngTrasm = ( BD.ANG_TRASM and vtExtr:getZ() < -0.999) -- verifico che il foro non sia fattibile solo da sotto - local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) + local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) and not bDrillAngTrasm if bToInvert and ( not bOpen or Proc.Flg ~= 1) then local sErr = 'Error : drilling from bottom impossible' EgtOutLog( sErr) @@ -283,9 +290,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- recupero la lavorazione - local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2) + local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm) if not sDrilling and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2) + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm) if sDrilling then dCheckDepth = nil end end if not sDrilling then @@ -459,7 +466,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if not BD.C_SIMM and not BD.TURN then + if bDrillAngTrasm then + nSCC = MCH_SCC.ADIR_NEAR + elseif not BD.C_SIMM and not BD.TURN then nSCC = MCH_SCC.ADIR_YM if AreSameVectorApprox( vtExtr, Z_AX()) then nSCC = MCH_SCC.ADIR_YM