diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 27dafb4..97761eb 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1353,7 +1353,8 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN -- se foratura ( 3/4-040-X) elseif Drill.Identify( Proc) then -- esecuzione foratura - bOk, sErr, _, AddedIds = Drill.Make( Proc, nPhase, nRawId, nPartId) + local bUseMultiDrill = BD.USE_MULTI_DRILL + bOk, sErr = Drill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill) -- se giunzione francese ( 1/2-035-X) elseif FrenchRidgeLap.Identify( Proc) then -- esecuzione giunzione francese diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index f2b58f6..9da111c 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -214,7 +214,7 @@ function GetMachinings( MachiningType, sType) Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) end if MachiningType == MCH_MY.DRILLING then - if EgtStartsWith( Machining.Type, 'Drill') then + if EgtStartsWith( Machining.Type, 'Drill') or EgtStartsWith( Machining.Type, 'MultiDrill') then Machining.SubType = 'Drill' elseif EgtStartsWith( Machining.Type, 'AngleDrill') then Machining.SubType = 'AngleDrill' @@ -297,7 +297,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 == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen + return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'MultiDrill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , 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 @@ -455,10 +455,13 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead) end --------------------------------------------------------------------- -function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill) +function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bIsMultidrill) local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach + -- se la macchina ha gruppi a forare, si prova con quelli + if bIsMultidrill then + sTypeMach = 'MultiDrill' -- se il foro è un predrill, cerco solo punte abilitate al Predrill - if bIsPredrill then + elseif bIsPredrill then sTypeMach = 'Predrill' else sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill') diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 097ba8f..1f2dcbb 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -320,7 +320,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) +function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill) -- default per costanti BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928) -- ingombro del pezzo @@ -393,9 +393,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, bDrillAngTrasm, Proc.IsPredrill) + local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill) if not sDrilling and dCheckDepth then - sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) + sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill) if sDrilling then dCheckDepth = nil end end if not sDrilling then @@ -560,7 +560,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) return false, sErr end -- aggiungo geometria - if Proc.OtherGeometries and #Proc.OtherGeometries > 0 then + if Proc.SkippedGeometries and #Proc.SkippedGeometries > 0 then + EgtSetMachiningGeometry( Proc.SkippedGeometries) + Proc.SkippedGeometries = nil + elseif Proc.OtherGeometries and #Proc.OtherGeometries > 0 then local HolesGeometries = {} -- aggiungo foro principale table.insert( HolesGeometries, { AuxId, -1}) @@ -576,14 +579,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) EgtSetMachiningGeometry( {{ AuxId, -1}}) end -- eventuale inversione - if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then + if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) end -- imposto posizione braccio porta testa local nSCC = MCH_SCC.NONE - if bDrillAngTrasm then + if bDrillAngTrasm or bUseMultiDrill then nSCC = MCH_SCC.ADIR_NEAR elseif not BD.C_SIMM and not BD.TURN then nSCC = MCH_SCC.ADIR_YM @@ -643,7 +646,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) -- eseguo local bOk = ML.ApplyMachining( true, false) if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then - if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then + if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'AngleDrill' then EgtSetMachiningParam( MCH_MP.INVERT, true) else EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) @@ -651,10 +654,16 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) bOk = ML.ApplyMachining( true, false) end - -- TODO gestione foratura multipla - -- in caso di foratura multipla, bisogna farsi restituire le geometrie non lavorate e lavorarle poi singolarmente. - -- Restituire come AddedIds della LapJoint - -- local AddedIds = .......... + -- in caso di fori raggruppati, mi faccio restituire gli eventuali fori saltati + local SkippedGeometries = {} + SkippedGeometries = EgtGetMachiningSkippedGeometry() + if #SkippedGeometries > 0 and bUseMultiDrill then + if #SkippedGeometries == #Proc.OtherGeometries + 1 then + EgtRemoveOperation( nMchId) + end + Proc.SkippedGeometries = SkippedGeometries + ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, false) + end if not bOk then local _, sErr = EgtGetLastMachMgrError() @@ -670,7 +679,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) end end - return true, sMyWarn, nil, AddedIds + return true, sMyWarn end ---------------------------------------------------------------------