diff --git a/LuaLibs/BasicCustomerStrategies.lua b/LuaLibs/BasicCustomerStrategies.lua index e976d26..a27b17a 100644 --- a/LuaLibs/BasicCustomerStrategies.lua +++ b/LuaLibs/BasicCustomerStrategies.lua @@ -85,7 +85,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Front Slot (0-17) @@ -103,12 +103,12 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Birds Mouth (0-20) elseif ID.IsBirdsMouth( Proc) then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Hip or Valley Rafter Notch (0-25) elseif ID.IsHipValleyRafterNotch( Proc) then @@ -128,7 +128,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Lap Joint (0-30) @@ -146,7 +146,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Notch/Rabbet (0-32) @@ -164,7 +164,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Block Haus (0-33) @@ -188,7 +188,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : French Ridge Lap (1-35) @@ -218,7 +218,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Drilling (0-40) @@ -243,7 +243,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end @@ -263,7 +263,7 @@ local function GetStrategies_Egalware( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end @@ -315,6 +315,7 @@ local function GetStrategies_Egalware( Proc) --------------------------------------------------------------------- -- Feature : Head Convex Profile (0-102) elseif ID.IsHeadConvexProfile( Proc) then + Strategies = { { sStrategyId = 'STR0009'}} --------------------------------------------------------------------- -- Feature : Head Cambered Profile (0-103) elseif ID.IsHeadCamberedProfile( Proc) then @@ -409,7 +410,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Front Slot (0-17) @@ -427,12 +428,12 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Birds Mouth (0-20) elseif ID.IsBirdsMouth( Proc) then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} --------------------------------------------------------------------- -- Feature : Hip or Valley Rafter Notch (0-25) elseif ID.IsHipValleyRafterNotch( Proc) then @@ -452,7 +453,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Lap Joint (0-30) @@ -470,7 +471,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Notch/Rabbet (0-32) @@ -488,7 +489,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Block Haus (0-33) @@ -512,7 +513,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : French Ridge Lap (1-35) @@ -542,7 +543,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} end --------------------------------------------------------------------- -- Feature : Drilling (0-40) @@ -567,7 +568,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end @@ -587,7 +588,7 @@ local function GetStrategies_Essetre( Proc) elseif Proc.Topology.sName == 'Bevel-3-Blind' then Strategies = { { sStrategyId = 'STR0002'}} elseif Proc.Topology.sName == 'Rabbet-2-Through' then - Strategies = { { sStrategyId = 'STR0002'}} + Strategies = { { sStrategyId = 'STR0002'}, { sStrategyId = 'STR0010'}} elseif Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' or Proc.Topology.sName == 'Pocket-Round-Through' then Strategies = { { sStrategyId = 'STR0008'}} end @@ -639,6 +640,7 @@ local function GetStrategies_Essetre( Proc) --------------------------------------------------------------------- -- Feature : Head Convex Profile (0-102) elseif ID.IsHeadConvexProfile( Proc) then + Strategies = { { sStrategyId = 'STR0009'}} --------------------------------------------------------------------- -- Feature : Head Cambered Profile (0-103) elseif ID.IsHeadCamberedProfile( Proc) then @@ -701,8 +703,8 @@ local function GetParameters_Essetre( Proc, sStrategyIdToGet) if sStrategyIdToGet == 'HEADCUT' then local dDepthChamfer = 0 -- eventuali informazioni da recuperare sulla feature sostituita - if Proc.SubstitutedProc then - dDepthChamfer = EgtGetInfo( Proc.SubstitutedProc.id or GDB_ID.NULL, 'Q06', 'd') or 0 + if Proc.SlaveProcIndexes then + dDepthChamfer = EgtGetInfo( Proc.SlaveProcIndexes or GDB_ID.NULL, 'Q06', 'd') or 0 end Parameters = { { sName = 'dDepthChamfer', sValue = dDepthChamfer, sType = 'd'}} end diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index de23e49..cbcca7f 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -257,9 +257,9 @@ local function IsCombinationAvailable( sCombination, nUnloadPos, bSquareSection) -- TODO scelta combinazione forzato DA RIMUOVERE!! Serve modifica al BEAM. BEAM.BeamWall = true BEAM.Rotation = {} - BEAM.Rotation.bBasic = true + BEAM.Rotation.bBasic = false BEAM.Rotation.bNoRotation = false - BEAM.Rotation.bAdvanced = false + BEAM.Rotation.bAdvanced = true -------------------------------------------------------------------------- -- BASIC : posizione di scarico come posizionamento iniziale @@ -1241,8 +1241,11 @@ local function GetBestCombination( ListToCompare) nIndexBestCombination = ListIndex -- altrimenti guardo il voto else + -- si sceglie soluzione con più feature complete + if ListToCompare[ListIndex].nComplete > ListToCompare[nIndexBestCombination].nComplete then + nIndexBestCombination = ListIndex -- se stesso voto - if ListToCompare[nIndexBestCombination].dTotalRating == ListToCompare[ListIndex].dTotalRating then + elseif ListToCompare[nIndexBestCombination].dTotalRating == ListToCompare[ListIndex].dTotalRating then -- TODO il voto dovrebbe essere considerato già pesando le rotazioni, con un coefficiente o un peso fisso aggiuntivo -- scelgo soluzione con meno rotazioni if ListToCompare[nIndexBestCombination].nRotations > ListToCompare[ListIndex].nRotations then @@ -1374,51 +1377,58 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo) -- tagli testa e coda vengono aggiunti sempre alla fine for nProc = 1, #ProcessingsOnPart.Rotation[1] do if ProcessingsOnPart.Rotation[1][nProc].nPrc ~= 340 and ProcessingsOnPart.Rotation[1][nProc].nPrc ~= 350 then - -- ciclo sulle rotazioni - local nNextRot = nUnloadPos - local ResultsList = {} - for nRotation = 1, 3 do - -- se rotazione abilitata da combinazione - if string.sub( PartInfo.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then - -- se è ultima rotazione oppure se feature non impatta su misura laser, allora è valida e può essere effettivamente considerata - if nNextRot == nUnloadPos or not( ProcessingsOnPart.Rotation[nNextRot][nProc].bHindersLaserMeasure) then - -- controllo se è stata scelta una strategia - if ProcessingsOnPart.Rotation[nNextRot][nProc].ChosenStrategy then - local Proc = {} - Proc.nRotation = nNextRot - table.insert( Proc, ProcessingsOnPart.Rotation[nNextRot][nProc]) - table.insert( ResultsList, Proc) - end - end - end - nNextRot = EgtIf( nNextRot + 1 > 4, nNextRot + 1 - 4, nNextRot + 1) - end - - -- se la feature può essere lavorata in almeno una rotazione - if #ResultsList > 0 then - local Proc, Data = GetProcBestMachRotationFromList( ResultsList) - Proc.nIndexRotation = Data.nIndexRotation - -- inserisco la Proc nell'apposita lista - if Data.nIndexRotation == nUnloadPos then - table.insert( SingleCombination.Rot0, Proc) - elseif Data.nIndexRotation == nUnloadPos + 1 then - table.insert( SingleCombination.Rot90, Proc) - bRot90 = true - else - table.insert( SingleCombination.Rot180, Proc) - bRot180 = true - end - - SingleCombination.dTotalRating = SingleCombination.dTotalRating + Data.dCompositeRating - SingleCombination.nComplete = SingleCombination.nComplete + EgtIf( Data.bComplete, 1, 0) - SingleCombination.nNotComplete = SingleCombination.nNotComplete + EgtIf( Data.bNotComplete, 1, 0) - SingleCombination.nNotExecute = SingleCombination.nNotExecute + EgtIf( Data.bNotApplicable, 1, 0) - SingleCombination.nIndexInCombinationList = i - SingleCombination.nIndexRotation = nUnloadPos - else + -- se feature disattivata perchè eseguita da master a lei associata dichiaro comunque eseguita + if ProcessingsOnPart.Rotation[1][nProc].nFlg == 0 and ProcessingsOnPart.Rotation[1][nProc].nIndexMasterProc then ProcessingsOnPart.Rotation[1][nProc].nIndexRotation = nUnloadPos table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[1][nProc]) - SingleCombination.nNotExecute = SingleCombination.nNotExecute + 1 + SingleCombination.nComplete = SingleCombination.nComplete + 1 + else + -- ciclo sulle rotazioni + local nNextRot = nUnloadPos + local ResultsList = {} + for nRotation = 1, 3 do + -- se rotazione abilitata da combinazione + if string.sub( PartInfo.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then + -- se è ultima rotazione oppure se feature non impatta su misura laser, allora è valida e può essere effettivamente considerata + if nNextRot == nUnloadPos or not( ProcessingsOnPart.Rotation[nNextRot][nProc].bHindersLaserMeasure) then + -- controllo se è stata scelta una strategia + if ProcessingsOnPart.Rotation[nNextRot][nProc].ChosenStrategy then + local Proc = {} + Proc.nRotation = nNextRot + table.insert( Proc, ProcessingsOnPart.Rotation[nNextRot][nProc]) + table.insert( ResultsList, Proc) + end + end + end + nNextRot = EgtIf( nNextRot + 1 > 4, nNextRot + 1 - 4, nNextRot + 1) + end + + -- se la feature può essere lavorata in almeno una rotazione + if #ResultsList > 0 then + local Proc, Data = GetProcBestMachRotationFromList( ResultsList) + Proc.nIndexRotation = Data.nIndexRotation + -- inserisco la Proc nell'apposita lista + if Data.nIndexRotation == nUnloadPos then + table.insert( SingleCombination.Rot0, Proc) + elseif Data.nIndexRotation == nUnloadPos + 1 then + table.insert( SingleCombination.Rot90, Proc) + bRot90 = true + else + table.insert( SingleCombination.Rot180, Proc) + bRot180 = true + end + + SingleCombination.dTotalRating = SingleCombination.dTotalRating + Data.dCompositeRating + SingleCombination.nComplete = SingleCombination.nComplete + EgtIf( Data.bComplete, 1, 0) + SingleCombination.nNotComplete = SingleCombination.nNotComplete + EgtIf( Data.bNotComplete, 1, 0) + SingleCombination.nNotExecute = SingleCombination.nNotExecute + EgtIf( Data.bNotApplicable, 1, 0) + SingleCombination.nIndexInCombinationList = i + SingleCombination.nIndexRotation = nUnloadPos + else + ProcessingsOnPart.Rotation[1][nProc].nIndexRotation = nUnloadPos + table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[1][nProc]) + SingleCombination.nNotExecute = SingleCombination.nNotExecute + 1 + end end else if ProcessingsOnPart.Rotation[1][nProc].nPrc == 340 then diff --git a/Strategies/Standard/STR0010/STR0010.lua b/Strategies/Standard/STR0010/STR0010.lua index 79fa324..835f5f8 100644 --- a/Strategies/Standard/STR0010/STR0010.lua +++ b/Strategies/Standard/STR0010/STR0010.lua @@ -82,7 +82,8 @@ end ------------------------------------------------------------------------------------------------------------- local function IsTopologyOk( Proc) - if Proc.Topology.sFamily == 'Bevel' then + if Proc.Topology.sFamily == 'Bevel' or Proc.Topology.sFamily == 'DoubleBevel' or + Proc.Topology.sName == 'VGroove-2-Through' or Proc.Topology.sName == 'Rabbet-2-Through' then return true else return false @@ -109,6 +110,50 @@ local function IsPositionOK( Proc, Part) return true end +------------------------------------------------------------------------------------------------------------- +-- TODO da sistemare +local function GetBottomFaceEdge( Proc, nIndexFace) + local Edge = {} + + -- si lavora la bottom longitudinalmente + if Proc.nFct == 1 or Proc.Topology.sFamily == 'DoubleBevel' then + local BottomEdgesSorted = {} + for i = 1, #Proc.MainFaces.BottomFaces[nIndexFace].Edges do + table.insert( BottomEdgesSorted, Proc.MainFaces.BottomFaces[nIndexFace].Edges[i]) + end + table.sort( BottomEdgesSorted, CompareEdges) + Edge = BottomEdgesSorted[1] + -- edge in comune tra le due facce + elseif Proc.nFct == 2 then + Edge = Proc.MainFaces.BottomFaces[nIndexFace].MainEdges.LongEdges[1] + else + Edge = Proc.MainFaces.BottomFaces[nIndexFace].MainEdges.LongEdges[1] + end + + return Edge +end + +------------------------------------------------------------------------------------------------------------- +local function SortMachiningsBySegment( MachiningA, MachiningB) + if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then + return false + elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then + return true + else + if TOOLS[ MachiningA.nToolIndex].sFamily == 'SAWBLADE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'MORTISE' then + return true + elseif TOOLS[ MachiningA.nToolIndex].sFamily == 'MORTISE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'SAWBLADE' then + return false + else + if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then + return true + elseif MachiningB.sEdgeType == 'Side' and MachiningA.sEdgeType ~= 'Side' then + return false + end + end + end +end + ------------------------------------------------------------------------------------------------------------- function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) -- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) @@ -148,53 +193,61 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters) dExtendAfterTail = 10000 end - -- si trova il lato della faccia di fondo da lavorare - local BottomEdgesSorted = {} - for i = 1, #Proc.MainFaces.BottomFaces[1].Edges do - table.insert( BottomEdgesSorted, Proc.MainFaces.BottomFaces[1].Edges[i]) - end - table.sort( BottomEdgesSorted, CompareEdges) - - -- lavorazione faccia bottom con fresa + -- lavorazione della BottomFace local bAreAllMachiningsAdded = true - local dDepthToMachine = BottomEdgesSorted[1].dElevation + 5 - local OptionalParametersFaceByMill = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail} - -- primo lato local Milling = {} - Milling = FaceByMill.Make( Proc, Part, Proc.MainFaces.BottomFaces[1], BottomEdgesSorted[1], OptionalParametersFaceByMill) - + local OptionalParametersFaceByMill = { nStepType = MCH_MILL_ST.ONEWAY, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail} + local EdgeToMachine = GetBottomFaceEdge( Proc, 1) + if EdgeToMachine.bIsOpen then + OptionalParametersFaceByMill.dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA + end + Milling = FaceByMill.Make( Proc, Part, Proc.MainFaces.BottomFaces[1], EdgeToMachine, OptionalParametersFaceByMill) if Milling.bIsApplicable then - -- lavorazioni da applicare spostate in lista finale table.insert( Strategy.Machinings, Milling) + end - -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili - Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( Strategy.Machinings) - Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage) - - local MachiningResult = MachiningLib.GetSplitMachinings( Strategy.Machinings, FeatureSplittingPoints, Part) - - Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( MachiningResult) - Strategy.Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( MachiningResult) - Strategy.Result.dMRR = ( dFeatureVolume / Strategy.Result.dTimeToMachine) / pow( 10, 6) - if Strategy.Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then - Strategy.Result.sStatus = 'Completed' - else - Strategy.Result.sStatus = 'Not-Completed' + -- si lavora seconda BottomFace + if Proc.Topology.sFamily == 'DoubleBevel' then + Milling = {} + OptionalParametersFaceByMill = { nStepType = MCH_MILL_ST.ONEWAY, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail} + EdgeToMachine = GetBottomFaceEdge( Proc, 2) + if EdgeToMachine.bIsOpen then + OptionalParametersFaceByMill.dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA end - - -- aggiunta lavorazioni + Milling = FaceByMill.Make( Proc, Part, Proc.MainFaces.BottomFaces[2], EdgeToMachine, OptionalParametersFaceByMill) + if Milling.bIsApplicable then + table.insert( Strategy.Machinings, Milling) + end + end + + -- calcolo completamento, serve la lista di lavorazioni che comprende le non applicabili + Strategy.Result.dCompletionPercentage = GetStrategyCompletionPercentage( Strategy.Machinings) + Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage) + + Strategy.Machinings = MachiningLib.GetSplitMachinings( Strategy.Machinings, FeatureSplittingPoints, Part) + table.sort( Strategy.Machinings, SortMachiningsBySegment) + + Strategy.Result.nQuality = FeatureLib.GetStrategyQuality( Strategy.Machinings) + Strategy.Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Strategy.Machinings) + Strategy.Result.dMRR = ( dFeatureVolume / Strategy.Result.dTimeToMachine) / pow( 10, 6) + if Strategy.Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then + Strategy.Result.sStatus = 'Completed' + else + Strategy.Result.sStatus = 'Not-Completed' + end + + -- aggiunta lavorazioni + if #Strategy.Machinings > 0 then if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then -- aggiunge lavorazione - for j = 1, #MachiningResult do - bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, MachiningResult[j]) + for j = 1, #Strategy.Machinings do + bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j]) end end - else Strategy.Result = FeatureLib.GetStrategyResultNotApplicable() end - return bAreAllMachiningsAdded, Strategy.Result end diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index bcdbb99..9241198 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -327,13 +327,13 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- step verticale e offset longitudinale if OptionalParameters.dPocketHeight then Milling.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Milling.nToolIndex].dMaxMaterial) - Milling.Steps.nStepType = MCH_MILL_ST.ONEWAY + Milling.Steps.nStepType = OptionalParameters.nStepType or MCH_MILL_ST.ONEWAY Milling.dMaxElev = Milling.Steps.dStep * Milling.Steps.nCount - 10 * GEO.EPS_SMALL else Milling.Steps = {} Milling.Steps.dStep = TOOLS[Milling.nToolIndex].dStep Milling.Steps.nCount = ceil( ( FaceToMachine.dElevation - 50 * GEO.EPS_SMALL) / Milling.Steps.dStep) - Milling.Steps.nStepType = MCH_MILL_ST.ZIGZAG + Milling.Steps.nStepType = OptionalParameters.nStepType or MCH_MILL_ST.ZIGZAG Milling.dMaxElev = FaceToMachine.dElevation end if Milling.bToolInvert then