diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 71d5ac1..316f655 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -403,7 +403,7 @@ end ------------------------------------------------------------------------------------------------------------- -- funzione con valore di default in caso la GetSetupInfo della testa della macchina non avesse la funzione definita -function BeamLib.GetMinNzDownUpDefault( b3Raw, vtNFace, vtToolDirection) +function BeamLib.GetMinNzDownUpDefault( b3Raw, vtNFace, vtToolDirection, Tool) return -2 end diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 0172baf..3c9c412 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -207,9 +207,9 @@ end ------------------------------------------------------------------------------------------------------------- local function CompareEdges( EdgeA, EdgeB) -- prima i lati con facce adiacenti - if EdgeA.idAdjacentFace and not ( EdgeB.idAdjacentFace) then + if ( EdgeA.idAdjacentFace > -1) and ( EdgeB.idAdjacentFace < 0) then return true - elseif not ( EdgeA.idAdjacentFace) and EdgeB.idAdjacentFace then + elseif ( EdgeA.idAdjacentFace < 0) and ( EdgeB.idAdjacentFace > -1) then return false -- se entrambi con facce adiacenti, si sceglie quello convesso (non chiuso) else @@ -328,11 +328,10 @@ local function GetBottomFaces( Proc) local EdgesSorted = {} for i = 1, #BottomFaces[1].Edges do - if not BottomFaces[1].Edges[i].bIsOpen then - table.insert( EdgesSorted, {}) - EdgesSorted[#EdgesSorted].nIndex = i - EdgesSorted[#EdgesSorted].dLength = BottomFaces[1].Edges[i].dLength - end + table.insert( EdgesSorted, {}) + EdgesSorted[#EdgesSorted].nIndex = i + EdgesSorted[#EdgesSorted].dLength = BottomFaces[1].Edges[i].dLength + EdgesSorted[#EdgesSorted].idAdjacentFace = BottomFaces[1].Edges[i].idAdjacentFace end table.sort( EdgesSorted, CompareEdges) local nFirstLongEdgeIndex @@ -409,10 +408,10 @@ local function GetLongFaces( Proc, MainFaces) local FacesNotAdjacent = GetNotAdjacentFaces( Proc, idFirstLongFace) idSecondLongFace = FacesNotAdjacent[1].id else - if not BottomFace.MainEdges.LongEdges[1].bIsOpen then + if BottomFace.MainEdges.LongEdges[1].idAdjacentFace > -1 then idFirstLongFace = BottomFace.MainEdges.LongEdges[1].idAdjacentFace end - if not BottomFace.MainEdges.LongEdges[2].bIsOpen then + if BottomFace.MainEdges.LongEdges[2].idAdjacentFace > -1 then idSecondLongFace = BottomFace.MainEdges.LongEdges[2].idAdjacentFace end end diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 860f596..598f0b9 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -208,7 +208,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters) sChosenBladeType = 'Bottom' -- se lama sopra va verificato se va usata in DownUp elseif nChosenToolIndex == nToolIndexTop then - local dMinNzDownUp = TOOLS[nToolIndexTop].SetupInfo.GetMinNzDownUp( Part.b3Raw, Face.vtN) + local dMinNzDownUp = TOOLS[nToolIndexTop].SetupInfo.GetMinNzDownUp( Part.b3Raw, Face.vtN, nil, TOOLS[nToolIndexTop]) local dCurrentResidualDepth = dElevationTopDownUp - TOOLS[nToolIndexTop].dMaxDepth if Face.vtN:getZ() < dMinNzDownUp then if ( dCurrentResidualDepth > 10 * GEO.EPS_SMALL) then @@ -359,7 +359,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters) end -- limite per taglio DownUp - local dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, Face1.vtN) + local dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, Face1.vtN, nil, TOOLS[nToolIndex]) -- calcolo dimensione cubetto e eventuale cubetto ridotto (tagli orizzontali con affondamento verticale) local dDiceDimension = min( TOOLS[nToolIndex].dMaxMaterial, BeamData.MAX_DIM_DICE) diff --git a/StrategyLibs/FACEBYBLADE.lua b/StrategyLibs/FACEBYBLADE.lua index b44a0c2..c2d06f8 100644 --- a/StrategyLibs/FACEBYBLADE.lua +++ b/StrategyLibs/FACEBYBLADE.lua @@ -223,7 +223,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- se si conosce il limite downUp (utensile forzato o downUp forzato) si decide se invertire (ToolInvert) -- TODO esiste un limite downUp massimo per la lama da sopra?? if nToolIndex and not dMinNzDownUp then - dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Cutting.vtToolDirection) + dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Cutting.vtToolDirection, TOOLS[nToolIndex]) end if dMinNzDownUp and FaceToMachine.vtN:getZ() < dMinNzDownUp then Cutting.bToolInvert = true @@ -249,7 +249,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters) -- ora che l'utensile è scelto, se non era definito l'angolo di DownUp lo verifico per decidere se invertire if ToolInfo.nToolIndex and not dMinNzDownUp then - dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Cutting.vtToolDirection) + dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Cutting.vtToolDirection, TOOLS[ToolInfo.nToolIndex]) if FaceToMachine.vtN:getZ() < dMinNzDownUp then Cutting.bToolInvert = true end diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index 9241198..b7a32a7 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -210,7 +210,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- se si conosce il limite downUp (utensile forzato o downUp forzato) si decide se invertire (ToolInvert) if nToolIndex and not dMinNzDownUp then - dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection) + dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection, TOOLS[nToolIndex]) end if dMinNzDownUp and FaceToMachine.vtN:getZ() < dMinNzDownUp then Milling.bToolInvert = true @@ -241,7 +241,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara local ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) -- ora che l'utensile è scelto, se non era definito l'angolo di DownUp lo verifico per decidere se invertire if ToolInfo.nToolIndex and not dMinNzDownUp then - dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection) + dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection, TOOLS[ToolInfo.nToolIndex]) if FaceToMachine.vtN:getZ() < dMinNzDownUp then Milling.bToolInvert = true end