diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index b2e443e..8c1991f 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -324,16 +324,17 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters) Edge = Edge, vtNFace = Face.vtN, vtHead = vtHead, - Tool = Tool + Tool = Tool, + nSCC = Tool.SetupInfo.GetSCC( Edge.vtN, Edge.vtEdge, Face.vtN) } -- check punti lavorazione -- lavorazione oltre le corse: non fattibile - local PointsToCheck = { - Edge.ptStart + Edge.vtN * ( Edge.dElevation - dDepthToMachine), - Edge.ptEnd + Edge.vtN * ( Edge.dElevation - dDepthToMachine) + local PointsOnToolTipCenter = { + PreSimulationLib.GetPointOnToolTipCenter( Edge.ptStart + Edge.vtN * ( Edge.dElevation - dDepthToMachine), vtHead, Face.vtN, Edge.vtN, Tool), + PreSimulationLib.GetPointOnToolTipCenter( Edge.ptEnd + Edge.vtN * ( Edge.dElevation - dDepthToMachine), vtHead, Face.vtN, Edge.vtN, Tool) } - local bOutOfStroke = PreSimulationLib.CheckOutOfStroke( PointsToCheck, CheckOutOfStrokeParameters) + local bOutOfStroke = PreSimulationLib.CheckOutOfStroke( PointsOnToolTipCenter, CheckOutOfStrokeParameters) if bOutOfStroke then return false end @@ -349,8 +350,12 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters) -- attacco perpendicolare local PerpendicularLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Perpendicular', Parameters) -- check extracorsa nei punti di attacco - PointsToCheck = { PerpendicularLeadInOut.LeadIn.ptPoint, PerpendicularLeadInOut.LeadOut.ptPoint} - local bOutOfStrokePerpendicular = PreSimulationLib.CheckOutOfStroke( PointsToCheck, CheckOutOfStrokeParameters) + + PointsOnToolTipCenter = { + PreSimulationLib.GetPointOnToolTipCenter( PerpendicularLeadInOut.LeadIn.ptPoint, vtHead, Face.vtN, Edge.vtN, Tool), + PreSimulationLib.GetPointOnToolTipCenter( PerpendicularLeadInOut.LeadOut.ptPoint, vtHead, Face.vtN, Edge.vtN, Tool) + } + local bOutOfStrokePerpendicular = PreSimulationLib.CheckOutOfStroke( PointsOnToolTipCenter, CheckOutOfStrokeParameters) -- se non è in extracorsa si aggiunge come attacco possibile if not bOutOfStrokePerpendicular then LeadInOut.Perpendicular = PerpendicularLeadInOut @@ -369,8 +374,11 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters) -- attacco tangenziale local TangentLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Tangent', Parameters) -- check extracorsa nei punti di attacco - PointsToCheck = { TangentLeadInOut.LeadIn.ptPoint, TangentLeadInOut.LeadOut.ptPoint} - local bOutOfStrokeTangent = PreSimulationLib.CheckOutOfStroke( PointsToCheck, CheckOutOfStrokeParameters) + PointsOnToolTipCenter = { + PreSimulationLib.GetPointOnToolTipCenter( TangentLeadInOut.LeadIn.ptPoint, vtHead, Face.vtN, Edge.vtN, Tool), + PreSimulationLib.GetPointOnToolTipCenter( TangentLeadInOut.LeadOut.ptPoint, vtHead, Face.vtN, Edge.vtN, Tool) + } + local bOutOfStrokeTangent = PreSimulationLib.CheckOutOfStroke( PointsOnToolTipCenter, CheckOutOfStrokeParameters) -- attacco tangenziale non in extracorsa: si verifica se è in collisione if not bOutOfStrokeTangent then local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters) -- TODO passare punti custom attacco tangenziale diff --git a/LuaLibs/PreSimulationLib.lua b/LuaLibs/PreSimulationLib.lua index 132d66d..9cdeac8 100644 --- a/LuaLibs/PreSimulationLib.lua +++ b/LuaLibs/PreSimulationLib.lua @@ -78,6 +78,12 @@ local function GetRestlengthSurfTm( Part) return idRestLengthBoxTm end +------------------------------------------------------------------------------------------------------------- +function PreSimulationLib.GetPointOnToolTipCenter( ptPointAtDepth, vtHead, vtNFace, vtToolOffset, Tool) + + return ptPointAtDepth + vtToolOffset * Tool.dDiameter / 2 + vtNFace * EgtIf( AreSameVectorApprox( vtHead, vtNFace), 0, Tool.dThickness) +end + ------------------------------------------------------------------------------------------------------------- -- calcolo punto sull'uscita testa a partire dal punto di lavorazione o di attacco sul diametro utensile local function GetToolExitPoint( ptMachining, vtNEdge, vtHead, Tool, bIsDownUp) @@ -131,15 +137,10 @@ local function GetCollisionPointsToCheck( Edge, dDepthToMachine) end ------------------------------------------------------------------------------------------------------------- -local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC, Tool) - - local bIsDownUp = AreOppositeVectorApprox( vtNFace, vtHead) - - local ptOnToolTipCenter = ptOnFace + vtNEdge * Tool.dDiameter / 2 + vtNFace * EgtIf( bIsDownUp, Tool.dThickness, 0) +local function CheckOutOfStrokePoint( ptOnToolTipCenter, vtHead, nSCC, Tool) -- impostazione utensile EgtSetCalcTool( Tool.sName, Tool.sHead, Tool.nExit) - EgtLoadTool( Tool.sHead, Tool.nExit, Tool.sName) -- settaggio SCC per discriminare soluzioni multiple EgtSetCalcSolCh( nSCC) @@ -186,17 +187,16 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC, -- siccome non si sa a priori il numero di assi lineari e rotativi, si aggiungono tutti a Args in ordine -- Args viene poi esplosa in modo da passare a EgtVerifyOutstroke i valori separati local Args = {} - for i = 1, #LinearAxes do Args[#Args+1] = LinearAxes[i].dValue end - for i = 1, #RotativeAxes do Args[#Args+1] = RotativeAxes[i].dValue end local bAllAxesInStroke = EgtVerifyOutstroke( table.unpack( Args)) + -- extracorsa if not bAllAxesInStroke then if EgtGetDebugLevel() >= 3 then @@ -216,22 +216,18 @@ local function CheckOutOfStrokePoint( ptOnFace, vtHead, vtNFace, vtNEdge, nSCC, end ------------------------------------------------------------------------------------------------------------- --- check extracorsa: se non vengono passati punti si controllano inizio e fine del lato -function PreSimulationLib.CheckOutOfStroke( PointsToCheck, Parameters) +-- check extracorsa +function PreSimulationLib.CheckOutOfStroke( PointsOnToolTipCenter, Parameters) -- parametri obbligatori - local Edge = Parameters.Edge - local vtNFace = Parameters.vtNFace local vtHead = Parameters.vtHead local Tool = Parameters.Tool - - -- SCC - local nSCC = Tool.SetupInfo.GetSCC( Edge.vtN, Edge.vtEdge, vtNFace) + local nSCC = Parameters.nSCC -- check collisione sui punti in centro lama su naso mandrino o aggregato. In base a direzione e punto - for i = 1, #PointsToCheck do + for i = 1, #PointsOnToolTipCenter do - local bOutOfStroke = CheckOutOfStrokePoint( PointsToCheck[i], vtHead, vtNFace, Edge.vtN, nSCC, Tool) + local bOutOfStroke = CheckOutOfStrokePoint( PointsOnToolTipCenter[i], vtHead, nSCC, Tool) -- se trovato extracorsa inutile procedere con gli altri punti if bOutOfStroke then diff --git a/Strategies/Standard/STR0001/STR0001.lua b/Strategies/Standard/STR0001/STR0001.lua index ff3681d..b18e357 100644 --- a/Strategies/Standard/STR0001/STR0001.lua +++ b/Strategies/Standard/STR0001/STR0001.lua @@ -8,6 +8,7 @@ local BeamLib = require( 'BeamLib') local BeamData = require( 'BeamDataNew') local MachiningLib = require( 'MachiningLib') local FeatureLib = require( 'FeatureLib') +local PreSimulationLib = require( 'PreSimulationLib') -- strategie di base local BladeToWaste = require('BLADETOWASTE') @@ -29,6 +30,20 @@ local function GetSCC( Machining) return nSCC end +------------------------------------------------------------------------------------------------------------- +local function CheckOutOfStroke( Machining) + + local vtHead = Parameters.vtHead + local Tool = Parameters.Tool + local nSCC = Parameters.nSCC + + + PreSimulationLib.CheckOutOfStroke( PointsToCheck, Parameters) + + + +end + ------------------------------------------------------------------------------------------------------------- local function GetTenonStrategy( Proc, Part) local Machining = {} @@ -183,6 +198,11 @@ local function GetTenonStrategy( Proc, Part) Machining.Milling.AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep end end + -- test finecorsa sulla passata più esterna: se extracorsa, la lavorazione non è fattibile + --local bOutOfStroke = CheckOutOfStroke( Machining.Milling) + if bOutOfStroke then + Machining.Milling.bIsApplicable = false + end -- tempo di svuotatura Result.Milling.dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining.Milling, Part) else diff --git a/StrategyLibs/FACEBYBLADE.lua b/StrategyLibs/FACEBYBLADE.lua index 1d27f69..a5f5034 100644 --- a/StrategyLibs/FACEBYBLADE.lua +++ b/StrategyLibs/FACEBYBLADE.lua @@ -338,7 +338,6 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar Cutting.sMessage = 'Orientation not reachable' Cutting.bIsApplicable = false - EgtOutLog( Cutting.sMessage) return Cutting, EdgeToMachine.dElevation