in SawPlusChain:

- implementato tunnel con lama e con sega a catena
- modificata calcolo parametri mortising per gestire lati con elevazione negativa
This commit is contained in:
luca.mazzoleni
2024-05-14 12:43:29 +02:00
parent 1b6c1721c5
commit 33be9ccaf0
+109 -37
View File
@@ -5242,6 +5242,8 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
Mortising.CanApply = true
Mortising.Message = ''
Mortising.ProcId = Proc.Id
local dTestCornerRadius = 43
local sMortisingType
local dPocketHeight = 0
if Proc.Topology == 'Tunnel' then
@@ -5251,9 +5253,22 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
end
-- ricerca lavorazione
Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation))
if Proc.Topology == 'Tunnel' then
Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation) + dTestCornerRadius + BD.CUT_EXTRA_MIN)
sMortisingType = "OneSideAndExtend"
if not Mortising.Name then
Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation) / 2 + dTestCornerRadius + BD.CUT_EXTRA_MIN)
sMortisingType = "BothSidesAndExtend"
end
else
Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation))
sMortisingType = "OneSide"
end
if not Mortising.Name then
Mortising.Name = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
if Proc.Topology == 'Tunnel' then
sMortisingType = "BothSides"
end
end
if not Mortising.Name then
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - chainsaw not found'
@@ -5287,31 +5302,36 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
Mortising.IsStartClosed = not EdgeToMachine.IsStartOpen
Mortising.IsEndClosed = not EdgeToMachine.IsEndOpen
-- lato di lavoro e inversioni
if Mortising.Tool.IsCCW then
Mortising.Invert = false
if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then
Mortising.Workside = MCH_MILL_WS.RIGHT
Mortising.Invert = false
Mortising.ToolInvert = false
else
Mortising.Workside = MCH_MILL_WS.LEFT
Mortising.Invert = true
Mortising.ToolInvert = true
end
if EdgeToMachine.Elevation < -10 * GEO.EPS_SMALL then
Mortising.Invert = not Mortising.Invert
end
Mortising.ToolInvert = false
-- profondità e offset longitudinale
if Mortising.Tool.MaxMat > abs( EdgeToMachine.Elevation) - 10 * GEO.EPS_SMALL then
if sMortisingType == "OneSide" then
Mortising.Depth = abs( EdgeToMachine.Elevation)
elseif sMortisingType == 'OneSideAndExtend' then
Mortising.Depth = abs( EdgeToMachine.Elevation) + Mortising.Tool.CornerRadius + BD.CUT_EXTRA_MIN
elseif sMortisingType == 'BothSides' then
Mortising.Depth = abs( EdgeToMachine.Elevation) / 2
elseif sMortisingType == 'BothSidesAndExtend' then
Mortising.Depth = abs( EdgeToMachine.Elevation) / 2 + Mortising.Tool.CornerRadius + BD.CUT_EXTRA_MIN
end
if Mortising.Tool.MaxMat > Mortising.Depth - 10 * GEO.EPS_SMALL then
if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then
Mortising.LongitudinalOffset = 0
else
Mortising.LongitudinalOffset = EdgeToMachine.Elevation
Mortising.LongitudinalOffset = abs( EdgeToMachine.Elevation) - Mortising.Depth
end
else
Mortising.Depth = Mortising.Tool.MaxMat
if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then
Mortising.LongitudinalOffset = EdgeToMachine.Elevation - Mortising.Depth
else
Mortising.LongitudinalOffset = -Mortising.Depth
Mortising.LongitudinalOffset = 0
end
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.Elevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.Depth, 1) .. ')'
EgtOutLog( Mortising.Message)
@@ -5363,6 +5383,25 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
end
function SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
local bIsMortisingOk = false
local sMortisingApplyMessage = ''
local dOriginalRadialOffsetMortising = Mortising.RadialOffset
for i = Mortising.VerticalSteps.Count, 1, -1 do
Mortising.RadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.StepLength * ( i - 1)
-- applicazione lavorazione
bIsMortisingOk, sMortisingApplyMessage = SawPlusChain.ApplyMachining( Mortising, b3Raw)
-- update messaggi
if sMortisingApplyMessage and #sMortisingApplyMessage > 0 then
Mortising.Message = Mortising.Message .. '\n' .. 'Apply : ' .. sMortisingApplyMessage
end
end
return bIsMortisingOk, sMortisingApplyMessage
end
function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
SawPlusChain.ApplyOnlySawblade = bOnlySaw
local b3Raw = EgtGetRawPartBBox( nRawId)
@@ -5397,6 +5436,7 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
Proc.MainFaces.TunnelAddedFaces = SawPlusChain.GetTunnelFaces( Proc)
end
-- lama
-- lavorazione di lama - fondo della tasca o fino a massimo materiale se tunnel
local Cutting = {}
if Proc.Topology == 'Tunnel' then
@@ -5413,7 +5453,17 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
end
local dBottomDepthToMachine = Cutting.RadialOffset
if not( Proc.Topology == 'Tunnel') then
-- lato opposto del tunnel
if Proc.Topology == 'Tunnel' then
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2])
bIsCuttingOk = false
if Cutting.CanApply then
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
end
else
-- se la lama non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
if Cutting.RadialOffset > 10 * GEO.EPS_SMALL then
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
@@ -5442,39 +5492,61 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
elseif #( Proc.MainFaces.SideFaces) == 0 then
SawPlusChain.ApplyOnlySawblade = true
end
-- lato opposto del tunnel
else
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2])
bIsCuttingOk = false
if Cutting.CanApply then
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
end
if not bIsCuttingOk then
return bIsCuttingOk, Cutting.Message
end
end
if SawPlusChain.ApplyOnlySawblade then
return bIsCuttingOk, Cutting.Message
end
-- parametri lavorazione con sega a catena
local Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge)
-- si lavora solo quanto non lavorato dalla lama
Mortising.MaxElev = dBottomDepthToMachine + BD.CUT_EXTRA
-- applicazione lavorazione con sega a catena con eventuali step in Z
-- sega a catena
-- parametri lavorazione con sega a catena - fondo della tasca o tunnel
local Mortising = {}
if Proc.Topology == 'Tunnel' then
Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1])
else
Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge)
-- si lavora solo quanto non lavorato dalla lama
Mortising.MaxElev = dBottomDepthToMachine + BD.CUT_EXTRA
end
local bIsMortisingOk = false
local sMortisingApplyMessage = ''
if Mortising.CanApply then
local dOriginalRadialOffsetMortising = Mortising.RadialOffset
for i = Mortising.VerticalSteps.Count, 1, -1 do
Mortising.RadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.StepLength * ( i - 1)
-- applicazione lavorazione
bIsMortisingOk, sMortisingApplyMessage = SawPlusChain.ApplyMachining( Mortising, b3Raw)
-- update messaggi
if sMortisingApplyMessage and #sMortisingApplyMessage > 0 then
Mortising.Message = Mortising.Message .. '\n' .. 'Apply : ' .. sMortisingApplyMessage
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
end
-- lato opposto del tunnel
if Proc.Topology == 'Tunnel' then
Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2])
bIsMortisingOk = false
if Mortising.CanApply then
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message
end
else
-- se la sega a catena non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
if Mortising.LongitudinalOffset > 10 * GEO.EPS_SMALL then
-- eventuale lavorazione di sega a catena - lato della tasca da cui inizia la lavorazione
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsStartOpen then
Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.StartEdge)
bIsMortisingOk = false
if Mortising.CanApply then
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message
end
end
-- eventuale lavorazione di sega a catena - lato della tasca in cui finisce la lavorazione
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsEndOpen then
Mortising = SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.EndEdge)
bIsMortisingOk = false
if Mortising.CanApply then
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
end
if not bIsMortisingOk then
return bIsMortisingOk, Mortising.Message
end
end
end
end