diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 04b767a..d30fbfe 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -164,6 +164,8 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part ) Machinings[nCurrentMachiningIndex].sStage = sOriginalStage end Machinings[nCurrentMachiningIndex].nFeatureSegment = j + Machinings[nCurrentMachiningIndex].dLengthToMachine = Machinings[nCurrentMachiningIndex].dEdgeLength + Machinings[nCurrentMachiningIndex].LeadIn.dStartAddLength + Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength + Machinings[nCurrentMachiningIndex].dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Machinings[nCurrentMachiningIndex]) end -- anche le lavorazioni non splittate necessitano del segmento assegnato else @@ -192,8 +194,9 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part ) Machinings[i].ptCenter = Point3d( dNextSplitX + ( dPreviousSplitX - dNextSplitX) / 2, 0, 0) end end + Machinings[i].dLengthToMachine = Machinings[i].dEdgeLength + Machinings[i].LeadIn.dStartAddLength + Machinings[i].LeadOut.dEndAddLength + Machinings[i].dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Machinings[i]) end - Machinings[i].dLengthToMachine = Machinings[i].dEdgeLength + Machinings[i].LeadIn.dStartAddLength + Machinings[i].LeadOut.dEndAddLength end return Machinings @@ -559,10 +562,10 @@ function MachiningLib.AddMachinings( Proc, Machining, AuxiliaryData) end AuxiliaryData.Clones = {} - local dOriginalRadialOffsetMortising = Machining.dRadialOffset + local dOriginalRadialOffset = Machining.dRadialOffset for i = Machining.CloneStepsVertical.nCount, 1, -1 do AuxiliaryData.Clones[i] = {} - AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffsetMortising + Machining.CloneStepsVertical.dStep * ( i - 1) + AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffset + Machining.CloneStepsVertical.dStep * ( i - 1) end end @@ -831,6 +834,29 @@ function MachiningLib.GetToolMRR( Parameters) return dMRR / pow( 10, 6) end +------------------------------------------------------------------------------------------------------------- +function MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Machining) + local dLengthToMachineAllStepsWithLeadInOut = 0 + + if Machining.nType == MCH_OY.MILLING then + if Machining.Steps.nStepType == MCH_MILL_ST.ZIGZAG then + dLengthToMachineAllStepsWithLeadInOut = ( Machining.dLengthToMachine * Machining.CloneStepsHorizontal.nCount + ( Machining.LeadIn.dTotalEstimatedDistance + Machining.LeadOut.dTotalEstimatedDistance)) * Machining.Steps.nCount + else + dLengthToMachineAllStepsWithLeadInOut = Machining.CloneStepsHorizontal.nCount * ( Machining.dLengthToMachine + Machining.LeadIn.dTotalEstimatedDistance + Machining.LeadOut.dTotalEstimatedDistance) * Machining.Steps.nCount + end + elseif Machining.nType == MCH_OY.MORTISING then + if Machining.Steps.nStepType == MCH_MILL_ST.ZIGZAG then + dLengthToMachineAllStepsWithLeadInOut = ( Machining.dLengthToMachine * Machining.Steps.nCount + 2 * ( Machining.dDepthToMachine + ( TOOLS[Machining.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))) * Machining.CloneStepsVertical.nCount + else + dLengthToMachineAllStepsWithLeadInOut = Machining.CloneStepsVertical.nCount * ( ( 2 * Machining.Steps.nCount - 1) * Machining.dLengthToMachine + 2 * 10 * ( Machining.Steps.nCount - 1) + 2 * ( Machining.dDepthToMachine + ( TOOLS[Machining.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))) + end + else + error( 'GetLengthToMachineAllStepsWithLeadInOut : unknown machining type') + end + + return dLengthToMachineAllStepsWithLeadInOut +end + ------------------------------------------------------------------------------------------------------------- function MachiningLib.PrepareMachiningsForSorting( Part) local nFeatureInternalIndex = 1 diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 1d647fc..ddb1aca 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -126,6 +126,7 @@ local function GetStrategyResult( Machinings, dFeatureVolume) else Result.sStatus = 'Not-Applicable' end + Result.dTimeToMachine = dTimeToMachine Result.dMRR = ( dFeatureVolume / dTimeToMachine) / pow( 10, 6) Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Result.dCompletionPercentage) Result.nQuality = dQualityNumerator / dQualityDenominator diff --git a/StrategyLibs/FACEBYBLADE.lua b/StrategyLibs/FACEBYBLADE.lua index 4100c59..2d66749 100644 --- a/StrategyLibs/FACEBYBLADE.lua +++ b/StrategyLibs/FACEBYBLADE.lua @@ -370,11 +370,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar Cutting.dLengthToMachine = EdgeToMachine.dLength + Cutting.LeadIn.dStartAddLength + Cutting.LeadOut.dEndAddLength local b3BoxEdge = BBox3d( Cutting.ptEdge1, Cutting.ptEdge2) Cutting.dLengthOnX = b3BoxEdge:getDimX() - if Cutting.Steps.nStepType == MCH_MILL_ST.ZIGZAG then - Cutting.dLengthToMachineAllStepsWithLeadInOut = ( Cutting.dLengthToMachine * Cutting.CloneStepsHorizontal.nCount + ( Cutting.LeadIn.dTotalEstimatedDistance + Cutting.LeadOut.dTotalEstimatedDistance)) * Cutting.Steps.nCount - else - Cutting.dLengthToMachineAllStepsWithLeadInOut = Cutting.CloneStepsHorizontal.nCount * ( Cutting.dLengthToMachine + Cutting.LeadIn.dTotalEstimatedDistance + Cutting.LeadOut.dTotalEstimatedDistance) * Cutting.Steps.nCount - end + Cutting.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Cutting) -- lunghezza impronta lama if Cutting.bIsStartClosed and Cutting.bIsEndClosed then Cutting.dBladeMarkLength = abs( min( Cutting.LeadIn.dStartAddLength, Cutting.LeadOut.dEndAddLength)) diff --git a/StrategyLibs/FACEBYCHAINSAW.lua b/StrategyLibs/FACEBYCHAINSAW.lua index 0ad9765..20aa170 100644 --- a/StrategyLibs/FACEBYCHAINSAW.lua +++ b/StrategyLibs/FACEBYCHAINSAW.lua @@ -191,7 +191,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional Mortising.Steps.nStepType = MCH_MILL_ST.ONEWAY end Mortising.Steps.dStep = TOOLS[Mortising.nToolIndex].dStep - Mortising.Steps.nCount = max( 1, ceil( ( Mortising.dDepthToMachine - ( Mortising.dMaxElev or 0)) / Mortising.Steps.dStep)) + Mortising.Steps.nCount = max( 1, ceil( ( Mortising.dDepthToMachine - ( Mortising.dMaxElev or 0) + 10 * GEO.EPS_SMALL) / Mortising.Steps.dStep)) -- faceuse if bOppositeToolDirection then Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -Mortising.vtToolDirection) @@ -221,11 +221,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional -- TODO fare funzione EstimatePathLength o simile Mortising.dLengthToMachine = Mortising.dEdgeLength + Mortising.LeadIn.dStartAddLength + Mortising.LeadOut.dEndAddLength Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtN:getY()) - if bUseZigZagMortising then - Mortising.dLengthToMachineAllStepsWithLeadInOut = ( Mortising.dLengthToMachine * Mortising.Steps.nCount + 2 * ( Mortising.dDepthToMachine + ( TOOLS[Mortising.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))) * Mortising.CloneStepsVertical.nCount - else - Mortising.dLengthToMachineAllStepsWithLeadInOut = Mortising.CloneStepsVertical.nCount * ( ( 2 * Mortising.Steps.nCount - 1) * Mortising.dLengthToMachine + 2 * 10 * ( Mortising.Steps.nCount - 1) + 2 * ( Mortising.dDepthToMachine + ( TOOLS[Mortising.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))) - end + Mortising.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Mortising) -- geometria Mortising.Geometry = {{Proc.id, FaceToMachine.id}} -- nome operazione diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index db9e450..3d14818 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -379,11 +379,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara Milling.dLengthToMachine = EdgeToMachine.dLength + Milling.LeadIn.dStartAddLength + Milling.LeadOut.dEndAddLength local b3BoxEdge = BBox3d( Milling.ptEdge1, Milling.ptEdge2) Milling.dLengthOnX = b3BoxEdge:getDimX() - if Milling.Steps.nStepType == MCH_MILL_ST.ZIGZAG then - Milling.dLengthToMachineAllStepsWithLeadInOut = ( Milling.dLengthToMachine * Milling.CloneStepsHorizontal.nCount + ( Milling.LeadIn.dTotalEstimatedDistance + Milling.LeadOut.dTotalEstimatedDistance)) * Milling.Steps.nCount - else - Milling.dLengthToMachineAllStepsWithLeadInOut = Milling.CloneStepsHorizontal.nCount * ( Milling.dLengthToMachine + Milling.LeadIn.dTotalEstimatedDistance + Milling.LeadOut.dTotalEstimatedDistance) * Milling.Steps.nCount - end + Milling.dLengthToMachineAllStepsWithLeadInOut = MachiningLib.GetLengthToMachineAllStepsWithLeadInOut( Milling) -- lunghezza impronta lama if Milling.bIsStartClosed and Milling.bIsEndClosed then Milling.dBladeMarkLength = abs( min( Milling.LeadIn.dStartAddLength, Milling.LeadOut.dEndAddLength))