diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index 1778090..af4fc13 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -33,7 +33,6 @@ local sEnableExtraBladeUpperFace = 'Q02' -- i local sDepthChamferMill = 'Q03' -- d local sOverMaterialForFinish = 'Q04' -- d local sPreemptiveChamfer = 'Q05' -- i -local bUseSmallMill = 'Q06' -- i -- abilitazioni extra local dMakeAntiSplintOnHead = 1 -- valore impronta antischeggia, per disattivare settare = nil o = 0 @@ -208,36 +207,31 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly end --------------------------------------------------------------------- -function VerifySmallMillCanFinish( dDiamCurrentTool, dDepthProfile, nSide) - local dToolMaxDepthSmall, dToolDiamSmall +function VerifyOtherMillCanFinish( dDepthProfile, nSide) + local dToolMaxDepthFinish -- abilitazione lavorazione da sotto - local sMillType = 'Prof' - local sMillingSmall, _, _, bH2Small = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil, 'Smallest') - if not sMillingSmall then + local sMillType = 'Prof_end' + local sMillingFinish, _, _, _ = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil) + if not sMillingFinish then return false end -- Recupero i dati dell'utensile - if EgtMdbSetCurrMachining( sMillingSmall) then + if EgtMdbSetCurrMachining( sMillingFinish) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then - dToolMaxDepthSmall = EgtTdbGetCurrToolMaxDepth() - dToolDiamSmall = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - -- se non ci sono almeno 5mm di differenza si fa con utensile standard - if dDiamCurrentTool - 5 < dToolDiamSmall then - return false - end + dToolMaxDepthFinish = EgtTdbGetCurrToolMaxDepth() end else return false end - local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthSmall) + local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthFinish) -- se lavorazione in doppio richiesta, si verifica se richiesta testa sotto if bDouble and nSide == 0 then return false -- TODO macchine con BD.DOWN_HEAD potrebbero lavorare in doppio in questo caso! end - if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthSmall * 2) then - return true, sMillingSmall, bDouble + if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthFinish * 2) then + return true, sMillingFinish, bDouble end return false end @@ -506,12 +500,8 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end - local bUseSmallMillOnFinish = EgtGetInfo( Proc.Id, bUseSmallMill, 'i') == 1 - local sMillingSmall, bDoubleSmall - -- se serve fresa più piccola per finitura - if bUseSmallMillOnFinish then - bUseSmallMillOnFinish, sMillingSmall, bDoubleSmall = VerifySmallMillCanFinish( dMillDiam, dProfDepth, nSide) - end + -- se configurata fresa di finitura + local bUseOtherMillOnFinish, sFinishMilling, bDoubleFinishMill = VerifyOtherMillCanFinish( dProfDepth, nSide) -- se il chamfer non è esclusivo continuo con le altre lavorazioni if nChamfer < 2 then @@ -608,7 +598,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) nMchId = nMch2Id end -- se abilitata, aggiungo lavorazione di finitura - if bFinish and not bUseSmallMillOnFinish then + if bFinish and not bUseOtherMillOnFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) @@ -723,7 +713,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) nMchId = nMch2Id end -- se abilitata, aggiungo lavorazione di finitura - if bFinish and not bUseSmallMillOnFinish then + if bFinish and not bUseOtherMillOnFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) @@ -780,12 +770,12 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- se finitura con fresa piccola - if bFinish and bUseSmallMillOnFinish then - local sDepthSmall = EgtIf( bDoubleSmall, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA) + if bFinish and bUseOtherMillOnFinish then + local sDepthFinishMill = EgtIf( bDoubleFinishMill, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA) local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - nMchId = EgtAddMachining( sMachName, sMillingSmall) + nMchId = EgtAddMachining( sMachName, sFinishMilling) if not nMchId then - local sErr = 'Error adding machining ' .. sMachName .. '-' .. sMillingSmall + local sErr = 'Error adding machining ' .. sMachName .. '-' .. sFinishMilling EgtOutLog( sErr) return false, sErr end @@ -793,7 +783,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningGeometry( {{ AuxId, -1}}) -- imposto l'affondamento - EgtSetMachiningParam( MCH_MP.DEPTH, sDepthSmall) + EgtSetMachiningParam( MCH_MP.DEPTH, sDepthFinishMill) -- posizione braccio porta testa EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) -- eseguo @@ -803,7 +793,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end - if bDoubleSmall then + if bDoubleFinishMill then local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)