diff --git a/LuaLibs/FaceData.lua b/LuaLibs/FaceData.lua index 8c4a228..480f3ac 100644 --- a/LuaLibs/FaceData.lua +++ b/LuaLibs/FaceData.lua @@ -228,15 +228,27 @@ end ------------------------------------------------------------------------------------------------------------- -- TODO valutare refactoring per mettere i calcoli del tunnel in una funzione -- TODO creare le facce tunnel solo se non ci sono già. Verirficare all'inizio se già presente in AddGrpId e nel caso riferire all'id di quella esistente e ricalcolare solo le informazioni della faccia. +-- TODO test iniziale replicato in GetMainFaces local function GetTunnelFaces( Proc, Part) local TunnelAddedFaces = {} - if not ( Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5) then + if not ( ( Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5) + or ( Proc.Topology.sName == 'Bevel-1-Through' and ( abs( Proc.Faces[1].vtN:getY()) < GEO.EPS_SMALL or abs( Proc.Faces[1].vtN:getZ()) < GEO.EPS_SMALL))) then + error( 'GetTunnelFaces : Topology not implemented') end -- direzione del tunnel - local vtTunnelDirection = Proc.Faces[1].vtN ^ Proc.Faces[ Proc.Faces[1].Adjacencies[1] + 1].vtN + local vtTunnelDirection = V_NULL() + if Proc.nFct == 1 then + if Proc.Faces[1].vtN:getY() < GEO.EPS_SMALL then + vtTunnelDirection = Y_AX() + else + vtTunnelDirection = Z_AX() + end + else + vtTunnelDirection = Proc.Faces[1].vtN ^ Proc.Faces[ Proc.Faces[1].Adjacencies[1] + 1].vtN + end -- centro del tunnel local frTunnel = Frame3d( Proc.Faces[1].ptCenter, vtTunnelDirection) @@ -561,6 +573,7 @@ end ------------------------------------------------------------------------------------------------------------- -- recupero facce principali della feature, in base alla topologia +-- TODO test iniziale replicato in GetTunnelFaces function FaceData.GetMainFaces( Proc, Part) EgtOutLog( '---MainFaces START---') @@ -571,7 +584,9 @@ function FaceData.GetMainFaces( Proc, Part) Proc.Topology.sFamily == 'Pocket' or Proc.Topology.sFamily == 'Tunnel' or Proc.Topology.sFamily == 'Bevel' or Proc.Topology.sFamily == 'DoubleBevel' or Proc.Topology.sFamily == 'Cut' then - if Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5 then + if ( Proc.Topology.bIsThrough and Proc.Topology.bAllRightAngles and Proc.nFct < 5) + or ( Proc.Topology.sName == 'Bevel-1-Through' and ( abs( Proc.Faces[1].vtN:getY()) < GEO.EPS_SMALL or abs( Proc.Faces[1].vtN:getZ()) < GEO.EPS_SMALL)) then + MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc, Part) end diff --git a/Strategies/Standard/STR0002/STR0002.lua b/Strategies/Standard/STR0002/STR0002.lua index 443ebee..a0313f0 100644 --- a/Strategies/Standard/STR0002/STR0002.lua +++ b/Strategies/Standard/STR0002/STR0002.lua @@ -201,7 +201,6 @@ local function GetBestPocketingStrategy( Proc) Milling = {} Milling.bIsApplicable = false if Proc.Topology.sName ~= 'DoubleBevel-2-Through' - and Proc.Topology.sName ~= 'Bevel-1-Through' and Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'Cut-1-Through' then @@ -219,7 +218,7 @@ local function GetBestPocketingStrategy( Proc) Milling.idFaceToMachine = Proc.MainFaces.LongFaces[1].id Milling.idProc = Proc.id Milling.dElevation = Proc.MainFaces.LongFaces[1].dElevation - else -- 'Tunnel-4-Through', 'Groove-3-Through', 'Rabbet-2-Through', 'VGroove-2-Through' + elseif Proc.MainFaces.TunnelAddedFaces then -- 'Tunnel-4-Through', 'Groove-3-Through', 'Rabbet-2-Through', 'VGroove-2-Through' -- se lavoro di fianco, devo comunque rispettare il raggio massimo ToolSearchParameters.dMaxToolDiameter = min( ToolSearchParameters.dMaxToolDiameter, Strategy.Parameters.dMaxCornerRadius * 2) ToolSearchParameters.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP @@ -245,7 +244,6 @@ local function GetBestPocketingStrategy( Proc) Milling = {} Milling.bIsApplicable = false if Proc.Topology.sName ~= 'DoubleBevel-2-Through' - and Proc.Topology.sName ~= 'Bevel-1-Through' and Proc.Topology.sName ~= 'Pocket-5-Blind' and Proc.Topology.sName ~= 'Groove-4-Blind' and Proc.Topology.sName ~= 'Bevel-3-Blind' @@ -262,7 +260,7 @@ local function GetBestPocketingStrategy( Proc) Milling.dElevation = ( Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Faces[1].dElevation * 2) + BeamData.MILL_OVERLAP Milling.bToolInvert = true Milling.bMachAppliedToTunnelFace = true - else -- 'Groove-3-Blind' + elseif #Proc.MainFaces.SideFaces > 0 then -- 'Groove-3-Blind' ToolSearchParameters.dElevation = Proc.MainFaces.SideFaces[1].dElevation ToolSearchParameters.vtToolDirection = Proc.MainFaces.SideFaces[1].vtN Milling.vtFaceNormal = Proc.MainFaces.SideFaces[1].vtN