diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index 696a610..988bbc1 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -313,8 +313,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end local bStripOnSide = false if bCross then - -- se chiamata da SimpleScarf il codolo è sempre attivo - if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX()) or Proc.Prc == 70) then + -- se forzata da parametro Q il codolo è sempre attivo + if dDimStrip > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then -- devo lasciare un codolo local dExtraCham = EgtIf( nChamfer > 0, 2, 0) dDepth = EgtIf( Proc.Prc == 70, dDepth - dDimStrip - dDepthCham - dExtraCham, dDepth - dDimStrip) @@ -326,9 +326,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end local bIsDepthReduced = false -- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga - -- se chiamata da SimpleScarf il codolo è sempre attivo + -- se forzata da parametro Q il codolo è sempre attivo local dDepthWork = dDepth - if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( nStep > 1 or Proc.Prc == 70) and + if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( BD.DIM_STRIP < 0 or nStep > 1) and bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then nDouble = 2 dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth) @@ -372,15 +372,19 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) if nSide == 0 then if BD.DOWN_HEAD then -- recupero la lavorazione - _, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true) - if not sChamferDown then + local nChamferDown + nChamferDown, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true) + if nChamferDown < 0 then sWarn = 'Warning : chamfer from bottom not found in library' + sChamferDown = nil EgtOutLog( sWarn) end end - _, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false) - if not sChamferUp then - sWarn = 'Warning : milling not found in library' + local nChamferUp + nChamferUp, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false) + if nChamferUp < 0 then + sWarn = 'Warning : chamfer from bottom not found in library' + sChamferUp = nil EgtOutLog( sWarn) end end @@ -429,7 +433,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end end if nSide == 0 then - bDoubleCham = BD.DOWN_HEAD + bDoubleCham = EgtIf( sChamferDown and BD.DOWN_HEAD, true, false) else bDoubleCham = true end @@ -554,14 +558,15 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) if not sMillingDown then sWarn = 'Warning : milling from bottom not found in library' EgtOutLog( sWarn) + elseif sMillingDown and not bDownHead then + bToolInv = true + sMilling = sMillingDown end end - if EgtEndsWith( sMilling, '_H2') then - sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false) - if not sMillingUp then - sWarn = 'Warning : milling not found in library' - EgtOutLog( sWarn) - end + sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false) + if not sMillingUp then + sWarn = 'Warning : milling not found in library' + EgtOutLog( sWarn) end end end @@ -591,8 +596,10 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) if EgtEndsWith( sMilling, '_H2') then nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingUp, sMilling)) - else + elseif sMillingDown then nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingDown, sMilling)) + else + nMchId = EgtAddMachining( sName, sMilling) end if not nMchId then local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling