diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 6aaf8c6..05b9306 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -1522,14 +1522,14 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part) if Machining.nType == MCH_MY.DRILLING then local function fact(n) return n == 0 and 1 or n * fact(n - 1) end local nSteps = ceil( Machining.sDepth / Machining.dStep) - local dLenghtEachStep = Machining.sDepth / nSteps + local dLengthEachStep = Machining.sDepth / nSteps -- numero dei movimenti a step, compresi andata e ritorno per scarico truciolo local nTotStepMovement = 2 * fact( nSteps) -- in feed si lavorano solo gli step - local dFeedTime = ( ( dLenghtEachStep + Machining.dStartSafetyLength) * nSteps) / dToolFeed - -- ritorno per scaricare e approccio al prossimo step seno in feed finale - local dEndFeedTime = ( dLenghtEachStep * ( nTotStepMovement - nSteps) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) * 2) / dToolEndFeed - dLengthToMachineAllStepsWithLeadInOut = dLenghtEachStep * nTotStepMovement + local dFeedTime = ( ( dLengthEachStep + Machining.dStartSafetyLength) * nSteps) / dToolFeed + -- ritorno per scaricare e approccio al prossimo step sono in feed finale + local dEndFeedTime = ( dLengthEachStep * ( nTotStepMovement - nSteps) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) * 2) / dToolEndFeed + dLengthToMachineAllStepsWithLeadInOut = dLengthEachStep * nTotStepMovement dTimeToMachineTotal = dFeedTime + dEndFeedTime elseif Machining.nType == MCH_MY.MILLING then -- stima LeadIn e LeadOut; se non settati si impostano a valori di default diff --git a/Strategies/Standard/STR0002/STR0002.json b/Strategies/Standard/STR0002/STR0002.json index ca9d2a6..43b7f08 100644 --- a/Strategies/Standard/STR0002/STR0002.json +++ b/Strategies/Standard/STR0002/STR0002.json @@ -22,6 +22,16 @@ "sMessageId": " ", "sMinUserLevel": "1" }, + { + "sName": "dExtendAfterTail", + "sNameNge": "EXTEND_AFTER_TAIL", + "sValue": "", + "sDescriptionShort": "Extend after tail", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", + "sType": "d", + "sMessageId": " ", + "sMinUserLevel": "1" + }, { "sName": "dOpenMinSafe", "sNameNge": "OPENMINSAFE", diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index f2de7a2..297db4c 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -19,6 +19,7 @@ local BeamLib = require( 'BeamLib') local BeamData = require( 'BeamDataNew') local MachiningLib = require( 'MachiningLib') local FeatureLib = require( 'FeatureLib') +local AntiSplintOnFace = require( 'ANTISPLINTONFACE') -- Tabella per definizione modulo local STR0002 = {} @@ -177,6 +178,7 @@ local function GetBestPocketingStrategy( Proc, Part) ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[1].vtN ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing') Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[1].id + Milling.bAddAntiSplint = Strategy.Parameters.bAntiSplint Milling.idProc = Proc.id Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[1].vtN Milling.dElevation = Proc.MainFaces.BottomFaces[1].dElevation @@ -214,6 +216,7 @@ local function GetBestPocketingStrategy( Proc, Part) ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing') Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[2].vtN Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[2].id + Milling.bAddAntiSplint = Strategy.Parameters.bAntiSplint Milling.idProc = Proc.id Milling.dElevation = Proc.MainFaces.BottomFaces[2].dElevation Milling.ToolInfo = {} @@ -595,8 +598,8 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters) Pocketing.Steps.dStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dStep Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dSideStep Pocketing.nToolIndex = Strategy.Machining[j].ToolInfo.nToolIndex - Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2 - Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2 + Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter / 2 + Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter / 2 Pocketing.sDepth = -Strategy.Machining[j].ToolInfo.dResidualDepth Pocketing.dResidualDepth = Strategy.Machining[j].ToolInfo.dResidualDepth -- TODO vedere se questo parametro con svuotature nuove si può rimuovere @@ -605,11 +608,35 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters) if Strategy.Machining[j].bToolInvert then Pocketing.bToolInvert = true end + -- eventuali antischeggia + if Strategy.Machining[j].bAddAntiSplint then + local OptionalParametersAntiSplint = { + bIsSplitFeature = ( #vAddId > 1), + dExtendAfterTail = Strategy.Parameters.dExtendAfterTail + } + local AntiSplints = AntiSplintOnFace.Make( Proc, Part, Proc.Faces[ Strategy.Machining[j].idFaceToMachine + 1], OptionalParametersAntiSplint) + local bAreAllAntisplintsApplicable = true + for k = 1, #AntiSplints do + if AntiSplints[k].bIsApplicable then + if bAddMachining then + bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, AntiSplints[k]) + end + else + bAreAllAntisplintsApplicable = false + end + end + if bAreAllAntisplintsApplicable then + -- TODO qui si dovrà distinguere tra antischeggia di lama e di fresa; al momento è solo di lama + if Strategy.Result.dQuality == FeatureLib.GetStrategyQuality( 'STD') then + Strategy.Result.dQuality = FeatureLib.GetStrategyQuality( 'BEST') + end + end + end -- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima if #vAddId == 1 then Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}} Pocketing.vtToolDirection = Strategy.Machining[j].vtFaceNormal - + -- TODO controllare parametro danneggiamento ammesso per decidere se spostare dopo taglio seprazione -- se è aperta sulla coda, dico che deve essere fatta dopo la separazione if Proc.AffectedFaces.bLeft then @@ -639,10 +666,10 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters) end if vtNSplitFace and AreSameVectorApprox( vtNSplitFace * EgtIf( Pocketing.bToolInvert, -1, 1), Strategy.Machining[j].vtFaceNormal) then Pocketing.Geometry = {{ nIdTm, k - 1}} - + Pocketing.dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Pocketing, Part) Strategy.Result.dTimeToMachine = Strategy.Result.dTimeToMachine + Pocketing.dTimeToMachine - + if bAddMachining then bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddMachinings( Proc, Pocketing) end diff --git a/Strategies/Standard/STR0003/STR0003.json b/Strategies/Standard/STR0003/STR0003.json index 113f7eb..f639c9d 100644 --- a/Strategies/Standard/STR0003/STR0003.json +++ b/Strategies/Standard/STR0003/STR0003.json @@ -17,7 +17,7 @@ "sNameNge": "EXTEND_AFTER_TAIL", "sValue": "", "sDescriptionShort": "Extend after tail", - "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", "sType": "d", "sMessageId": " ", "sMinUserLevel": "1" diff --git a/Strategies/Standard/STR0004/STR0004.json b/Strategies/Standard/STR0004/STR0004.json index 7524465..40c0aa9 100644 --- a/Strategies/Standard/STR0004/STR0004.json +++ b/Strategies/Standard/STR0004/STR0004.json @@ -17,7 +17,7 @@ "sNameNge": "EXTEND_AFTER_TAIL", "sValue": "", "sDescriptionShort": "Extend after tail", - "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", "sType": "d", "sMessageId": " ", "sMinUserLevel": "1" diff --git a/Strategies/Standard/STR0005/STR0005.json b/Strategies/Standard/STR0005/STR0005.json index aa8f4ba..c5575bf 100644 --- a/Strategies/Standard/STR0005/STR0005.json +++ b/Strategies/Standard/STR0005/STR0005.json @@ -17,7 +17,7 @@ "sNameNge": "EXTEND_AFTER_TAIL", "sValue": "", "sDescriptionShort": "Extend after tail", - "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", "sType": "d", "sMessageId": " ", "sMinUserLevel": "1" diff --git a/Strategies/Standard/STR0010/STR0010.json b/Strategies/Standard/STR0010/STR0010.json index 71b9f93..4b279c9 100644 --- a/Strategies/Standard/STR0010/STR0010.json +++ b/Strategies/Standard/STR0010/STR0010.json @@ -17,7 +17,7 @@ "sNameNge": "EXTEND_AFTER_TAIL", "sValue": "", "sDescriptionShort": "Extend after tail", - "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", "sType": "d", "sMessageId": " ", "sMinUserLevel": "1" diff --git a/Strategies/Standard/STR0010/STR0010.lua b/Strategies/Standard/STR0010/STR0010.lua index 63a779f..05111ce 100644 --- a/Strategies/Standard/STR0010/STR0010.lua +++ b/Strategies/Standard/STR0010/STR0010.lua @@ -356,6 +356,7 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) end -- antischeggia sulle facce di chiusura delle facce lavorate + local CalculatedMachiningsNoAntisplint = BeamLib.TableCopyDeep( CalculatedMachinings) if Strategy.Parameters.bAntiSplintWithBlade then local OptionalParametersAntiSplint = { @@ -376,8 +377,8 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) end end - -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili - Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( CalculatedMachinings) + -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili, ma non gli antischeggia (quelle alzano la qualità e sono già contemplate) + Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( CalculatedMachiningsNoAntisplint) Strategy.Result.dCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage) -- lavorazioni da applicare spostate in lista finale diff --git a/Strategies/Standard/STR0012/STR0012.json b/Strategies/Standard/STR0012/STR0012.json index ff1983f..8d0ff5b 100644 --- a/Strategies/Standard/STR0012/STR0012.json +++ b/Strategies/Standard/STR0012/STR0012.json @@ -7,7 +7,7 @@ "sNameNge": "EXTEND_AFTER_TAIL", "sValue": "", "sDescriptionShort": "Extend after tail", - "sDescriptionLong": "The automatism considers this lenght as machinable. This means you accept to damage the next piece in the bar", + "sDescriptionLong": "The automatism considers this length as machinable. This means you accept to damage the next piece in the bar", "sType": "d", "sMessageId": " ", "sMinUserLevel": "1" diff --git a/StrategyLibs/ANTISPLINTONFACE.lua b/StrategyLibs/ANTISPLINTONFACE.lua index 8cca442..3993fc2 100644 --- a/StrategyLibs/ANTISPLINTONFACE.lua +++ b/StrategyLibs/ANTISPLINTONFACE.lua @@ -20,26 +20,28 @@ function ANTISPLINTONFACE.Make( Proc, Part, Face, OptionalParameters) local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 local nInternalSortingPriority = OptionalParameters.nInternalSortingPriority or 1 local dResultWeight = OptionalParameters.dResultWeight or 0.15 - local bIgnoreGrainDirection = OptionalParameters.bIgnoreGrainDirection or false + local bMachineAllClosedEdges = OptionalParameters.bMachineAllClosedEdges or false - local ClosingFacesAgainstGrain1 = {} + local ClosingFacesAgainstGrain = {} for i = 1, #Face.Edges do local CurrentFace = Proc.Faces[Face.Edges[i].idAdjacentFace + 1] - if ( not Face.Edges[i].bIsOpen) and ( ( abs( CurrentFace.vtN:getX()) > 0.707) or bIgnoreGrainDirection) then - table.insert( ClosingFacesAgainstGrain1, CurrentFace) + if ( not Face.Edges[i].bIsOpen) and ( Face.Edges[i].bIsStartOpen or Face.Edges[i].bIsEndOpen or bMachineAllClosedEdges) then + table.insert( ClosingFacesAgainstGrain, CurrentFace) end end - for i = 1, #ClosingFacesAgainstGrain1 do + for i = 1, #ClosingFacesAgainstGrain do local EdgeToMachine = {} - for j = 1, #ClosingFacesAgainstGrain1[i].Edges do - if ClosingFacesAgainstGrain1[i].Edges[j].idAdjacentFace == Face.id then - EdgeToMachine = ClosingFacesAgainstGrain1[i].Edges[j] + for j = 1, #ClosingFacesAgainstGrain[i].Edges do + if ClosingFacesAgainstGrain[i].Edges[j].idAdjacentFace == Face.id then + EdgeToMachine = ClosingFacesAgainstGrain[i].Edges[j] break end end + local Cutting = {} local OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail} - Cutting = FaceByBlade.Make( Proc, Part, ClosingFacesAgainstGrain1[i], EdgeToMachine, OptionalParametersFaceByBlade) + Cutting = FaceByBlade.Make( Proc, Part, ClosingFacesAgainstGrain[i], EdgeToMachine, OptionalParametersFaceByBlade) + Cutting.nInternalSortingPriority = nInternalSortingPriority Cutting.dResultWeight = dResultWeight table.insert( Machinings, Cutting) diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 995af52..6425b20 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -329,14 +329,14 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) dExtendAfterTail = dExtendAfterTail, nInternalSortingPriority = 1, dResultWeight = 0.15, - bIgnoreGrainDirection = true + bMachineAllClosedEdges = true } local AntiSplints1 = AntiSplintOnFace.Make( Proc, Part, BottomFace1, OptionalParametersAntiSplint) for i = 1, #AntiSplints1 do table.insert( CalculatedMachinings, AntiSplints1[i]) end if BottomFace2 and bConvexAngle then - OptionalParametersAntiSplint.bIgnoreGrainDirection = false + OptionalParametersAntiSplint.bMachineAllClosedEdges = false local AntiSplints2 = AntiSplintOnFace.Make( Proc, Part, BottomFace2, OptionalParametersAntiSplint) for i = 1, #AntiSplints2 do table.insert( CalculatedMachinings, AntiSplints2[i]) @@ -431,7 +431,9 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) table.sort( Machinings, SortMachiningsBySegment) -- calcolo risultati - if Cuttings1[1].bIsApplicable or Cuttings1[2].bIsApplicable or Cuttings2 and ( Cuttings2[1].bIsApplicable or Cuttings2[2].bIsApplicable) then + if ( Cuttings1 and ( ( Cuttings1[1] and Cuttings1[1].bIsApplicable) or ( Cuttings1[2] and Cuttings1[2].bIsApplicable))) + or ( Cuttings2 and ( ( Cuttings2[1] and Cuttings2[1].bIsApplicable) or ( Cuttings2[2] and Cuttings2[2].bIsApplicable))) then + Result.dQuality = FeatureLib.GetStrategyQuality( Machinings) Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings) Result.dMRR = ( dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6) diff --git a/StrategyLibs/FACEBYCHAINSAW.lua b/StrategyLibs/FACEBYCHAINSAW.lua index 370af1c..645584f 100644 --- a/StrategyLibs/FACEBYCHAINSAW.lua +++ b/StrategyLibs/FACEBYCHAINSAW.lua @@ -235,7 +235,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional Mortising.CloneStepsLongitudinal.dStep = dPocketHeight end -- lunghezza lavorata - -- TODO per il calcolo della dLenghtOnX ripetere il calcolo del FACEBYBLADE con proiezione del lato; serve prolungare con la Add Length secondo la vtEdgeDirection + -- TODO per il calcolo della dlengthOnX ripetere il calcolo del FACEBYBLADE con proiezione del lato; serve prolungare con la Add Length secondo la vtEdgeDirection -- TODO fare funzione EstimatePathLength o simile Mortising.dLengthToMachine = Mortising.dEdgeLength + Mortising.LeadIn.dStartAddLength + Mortising.LeadOut.dEndAddLength Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtN:getY())