diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index dd2fbd4..1afb16c 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -170,7 +170,7 @@ function BeamExec.GetToolsFromDB() elseif sToolFamily == 'SAWBLADE' then Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false come valore di default Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama - Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro + Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or Tool.dMaxMaterial -- se non settato nell'utensile, considero il massimo materiale Tool.dPerformanceIndex = 1 / ( Tool.dDiameter * Tool.dLength) Tool.nQuality = 5 -- recupero parametri propri delle motoseghe diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 4072af2..e1002ee 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -296,6 +296,7 @@ end ------------------------------------------------------------------------------------------------------------- -- restituisce le facce della parte interessate dalla feature Proc -- TODO da spostare in FeatureLib??? +-- TODO le feature 1 faccia devono essere settate aperte sulla faccia indicata dalla normale function BeamLib.GetAffectedFaces( Proc, Part) local vtFacesAffected = { bTop = false, bBottom = false, bFront = false, bBack = false, bLeft = false, bRight = false} if Proc.b3Box and not Proc.b3Box:isEmpty() then diff --git a/Strategies/Standard/HEADCUT/HEADCUT.json b/Strategies/Standard/HEADCUT/HEADCUT.json index 6d2f09e..2fac4e0 100644 --- a/Strategies/Standard/HEADCUT/HEADCUT.json +++ b/Strategies/Standard/HEADCUT/HEADCUT.json @@ -41,6 +41,16 @@ "sMessageId": " ", "sMinUserLevel": "1" }, + { + "sName": "bReduceBladePath", + "sNameNge": "REDUCE_BLADE_PATH", + "sValue": "false", + "sDescriptionShort": "Use entire blade diameter to shorten path", + "sDescriptionLong": "", + "sType": "b", + "sMessageId": " ", + "sMinUserLevel": "1" + }, { "sName": "bFinishWithMill", "sNameNge": "MILL_FINISH", diff --git a/Strategies/Standard/STR0001/STR0001.json b/Strategies/Standard/STR0001/STR0001.json index d146a54..2fa8317 100644 --- a/Strategies/Standard/STR0001/STR0001.json +++ b/Strategies/Standard/STR0001/STR0001.json @@ -65,7 +65,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/STR0003/STR0003.lua b/Strategies/Standard/STR0003/STR0003.lua index e433f9c..134850b 100644 --- a/Strategies/Standard/STR0003/STR0003.lua +++ b/Strategies/Standard/STR0003/STR0003.lua @@ -249,7 +249,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) -- primo lato del tunnel o lato di fondo if Proc.Topology.sFamily == 'Tunnel' then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Cutting = FaceByBlade.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) else Cutting = FaceByBlade.Make( Proc, Part, LongFace, BottomEdge, OptionalParameters) @@ -258,7 +258,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) -- lato opposto del tunnel if Proc.Topology.sFamily == 'Tunnel' then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Cutting = FaceByBlade.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters) Blade.AddResult( Cutting) @@ -270,7 +270,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) -- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione if BottomEdge.bIsStartOpen then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Cutting.dAreaToMachine = Cutting.dDepthToMachine * ( Cutting.dEdgeLength - Blade.Result.Bottom[1].dDepthToMachine) @@ -279,7 +279,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) -- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione if BottomEdge.bIsEndOpen then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Cutting = FaceByBlade.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Cutting.dAreaToMachine = Cutting.dDepthToMachine * ( Cutting.dEdgeLength - Blade.Result.Bottom[1].dDepthToMachine) @@ -400,7 +400,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.sSideToMachine = 'End' OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dToolMarkLength - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -409,7 +409,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.sSideToMachine = 'Start' OptionalParameters.dLengthToMachine = Blade.Result.Side[2].dToolMarkLength - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -427,14 +427,14 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) if BottomEdge.bIsStartOpen then OptionalParameters.dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) elseif BottomEdge.bIsEndOpen then OptionalParameters.dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -468,7 +468,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.dDepthToMachine = SideEdge1.dElevation + BeamData.CUT_EXTRA OptionalParameters.sSideToMachine = 'End' OptionalParameters.dLengthToMachine = Blade.Result.Side[1].dToolMarkLength - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -506,7 +506,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) OptionalParameters.dDepthToMachine = SideEdge1.dElevation + BeamData.CUT_EXTRA OptionalParameters.dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -542,7 +542,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) elseif Proc.Topology.sName == 'Tunnel-4-Through' then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' OptionalParameters.bExtendWithCornerRadius = true -- si lavora solamente l'impronta lama sul lato opposto diff --git a/Strategies/Standard/STR0004/STR0004.lua b/Strategies/Standard/STR0004/STR0004.lua index f39df5a..eb7c6af 100644 --- a/Strategies/Standard/STR0004/STR0004.lua +++ b/Strategies/Standard/STR0004/STR0004.lua @@ -178,7 +178,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) or not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) and #Proc.MainFaces.SideFaces == 1 then - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' if BottomEdge.bIsStartOpen then Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) @@ -202,7 +202,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) then OptionalParameters.dDepthToMachine = SideEdge1.dElevation + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters) Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine) @@ -236,7 +236,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) elseif Proc.Topology.sName == 'Tunnel-4-Through' then OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation + BeamData.CUT_EXTRA - OptionalParameters.bOppositeToolDirection = true + OptionalParameters.OppositeToolDirectionMode = 'Enabled' OptionalParameters.bExtendWithCornerRadius = true Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters) diff --git a/Strategies/Standard/STR0005/STR0005.json b/Strategies/Standard/STR0005/STR0005.json index 65930f0..0064e6b 100644 --- a/Strategies/Standard/STR0005/STR0005.json +++ b/Strategies/Standard/STR0005/STR0005.json @@ -103,7 +103,7 @@ { "sName": "bDisableDicing", "sNameNge": "DISABLE_DICING", - "sValue": "1", + "sValue": "false", "sDescriptionShort": "Disable dicing", "sDescriptionLong": "", "sType": "b", @@ -113,7 +113,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/STR0006/STR0006.json b/Strategies/Standard/STR0006/STR0006.json index 2d1fc5b..c19d2fd 100644 --- a/Strategies/Standard/STR0006/STR0006.json +++ b/Strategies/Standard/STR0006/STR0006.json @@ -55,7 +55,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/STR0007/STR0007.json b/Strategies/Standard/STR0007/STR0007.json index e3f71df..73e7ac6 100644 --- a/Strategies/Standard/STR0007/STR0007.json +++ b/Strategies/Standard/STR0007/STR0007.json @@ -75,7 +75,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/STR0008/STR0008.json b/Strategies/Standard/STR0008/STR0008.json index 6d2f55b..c3c27b7 100644 --- a/Strategies/Standard/STR0008/STR0008.json +++ b/Strategies/Standard/STR0008/STR0008.json @@ -45,7 +45,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/STR0012/STR0012.json b/Strategies/Standard/STR0012/STR0012.json index 9820c59..944da26 100644 --- a/Strategies/Standard/STR0012/STR0012.json +++ b/Strategies/Standard/STR0012/STR0012.json @@ -64,7 +64,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/Strategies/Standard/TAILCUT/TAILCUT.json b/Strategies/Standard/TAILCUT/TAILCUT.json index c22bea6..ea2560f 100644 --- a/Strategies/Standard/TAILCUT/TAILCUT.json +++ b/Strategies/Standard/TAILCUT/TAILCUT.json @@ -44,7 +44,7 @@ { "sName": "bReduceBladePath", "sNameNge": "REDUCE_BLADE_PATH", - "sValue": "true", + "sValue": "false", "sDescriptionShort": "Use entire blade diameter to shorten path", "sDescriptionLong": "", "sType": "b", diff --git a/StrategyLibs/BLADEKEEPWASTE.lua b/StrategyLibs/BLADEKEEPWASTE.lua index 7a3379c..aacb8ac 100644 --- a/StrategyLibs/BLADEKEEPWASTE.lua +++ b/StrategyLibs/BLADEKEEPWASTE.lua @@ -225,7 +225,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters) Cutting1.dResultWeight = 0.3 table.insert( CalculatedMachinings, Cutting1) -- secondo lato - OptionalParametersFaceByBlade.bOppositeToolDirection = true + OptionalParametersFaceByBlade.OppositeToolDirectionMode = 'Enabled' Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, BottomEdgeToMachine, OptionalParametersFaceByBlade) Cutting2.nInternalSortingPriority = 3 Cutting2.dResultWeight = 0.3 diff --git a/StrategyLibs/BLADETOWASTE.lua b/StrategyLibs/BLADETOWASTE.lua index 5118cd4..dfc4bfe 100644 --- a/StrategyLibs/BLADETOWASTE.lua +++ b/StrategyLibs/BLADETOWASTE.lua @@ -99,26 +99,60 @@ end local function CompareEdgesTopHeadGuillotine( EdgeA, EdgeB) - -- prima i lati a minore elevazione (se entro 5 mm si considerano uguali) - if EdgeA.dElevation < EdgeB.dElevation - 5 then + -- prima il lato sotto + if ( EdgeA.vtN:getZ()) > 0.98 + 10 * GEO.EPS_SMALL and ( EdgeB.vtN:getZ()) < 0.98 + 10 * GEO.EPS_SMALL then return true - elseif EdgeA.dElevation > EdgeB.dElevation + 5 then + elseif ( EdgeA.vtN:getZ()) < 0.98 + 10 * GEO.EPS_SMALL and ( EdgeB.vtN:getZ()) > 0.98 + 10 * GEO.EPS_SMALL then return false - -- se stessa elevazione si preferiscono i lati più in basso (testa sopra) else - if EdgeA.vtN:getZ() > EdgeB.vtN:getZ() + 10 * GEO.EPS_SMALL then - return true - elseif EdgeA.vtN:getZ() < EdgeB.vtN:getZ() - 10 * GEO.EPS_SMALL then - return false - -- se stessa Z si preferiscono i lati verso il fronte della trave - else - if EdgeA.vtN:getY() > EdgeB.vtN:getY() + 10 * GEO.EPS_SMALL then + -- se entrambi lati sotto, si sceglie quello a minor elevazione + if EdgeA.vtN:getZ() > 0.98 + 10 * GEO.EPS_SMALL and EdgeB.vtN:getZ() > 0.98 + 10 * GEO.EPS_SMALL then + if EdgeA.dElevation < EdgeB.dElevation - 10 * GEO.EPS_SMALL then return true - elseif EdgeA.vtN:getY() < EdgeB.vtN:getY() - 10 * GEO.EPS_SMALL then + elseif EdgeA.dElevation > EdgeB.dElevation + 10 * GEO.EPS_SMALL then return false else return false end + -- se entrambi non lati sotto, si sceglie quello con normale non oltre l'orizzontale + elseif ( EdgeA.vtN:getZ()) > -0.1 + 10 * GEO.EPS_SMALL and ( EdgeB.vtN:getZ()) < -0.1 + 10 * GEO.EPS_SMALL then + return true + elseif ( EdgeA.vtN:getZ()) < -0.1 + 10 * GEO.EPS_SMALL and ( EdgeB.vtN:getZ()) > -0.1 + 10 * GEO.EPS_SMALL then + return false + else + -- se entrambi entro l'orizzontale, si sceglie quello a minor elevazione + if EdgeA.vtN:getZ() > -0.1 + 10 * GEO.EPS_SMALL and EdgeB.vtN:getZ() > -0.1 + 10 * GEO.EPS_SMALL then + if EdgeA.dElevation < EdgeB.dElevation - 10 * GEO.EPS_SMALL then + return true + elseif EdgeA.dElevation > EdgeB.dElevation + 10 * GEO.EPS_SMALL then + return false + else + return false + end + -- se entrambi oltre l'orizzontale, si sceglie quello più verso l'orizzontale + else + if EdgeA.vtN:getZ() > EdgeB.vtN:getZ() + 100 * GEO.EPS_SMALL then + return true + elseif EdgeA.vtN:getZ() < EdgeB.vtN:getZ() - 100 * GEO.EPS_SMALL then + return false + -- se stessa Z si preferiscono i lati a minore elevazione + else + if EdgeA.dElevation < EdgeB.dElevation - 5 then + return true + elseif EdgeA.dElevation > EdgeB.dElevation + 5 then + return false + -- se stessa elevazione si preferiscono i lati più lunghi + else + if EdgeA.dLength > EdgeB.dLength + 10 * GEO.EPS_SMALL then + return true + elseif EdgeA.dLength < EdgeB.dLength - 10 * GEO.EPS_SMALL then + return false + else + return false + end + end + end + end end end end @@ -300,6 +334,13 @@ local function CutWholeWaste( Proc, Part, OptionalParameters) local dDepthToMachine = 0 local dCompletionPercentage = 0 + -- controlli preventivi + local bIsFeatureLong = FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) + if bIsFeatureLong then + Result = FeatureLib.GetStrategyResultNotApplicable('Feature too long') + return Machinings, Result + end + -- parametri opzionali e default if not OptionalParameters then OptionalParameters = {} @@ -345,7 +386,6 @@ local function CutWholeWaste( Proc, Part, OptionalParameters) nToolIndex = ToolInfo.nToolIndex sChosenBladeType = 'TopGuillotine' end - end end @@ -376,7 +416,10 @@ local function CutWholeWaste( Proc, Part, OptionalParameters) dExtendAfterTail = dExtendAfterTail, bReduceBladePath = bReduceBladePath } - + if sChosenBladeType == 'Top' or sChosenBladeType == 'Bottom' then + OptionalParametersFaceByBlade.OppositeToolDirectionMode = 'Optimized' + end + Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParametersFaceByBlade) end if Cutting.bIsApplicable then @@ -392,14 +435,14 @@ local function CutWholeWaste( Proc, Part, OptionalParameters) else Result.sStatus = 'Not-Completed' end + Result.dCompletionPercentage = dCompletionPercentage + Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage) + Result.nQuality = TOOLS[nToolIndex].nQuality + Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( {Cutting}) + Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6) else - Result.sStatus = 'Not-Applicable' + Result = FeatureLib.GetStrategyResultNotApplicable() end - Result.dCompletionPercentage = dCompletionPercentage - Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage) - Result.nQuality = TOOLS[nToolIndex].nQuality - Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( {Cutting}) - Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6) return Machinings, Result end @@ -781,7 +824,6 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters) elseif Result1.sStatus == 'Completed' or Result2.sStatus == 'Completed' then Result.sStatus = 'Not-Completed' else - Result.sStatus = 'Not-Applicable' Result = FeatureLib.GetStrategyResultNotApplicable() end diff --git a/StrategyLibs/FACEBYBLADE.lua b/StrategyLibs/FACEBYBLADE.lua index b9bfec9..d9721f2 100644 --- a/StrategyLibs/FACEBYBLADE.lua +++ b/StrategyLibs/FACEBYBLADE.lua @@ -226,9 +226,7 @@ function FACEBYBLADE.GetRadialOffsetForGuillotine( nToolIndex, dEdgeLength, Opti end --- TODO EdgeToMachineAlternative da gestire --- TODO invert avanzato (direzione, Z, alternativa, ...) da gestire --- TODO bilinea da gestire +-- TODO EdgeToMachineAlternative da gestire? function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters) local Cutting = MachiningLib.InitMachiningParameters( MCH_MY.MILLING) Cutting.bIsApplicable = true @@ -250,7 +248,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar local dPocketHeight = OptionalParameters.dPocketHeight or 0 local dDepthToMachine = OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false - local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false + local OppositeToolDirectionMode = OptionalParameters.OppositeToolDirectionMode or 'Disabled' local bReduceBladePath = OptionalParameters.bReduceBladePath or false local sDepth = OptionalParameters.sDepth or 0 local nToolIndex = OptionalParameters.nToolIndex @@ -264,7 +262,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- lunghezze, direzioni e punti caratteristici della lavorazione e del lato lavorato Cutting.dEdgeLength = EdgeToMachine.dLength - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Cutting.vtToolDirection = -EdgeToMachine.vtN else Cutting.vtToolDirection = EdgeToMachine.vtN @@ -340,7 +338,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- inizio e fine aperti o chiusi Cutting.bIsStartClosed = not EdgeToMachine.bIsStartOpen Cutting.bIsEndClosed = not EdgeToMachine.bIsEndOpen - -- lato di lavoro e inversione + -- lato di lavoro e inversione per avere taglio concorde if TOOLS[Cutting.nToolIndex].bIsCCW then Cutting.nWorkside = MCH_MILL_WS.RIGHT Cutting.bInvert = true @@ -348,7 +346,32 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar Cutting.nWorkside = MCH_MILL_WS.LEFT Cutting.bInvert = false end - if bOppositeToolDirection then + -- se OppositeToolDirectionMode è Optimized, se possibile e necessario, si attiva per garantire taglio concorde e verso l'alto (massima qualità) + if ( OppositeToolDirectionMode == 'Optimized') and ( Proc.nFct == 1) and ( FaceData.IsFaceRectangular( Proc, FaceToMachine.id)) then + OppositeToolDirectionMode = 'Disabled' + -- la direzione di percorrenza del lato deve essere verso l'alto; bInvert va considerata perchè inverte la direzione di percorrenza. + if ( Cutting.bInvert and Cutting.vtEdgeDirection:getZ() > 100 * GEO.EPS_SMALL) + or ( ( not Cutting.bInvert) and Cutting.vtEdgeDirection:getZ() < -100 * GEO.EPS_SMALL) then + + -- si attiva OppositeToolDirection solo se non cambiano le condizioni di taglio downUp + local dNewMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, -Cutting.vtToolDirection, TOOLS[nToolIndex]) + if ( FaceToMachine.vtN:getZ() < dMinNzDownUp) == ( FaceToMachine.vtN:getZ() < dNewMinNzDownUp) then + OppositeToolDirectionMode = 'Enabled' + Cutting.vtToolDirection = -EdgeToMachine.vtN + Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Cutting.vtToolDirection, GDB_ID.ROOT) + Cutting.bInvert = not Cutting.bInvert + -- se le condizioni downUp cambiano, si setta per tagliare verso l'alto + else + if Cutting.nWorkside == MCH_MILL_WS.RIGHT then + Cutting.nWorkside = MCH_MILL_WS.LEFT + Cutting.bInvert = false + else + Cutting.nWorkside = MCH_MILL_WS.RIGHT + Cutting.bInvert = true + end + end + end + elseif OppositeToolDirectionMode == 'Enabled' then Cutting.bInvert = not Cutting.bInvert end if Cutting.bToolInvert then @@ -360,7 +383,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- TODO la depth dovrebbe essere quella del machining Cutting.dDepthToMachine = dDepthToMachine Cutting.dResidualDepth = 0 - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Cutting.dRadialOffset = -dDepthToMachine else Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine @@ -368,7 +391,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar else Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1 Cutting.dResidualDepth = dDepthToMachine - Cutting.dDepthToMachine - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Cutting.dRadialOffset = -Cutting.dDepthToMachine else Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine @@ -397,7 +420,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar end end end - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Cutting.dRadialOffset = -dDepthToMachine else Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine @@ -423,7 +446,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar -- overlap Cutting.dOverlap = 0 -- EdgeUse e frame lavorazione - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( -Cutting.vtToolDirection) --Cutting.vtFaceUse = -Cutting.vtToolDirection Cutting.nEdgesFaceUse = EdgeToMachine.id diff --git a/StrategyLibs/FACEBYCHAINSAW.lua b/StrategyLibs/FACEBYCHAINSAW.lua index 0646f49..521c2dc 100644 --- a/StrategyLibs/FACEBYCHAINSAW.lua +++ b/StrategyLibs/FACEBYCHAINSAW.lua @@ -71,13 +71,13 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 local dPocketHeight = OptionalParameters.dPocketHeight or 0 local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false - local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false + local OppositeToolDirectionMode = OptionalParameters.OppositeToolDirectionMode or 'Disabled' local sDepth = OptionalParameters.sDepth or 'TH' local dLongitudinalStepSpan = OptionalParameters.dLongitudinalStepSpan -- lunghezze e punti caratteristici della lavorazione e del lato lavorato Mortising.dEdgeLength = EdgeToMachine.dLength - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Mortising.vtToolDirection = -EdgeToMachine.vtN else Mortising.vtToolDirection = EdgeToMachine.vtN @@ -129,7 +129,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen -- lato di lavoro e inversioni Mortising.bInvert = false - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Mortising.nWorkside = MCH_MILL_WS.LEFT Mortising.bToolInvert = true else @@ -143,7 +143,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional if TOOLS[Mortising.nToolIndex].dMaxMaterial > dDepthToMachine - 10 * GEO.EPS_SMALL then Mortising.dDepthToMachine = dDepthToMachine Mortising.dResidualDepth = 0 - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - dDepthToMachine else Mortising.dLongitudinalOffset = 0 @@ -151,7 +151,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional else Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1 Mortising.dResidualDepth = dDepthToMachine - Mortising.dDepthToMachine - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Mortising.dLongitudinalOffset = 0 else Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine @@ -181,7 +181,7 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional Mortising.Steps.dStep = TOOLS[Mortising.nToolIndex].dStep Mortising.Steps.nCount = max( 1, ceil( ( min( Mortising.dDepthToMachine, ( Mortising.dMaxElev or Mortising.dDepthToMachine)) + 10 * GEO.EPS_SMALL) / Mortising.Steps.dStep)) -- faceuse - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -Mortising.vtToolDirection) else Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( Mortising.vtToolDirection) diff --git a/StrategyLibs/FACEBYMILL.lua b/StrategyLibs/FACEBYMILL.lua index 46617db..d020e76 100644 --- a/StrategyLibs/FACEBYMILL.lua +++ b/StrategyLibs/FACEBYMILL.lua @@ -186,7 +186,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara local dPocketHeight = OptionalParameters.dPocketHeight or 0 local dDepthToMachine = OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false - local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false + local OppositeToolDirectionMode = OptionalParameters.OppositeToolDirectionMode or 'Disabled' local sDepth = OptionalParameters.sDepth or 0 local nToolIndex = OptionalParameters.nToolIndex local dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0 @@ -199,7 +199,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- lunghezze, direzioni e punti caratteristici della lavorazione e del lato lavorato Milling.dEdgeLength = EdgeToMachine.dLength - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.vtToolDirection = -EdgeToMachine.vtN else Milling.vtToolDirection = EdgeToMachine.vtN @@ -287,7 +287,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara Milling.nWorkside = MCH_MILL_WS.LEFT Milling.bInvert = false end - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.bInvert = not Milling.bInvert end if Milling.bToolInvert then @@ -299,7 +299,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- TODO la depth dovrebbe essere quella del machining Milling.dDepthToMachine = dDepthToMachine Milling.dResidualDepth = 0 - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.dRadialOffset = -dDepthToMachine else Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine @@ -307,7 +307,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara else Milling.dDepthToMachine = TOOLS[Milling.nToolIndex].dSideDepth - 1 Milling.dResidualDepth = dDepthToMachine - Milling.dDepthToMachine - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.dRadialOffset = -Milling.dDepthToMachine else Milling.dRadialOffset = EdgeToMachine.dElevation - Milling.dDepthToMachine @@ -316,7 +316,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara else Milling.dDepthToMachine = dDepthToMachine Milling.dResidualDepth = 0 - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.dRadialOffset = -dDepthToMachine else Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine @@ -350,7 +350,7 @@ function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPara -- overlap Milling.dOverlap = 0 -- faceuse e frame lavorazione - if bOppositeToolDirection then + if OppositeToolDirectionMode == 'Enabled' then Milling.nFaceuse = BeamLib.GetNearestOrthoOpposite( -Milling.vtToolDirection) --Milling.vtFaceUse = -Milling.vtToolDirection Milling.nEdgesFaceUse = EdgeToMachine.id