diff --git a/CAMAuto/CreateMachGroups.lua b/CAMAuto/CreateMachGroups.lua index c421a02..f48f602 100644 --- a/CAMAuto/CreateMachGroups.lua +++ b/CAMAuto/CreateMachGroups.lua @@ -190,17 +190,23 @@ local function CalculateSimilarity( Part1, Part2) local ProfilesWeights = { 3, 3, 1, 1} local dScore = 0 - for i = 1, 4 do - if Part1.SemiProfiles[i] == Part2.SemiProfiles[i] then - dScore = dScore + ProfilesWeights[i] - end - end + -- punteggio maggiore di zero se hanno stesse dimensioni + if Part1.b3Raw:getDimZ() - Part2.b3Raw:getDimZ() < 10 * GEO.EPS_SMALL and Part1.b3Raw:getDimZ() - Part2.b3Raw:getDimZ() > - 10 * GEO.EPS_SMALL and + ((Part1.b3Raw:getDimX() - Part2.b3Raw:getDimX() < 10 * GEO.EPS_SMALL and Part1.b3Raw:getDimX() - Part2.b3Raw:getDimX() > - 10 * GEO.EPS_SMALL and + Part1.b3Raw:getDimY() - Part2.b3Raw:getDimY() < 10 * GEO.EPS_SMALL and Part1.b3Raw:getDimY() - Part2.b3Raw:getDimY() > - 10 * GEO.EPS_SMALL) or + (Part1.b3Raw:getDimY() - Part2.b3Raw:getDimX() < 10 * GEO.EPS_SMALL and Part1.b3Raw:getDimY() - Part2.b3Raw:getDimX() > - 10 * GEO.EPS_SMALL and + Part1.b3Raw:getDimX() - Part2.b3Raw:getDimY() < 10 * GEO.EPS_SMALL and Part1.b3Raw:getDimX() - Part2.b3Raw:getDimY() > - 10 * GEO.EPS_SMALL))then + for i = 1, 4 do + if Part1.SemiProfiles[i] == Part2.SemiProfiles[i] then + dScore = dScore + ProfilesWeights[i] + end + end - -- punteggio "bonus" se il tipo di pezzo è lo stesso - if Part1.sPieceType and Part2.sPieceType and Part1.sPieceType == Part2.sPieceType then - dScore = dScore + 2 + -- punteggio "bonus" se il tipo di pezzo è lo stesso + if Part1.sPieceType and Part2.sPieceType and Part1.sPieceType == Part2.sPieceType then + dScore = dScore + 2 + end end - return dScore end diff --git a/CAMAuto/LuaLibs/MachiningLib.lua b/CAMAuto/LuaLibs/MachiningLib.lua index 0af1cc6..6eb4658 100644 --- a/CAMAuto/LuaLibs/MachiningLib.lua +++ b/CAMAuto/LuaLibs/MachiningLib.lua @@ -170,12 +170,13 @@ function MachiningLib.GetPhaseMach( Proc) -- se macchina tipo LINEA if WinData.MACH_TYPE == 'LINE' then if Proc.AffectedFaces.bTop then - nPhase = 1 + nPhase = 2 elseif Proc.AffectedFaces.bFront or Proc.AffectedFaces.bLeft then nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 1, 2) elseif Proc.AffectedFaces.bBack or Proc.AffectedFaces.bRight then nPhase = EgtIf( WinData.FIRST_PHASE_LOAD == 'PUSH', 2, 1) else + -- per fori presi da AGB effettuati dopo profilo e la cui lavorazione non parte da una faccia del grezzo nPhase = EgtIf( Proc.vtDir:getX() < 0 and Proc.vtDir:getY() < 0, 1, 2) end -- se macchina tipo PANTOGRAFO diff --git a/CAMAuto/LuaLibs/WinExec.lua b/CAMAuto/LuaLibs/WinExec.lua index 8d2455d..b3ffd1c 100644 --- a/CAMAuto/LuaLibs/WinExec.lua +++ b/CAMAuto/LuaLibs/WinExec.lua @@ -360,10 +360,18 @@ local function OrderMachining( MACHININGS) return true elseif B1.AuxiliaryData.bIsDrilling and B1.AuxiliaryData.bExecAfterProfile and B2.AuxiliaryData.bIsProfiling then return false + elseif B1.AuxiliaryData.bIsProfiling and B2.AuxiliaryData.bIsPocketingDrill then + return true + elseif B1.AuxiliaryData.bIsPocketingDrill and B2.AuxiliaryData.bIsProfiling then + return false elseif B1.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bIsProfiling then return true elseif B2.AuxiliaryData.bIsDrilling and B1.AuxiliaryData.bIsProfiling then return false + elseif B1.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bIsPocketingDrill then + return true + elseif B1.AuxiliaryData.bIsPocketingDrill and B2.AuxiliaryData.bIsDrilling then + return false elseif B1.AuxiliaryData.bIsProfiling and B2.AuxiliaryData.bIsProfiling then -- profiling Generic sempre per ultimi if B1.Proc.sProfileInfo == 'Generic' and B2.Proc.sProfileInfo ~= 'Generic' then @@ -382,26 +390,26 @@ local function OrderMachining( MACHININGS) return EgtIf( B1.AuxiliaryData.nPhase == 1, false, true) -- se arrivati a questo controllo, la fase di lavorazione di entrambe è la stessa, quindi mi basta controllarne una end elseif B1.AuxiliaryData.bIsDrilling and B2.AuxiliaryData.bIsDrilling then - if B1.Proc.b3Box:getMin():getX() == B2.Proc.b3Box:getMin():getX() then - if B1.Proc.b3Box:getMin():getY() == B2.Proc.b3Box:getMin():getY() then - if B1.Proc.b3Box:getMin():getZ() < B2.Proc.b3Box:getMin():getZ() then - return true - else - return false - end - else - if B1.Proc.b3Box:getMin():getY() < B2.Proc.b3Box:getMin():getY() then - return true - else - return false - end - end + if B1.Proc.b3Box:getMin():getX() < B2.Proc.b3Box:getMin():getX() then + return true + elseif B1.Proc.b3Box:getMin():getX() > B2.Proc.b3Box:getMin():getX() then + return false + end + if B1.Proc.b3Box:getMin():getY() < B2.Proc.b3Box:getMin():getY() then + return true + elseif B1.Proc.b3Box:getMin():getY() > B2.Proc.b3Box:getMin():getY() then + return false + end + if B1.Proc.b3Box:getMin():getZ() < B2.Proc.b3Box:getMin():getZ() then + return true + elseif B1.Proc.b3Box:getMin():getZ() > B2.Proc.b3Box:getMin():getZ() then + return false + end + elseif B1.AuxiliaryData.bIsPocketingDrill and B2.AuxiliaryData.bIsPocketingDrill then + if B1.Proc.b3Box:getMin():getX() < B2.Proc.b3Box:getMin():getX() then + return true else - if B1.Proc.b3Box:getMin():getX() < B2.Proc.b3Box:getMin():getX() then - return true - else - return false - end + return false end else @@ -526,7 +534,7 @@ function WinExec.ProcessFeatures( PARTS) AddMachinings( vProc, PARTS) -- ordina le lavorazioni - --OrderMachining( MACHININGS) + OrderMachining( MACHININGS) local maxOffsetX = {} for i = 1, #PARTS do diff --git a/CAMAuto/Strategies/Drilling.lua b/CAMAuto/Strategies/Drilling.lua index 6482141..f06dcfe 100644 --- a/CAMAuto/Strategies/Drilling.lua +++ b/CAMAuto/Strategies/Drilling.lua @@ -21,6 +21,9 @@ local function IsDrillToMachineAfterProfile( Proc) if ( Proc.AffectedFaces.bLeft or Proc.AffectedFaces.bRight) and abs( Proc.vtDir:getX()) > 0.15 then bExecAfterProfile = true end + if not (Proc.AffectedFaces.bLeft or Proc.AffectedFaces.bRight or Proc.AffectedFaces.bBottom or Proc.AffectedFaces.bTop or Proc.AffectedFaces.bBack or Proc.AffectedFaces.bFront) then + bExecAfterProfile = true + end return bExecAfterProfile end