diff --git a/CAMAuto/CreateMachGroups.lua b/CAMAuto/CreateMachGroups.lua index 1b23ce6..7b70c78 100644 --- a/CAMAuto/CreateMachGroups.lua +++ b/CAMAuto/CreateMachGroups.lua @@ -188,23 +188,17 @@ local function CalculateSimilarity( Part1, Part2) local ProfilesWeights = { 3, 3, 1, 1} local dScore = 0 - -- 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 - end + 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 + end + return dScore end diff --git a/CAMAuto/LuaLibs/WinExec.lua b/CAMAuto/LuaLibs/WinExec.lua index b3ffd1c..53d4445 100644 --- a/CAMAuto/LuaLibs/WinExec.lua +++ b/CAMAuto/LuaLibs/WinExec.lua @@ -547,7 +547,7 @@ function WinExec.ProcessFeatures( PARTS) local bIsApplyOk, sErr, b3MachEncumbrance = MachiningLib.AddOperation( MACHININGS[i]) -- TODO ingombro lavorazione mi restituisce dati sbagliati. C'è un riferimento? -- se feature di testa, sposto testa in base a ingombro lavorazione if MACHININGS[i].Proc.bHeadProfile and b3MachEncumbrance then - PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase1.dOffsetX = min( b3MachEncumbrance:getMax():getX() - PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMin():getX() + 5, maxOffsetX[MACHININGS[i].Proc.nIndexPart]) + PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase1.dOffsetX = min( b3MachEncumbrance:getMax():getX() - PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMin():getX() + 45, maxOffsetX[MACHININGS[i].Proc.nIndexPart]) end end end @@ -573,7 +573,7 @@ function WinExec.ProcessFeatures( PARTS) local bIsApplyOk, sErr, b3MachEncumbrance = MachiningLib.AddOperation( MACHININGS[i]) -- TODO ingombro lavorazione mi restituisce dati sbagliati. C'è un riferimento? -- se feature di testa, sposto testa in base a ingombro lavorazione if MACHININGS[i].Proc.bHeadProfile and b3MachEncumbrance then - PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase2.dOffsetX = min( PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMax():getX() - b3MachEncumbrance:getMin():getX() + 5, 94) + PARTS[MACHININGS[i].Proc.nIndexPart].DispOffsets.Phase2.dOffsetX = min( PARTS[MACHININGS[i].Proc.nIndexPart].b3Part:getMax():getX() - b3MachEncumbrance:getMin():getX() + 45, 94) end end end