diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index aafea38..7a34d53 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -3,7 +3,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index 6c47af8..31b3d09 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -53,15 +53,15 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Cut (1-10) elseif ID.IsCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Longitudinal Cut (0-10) elseif ID.IsLongitudinalCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Double Cut (1-11) elseif ID.IsDoubleCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Ridge or Valley Cut (0-12) elseif ID.IsDoubleLongitudinalCut( Proc) then @@ -372,15 +372,15 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Cut (1-10) elseif ID.IsCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Longitudinal Cut (0-10) elseif ID.IsLongitudinalCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Double Cut (1-11) elseif ID.IsDoubleCut( Proc) then - Strategies = { { sStrategyId = 'STR0005'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0005'}} --------------------------------------------------------------------- -- Feature : Ridge or Valley Cut (0-12) elseif ID.IsDoubleLongitudinalCut( Proc) then diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index de0daca..eb4a3cc 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -260,10 +260,17 @@ local function GetBottomFaces( Proc) if Proc.Topology.sFamily == 'Tunnel' then return nil - elseif not ( Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or - Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Bevel') then + elseif not ( Proc.Topology.sFamily == 'Rabbet' + or Proc.Topology.sFamily == 'VGroove' + or Proc.Topology.sFamily == 'Groove' + or Proc.Topology.sFamily == 'Pocket' + or Proc.Topology.sFamily == 'Bevel' + or Proc.Topology.sFamily == 'DoubleBevel' + or Proc.Topology.sFamily == 'Cut') then error( 'GetBottomFace : Topology not implemented') - elseif Proc.nFct == 1 then + end + + if Proc.nFct == 1 then return { Proc.Faces[1]} end @@ -303,7 +310,10 @@ local function GetBottomFaces( Proc) end end table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end) - local nFirstLongEdgeIndex = ClosedEdgesSortedByGreatestLength[1].nIndex + local nFirstLongEdgeIndex + if #ClosedEdgesSortedByGreatestLength > 0 then + nFirstLongEdgeIndex = ClosedEdgesSortedByGreatestLength[1].nIndex + end for i = 1, #BottomFaces[1].Edges do local nPreviousEdgeIndex = i - 1 @@ -324,18 +334,21 @@ local function GetBottomFaces( Proc) CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[i].bIsStartOpen CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[i].bIsEndOpen - if i == nFirstLongEdgeIndex then - BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge - BottomFaces[1].MainEdges.LongEdges[1].sType = 'Long' - elseif nNextEdgeIndex == nFirstLongEdgeIndex then - BottomFaces[1].MainEdges.SideEdges[1] = CurrentEdge - BottomFaces[1].MainEdges.SideEdges[1].sType = 'Side' - elseif nPreviousEdgeIndex == nFirstLongEdgeIndex then - BottomFaces[1].MainEdges.SideEdges[2] = CurrentEdge - BottomFaces[1].MainEdges.SideEdges[2].sType = 'Side' - else - BottomFaces[1].MainEdges.LongEdges[2] = CurrentEdge - BottomFaces[1].MainEdges.LongEdges[2].sType = 'Long' + -- se non c'รจ un LongEdge significa che non ci sono lati chiusi (facce convesse) + if nFirstLongEdgeIndex then + if i == nFirstLongEdgeIndex then + BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge + BottomFaces[1].MainEdges.LongEdges[1].sType = 'Long' + elseif nNextEdgeIndex == nFirstLongEdgeIndex then + BottomFaces[1].MainEdges.SideEdges[1] = CurrentEdge + BottomFaces[1].MainEdges.SideEdges[1].sType = 'Side' + elseif nPreviousEdgeIndex == nFirstLongEdgeIndex then + BottomFaces[1].MainEdges.SideEdges[2] = CurrentEdge + BottomFaces[1].MainEdges.SideEdges[2].sType = 'Side' + else + BottomFaces[1].MainEdges.LongEdges[2] = CurrentEdge + BottomFaces[1].MainEdges.LongEdges[2].sType = 'Long' + end end end @@ -348,7 +361,8 @@ local function GetLongFaces( Proc, MainFaces) if Proc.nFct > 5 then error( 'GetLongFaces : Topology not implemented') - elseif Proc.nFct == 1 then + elseif Proc.nFct == 1 + or Proc.Topology.sFamily == 'DoubleBevel' then return {} end @@ -446,7 +460,8 @@ local function GetSideFaces( Proc, MainFaces) if Proc.nFct > 5 then error( 'GetSideFaces : Topology not implemented') - elseif Proc.nFct == 1 then + elseif Proc.nFct == 1 + or Proc.Topology.sFamily == 'DoubleBevel' then return {} end @@ -535,7 +550,8 @@ function FaceData.GetMainFaces( Proc, Part) -- CASO 1 : Feature tipo LapJoint if Proc.Topology.sFamily == 'Rabbet' or Proc.Topology.sFamily == 'VGroove' or Proc.Topology.sFamily == 'Groove' or - Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' then + Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' or + Proc.Topology.sFamily == 'DoubleBevel' or Proc.Topology.sFamily == 'Cut' then if Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5 then MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc, Part) diff --git a/Strategies/AvailableStrategyList.json b/Strategies/AvailableStrategyList.json index 36b2ba8..f5b4d47 100644 --- a/Strategies/AvailableStrategyList.json +++ b/Strategies/AvailableStrategyList.json @@ -6,7 +6,7 @@ "nGrp": "1", "TopologyList" : [ { "sName": "Feature", - "StrategyList" : [ { "sStrategyID": "STR0005" } ] + "StrategyList" : [ { "sStrategyID": "STR0002" }, { "sStrategyID": "STR0005" } ] } ] }, @@ -16,7 +16,7 @@ "nGrp": "0", "TopologyList" : [ { "sName": "Feature", - "StrategyList" : [ { "sStrategyID": "STR0005" } ] + "StrategyList" : [ { "sStrategyID": "STR0002" }, { "sStrategyID": "STR0005" } ] } ] }, @@ -26,7 +26,7 @@ "nGrp": "1", "TopologyList" : [ { "sName": "Feature", - "StrategyList" : [ { "sStrategyID": "STR0005" } ] + "StrategyList" : [ { "sStrategyID": "STR0002" }, { "sStrategyID": "STR0005" } ] } ] }, diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index 948ba8a..ef1062c 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -32,7 +32,10 @@ local function IsTopologyOk( Proc) Proc.Topology.sName == 'Groove-3-Through' or Proc.Topology.sName == 'Groove-3-Blind' or Proc.Topology.sName == 'Bevel-3-Blind' or - Proc.Topology.sName == 'Rabbet-2-Through' then + Proc.Topology.sName == 'Rabbet-2-Through' or + Proc.Topology.sName == 'DoubleBevel-2-Through' or + Proc.Topology.sName == 'Cut-1-Through' or + Proc.Topology.sName == 'Bevel-1-Through' then return true else @@ -115,7 +118,11 @@ local function GetBestPocketingStrategy( Proc) elseif Proc.Topology.sName == 'Groove-3-Blind' then ToolSearchParameters.sType = 'MILL_NOTIP' ToolSearchParameters.dMaxToolDiameter = Strategy.Parameters.dMaxCornerRadius * 2 - elseif Proc.Topology.sName == 'Rabbet-2-Through' then + elseif Proc.Topology.sName == 'Rabbet-2-Through' + or Proc.Topology.sName == 'DoubleBevel-2-Through' + or Proc.Topology.sName == 'Cut-1-Through' + or Proc.Topology.sName == 'Bevel-1-Through' then + ToolSearchParameters.sType = 'MILL_NOTIP' ToolSearchParameters.dMaxToolDiameter = 9999 else @@ -150,13 +157,13 @@ local function GetBestPocketingStrategy( Proc) -- caso speciale 'Rabbet-2-Through' seconda faccia principale Milling = {} Milling.bIsApplicable = false - if Proc.Topology.sName == 'Rabbet-2-Through' then - ToolSearchParameters.dElevation = Proc.MainFaces.LongFaces[1].dElevation - ToolSearchParameters.vtToolDirection = Proc.MainFaces.LongFaces[1].vtN - Milling.vtFaceNormal = Proc.MainFaces.LongFaces[1].vtN - Milling.idFaceToMachine = Proc.MainFaces.LongFaces[1].id + if Proc.Topology.sName == 'Rabbet-2-Through' or Proc.Topology.sName == 'DoubleBevel-2-Through' then + ToolSearchParameters.dElevation = Proc.MainFaces.BottomFaces[2].dElevation + ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[2].vtN + Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[2].vtN + Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[2].id Milling.idProc = Proc.id - Milling.dElevation = Proc.MainFaces.LongFaces[1].dElevation + Milling.dElevation = Proc.MainFaces.BottomFaces[2].dElevation Milling.ToolInfo = {} Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters) if Milling.ToolInfo.nToolIndex then @@ -171,7 +178,7 @@ local function GetBestPocketingStrategy( Proc) -- cerco utensile per lavorare di fianco 1 Milling = {} Milling.bIsApplicable = false - if Proc.Topology.sName ~= 'Pocket-5-Blind' then + if ( #Proc.MainFaces.LongFaces > 0) and Proc.Topology.sName ~= 'Pocket-5-Blind' then if Proc.Topology.sName == 'Groove-4-Blind' then ToolSearchParameters.dElevation = Proc.MainFaces.BottomFaces[2].dElevation ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[2].vtN @@ -211,7 +218,7 @@ local function GetBestPocketingStrategy( Proc) -- cerco utensile per lavorare di fianco 2 Milling = {} Milling.bIsApplicable = false - if Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'Groove-4-Blind' and Proc.Topology.sName ~= 'Bevel-3-Blind' then + if ( #Proc.MainFaces.LongFaces > 0) and Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'Groove-4-Blind' and Proc.Topology.sName ~= 'Bevel-3-Blind' then if Proc.MainFaces.TunnelAddedFaces then -- Tunnel-4-Through, Groove-3-Through, Rabbet-2-Through -- se lavoro di fianco, devo comunque rispettare il raggio massimo ToolSearchParameters.dMaxToolDiameter = min( ToolSearchParameters.dMaxToolDiameter, Strategy.Parameters.dMaxCornerRadius * 2) @@ -250,9 +257,18 @@ local function GetBestPocketingStrategy( Proc) Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100) Strategy.Result.dMRR = Machining[1].dMRR Machining[1].ToolInfo.dResidualDepth = 0 - Machining[2].bIsApplicable = false Machining[3].bIsApplicable = false Machining[4].bIsApplicable = false + -- caso speciale 'DoubleBevel-2-Through' che deve lavorare due facce + if Proc.Topology.sName == 'DoubleBevel-2-Through' and Machining[2].bIsApplicable and Machining[2].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then + Machining.sTypeMachining = 'Bottom2' + Strategy.Result.sStatus = 'Completed' + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100) + Strategy.Result.dMRR = Machining[2].dMRR + Machining[2].ToolInfo.dResidualDepth = 0 + else + Machining[2].bIsApplicable = false + end return Machining -- caso speciale 'Rabbet-2-Through' che ha la seconda faccia come se fosse una seconda bottom elseif Proc.Topology.sName == 'Rabbet-2-Through' and Machining[2].bIsApplicable and Machining[2].ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then diff --git a/Strategies/Standard/STR0005/STR0005.lua b/Strategies/Standard/STR0005/STR0005.lua index 7e1b851..fd79dc1 100644 --- a/Strategies/Standard/STR0005/STR0005.lua +++ b/Strategies/Standard/STR0005/STR0005.lua @@ -28,6 +28,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) Strategy.Result = {} Strategy.Result.sInfo = '' Blade.Result = {} + local dTimeToMachine = 0 local dMRRBlade = 0 local dCompletionPercentage = 0 local nQuality = 0 @@ -82,6 +83,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) local BladeKeepWasteResult local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dStripWidth = Strategy.Parameters.dStripWidth} Blade.Result, BladeKeepWasteResult = BladeKeepWaste.Make( Proc, Part, OptionalParameters) + dTimeToMachine = BladeKeepWasteResult.dTimeToMachine dMRRBlade = BladeKeepWasteResult.dMRR dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage nQuality = BladeKeepWasteResult.nQuality @@ -106,6 +108,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) dExtendAfterTail = dExtendAfterTail } Blade.Result, BladeToWasteResult = BladeToWaste.Make( Proc, Part, OptionalParameters) + dTimeToMachine = BladeToWasteResult.dTimeToMachine dMRRBlade = BladeToWasteResult.dMRR dCompletionPercentage = BladeToWasteResult.dCompletionPercentage nQuality = BladeToWasteResult.nQuality @@ -118,6 +121,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) dMillingOffsetFromSide = Strategy.Parameters.dMillingOffsetFromSide } Blade.Result, BladeKeepWasteResult = BladeKeepWaste.Make( Proc, Part, OptionalParameters) + dTimeToMachine = BladeKeepWasteResult.dTimeToMachine dMRRBlade = BladeKeepWasteResult.dMRR dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage nQuality = BladeKeepWasteResult.nQuality @@ -150,6 +154,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) dCompletionPercentageAddedFace = BladeToWasteResult.dCompletionPercentage nQualityAddedFace = BladeToWasteResult.nQuality + dTimeToMachine = dTimeToMachine + BladeToWasteResult.dTimeToMachine -- la faccia aggiuntiva conta per 1/3 dMRRBlade = 2/3 * dMRRBlade + 1/3 * dMRRBladeAddedFace dCompletionPercentage = 2/3 * dCompletionPercentage + 1/3 * dCompletionPercentageAddedFace @@ -184,6 +189,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters) end Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage) Strategy.Result.nQuality = nQuality + Strategy.Result.dTimeToMachine = dTimeToMachine Strategy.Result.dMRR = dMRRBlade return bAreAllMachiningsAdded, Strategy.Result diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 86afece..fa37994 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -621,6 +621,7 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters) local dAngleBetweenFaces = Proc.AdjacencyMatrix[1][2] -- feature convessa: lavorata come 2 facce singole con prolungamento + -- TODO qui sostituire con check topologia DoubleBevel if dAngleBetweenFaces > 10 * GEO.EPS_SMALL then -- si creano superfici singole per le facce, estese fino al box della parte local nAddGrpId = BeamLib.GetAddGroup( Part.id) diff --git a/StrategyLibs/FACEBYBLADE.lua b/StrategyLibs/FACEBYBLADE.lua index f3a0a17..818320e 100644 --- a/StrategyLibs/FACEBYBLADE.lua +++ b/StrategyLibs/FACEBYBLADE.lua @@ -80,7 +80,7 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, Part) LeadOut.dTangentDistance = 0 if Machining.bIsStartClosed or Machining.bIsEndClosed - or Machining.Steps.nCount > 1 then + or Machining.CloneStepsRadial.nCount > 1 then Machining.sLeadInOutType = 'Perpendicular' if AreSameVectorApprox( Machining.vtToolDirection, EdgeToMachine.vtN) then diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index e735eef..5286d60 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -80,7 +80,7 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, Part) LeadOut.dTangentDistance = 0 if Machining.bIsStartClosed or Machining.bIsEndClosed - or Machining.Steps.nCount > 1 then + or Machining.CloneStepsRadial.nCount > 1 then Machining.sLeadInOutType = 'Perpendicular' if AreSameVectorApprox( Machining.vtToolDirection, EdgeToMachine.vtN) then