- in SawPlusChainsaw aggiunta gestione accorciamenti percorsi per faccia laterale
This commit is contained in:
+88
-16
@@ -4588,6 +4588,17 @@ end
|
||||
--#region SawPlusChain
|
||||
local SawPlusChain = {}
|
||||
|
||||
function SawPlusChain.IsTopologyOk( Proc)
|
||||
if Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5' or
|
||||
Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' or
|
||||
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function SawPlusChain.GetBottomFace( Proc)
|
||||
-- la faccia di fondo ha sempre Fct - 1 adiacenze. Se si trovano più facce di fondo si sceglie quella con minor elevazione
|
||||
local vBottomFace = Topology.GetFacesWithGivenAdjacencyNumber( Proc, Proc.vAdj, Proc.Fct - 1)
|
||||
@@ -4622,6 +4633,10 @@ function SawPlusChain.GetBottomFace( Proc)
|
||||
end
|
||||
|
||||
function SawPlusChain.GetFaceToMachine( Proc)
|
||||
if not Proc.Pocket.BottomFace or not Proc.Pocket.BottomFace.Id then
|
||||
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
|
||||
end
|
||||
|
||||
-- si cercano le facce adiacenti a quella di fondo
|
||||
local FacesAdjacentToBottom = {}
|
||||
local vBottomFaceAdjacencies = EgtSurfTmFacetAdjacencies( Proc.Id, Proc.Pocket.BottomFace.Id)[1]
|
||||
@@ -4652,6 +4667,42 @@ function SawPlusChain.GetFaceToMachine( Proc)
|
||||
return FaceToMachine
|
||||
end
|
||||
|
||||
function SawPlusChain.GetSideFaces( Proc)
|
||||
if not Proc.Pocket.BottomFace or not Proc.Pocket.BottomFace.Id then
|
||||
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
|
||||
end
|
||||
|
||||
-- si cercano le facce adiacenti a quella di fondo
|
||||
local FacesAdjacentToBottom = {}
|
||||
local vBottomFaceAdjacencies = EgtSurfTmFacetAdjacencies( Proc.Id, Proc.Pocket.BottomFace.Id)[1]
|
||||
for i = 1, #vBottomFaceAdjacencies do
|
||||
if vBottomFaceAdjacencies[i] > -1 then
|
||||
local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, Proc.Pocket.BottomFace.Id, vBottomFaceAdjacencies[i], GDB_ID.ROOT)
|
||||
local dLen = dist( ptP1, ptP2)
|
||||
table.insert( FacesAdjacentToBottom, { Id = vBottomFaceAdjacencies[i], LengthOnBottom = dLen})
|
||||
end
|
||||
end
|
||||
|
||||
-- le facce laterali sono quelle che rimangono una volta escluse le due sopra e sotto, che sono le più lunghe
|
||||
table.sort( FacesAdjacentToBottom, function( a, b) return a.LengthOnBottom > b.LengthOnBottom end)
|
||||
local SideFaces = {}
|
||||
for i = 1, #FacesAdjacentToBottom do
|
||||
if i > 2 then
|
||||
table.insert( SideFaces, FacesAdjacentToBottom[i])
|
||||
SideFaces[ #SideFaces].Id = FacesAdjacentToBottom[i].Id
|
||||
SideFaces[ #SideFaces].Width = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Width
|
||||
SideFaces[ #SideFaces].Height = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Height
|
||||
SideFaces[ #SideFaces].Elevation = Proc.Face[FacesAdjacentToBottom[i].Id + 1].Elevation
|
||||
SideFaces[ #SideFaces].VtN = Proc.Face[FacesAdjacentToBottom[i].Id + 1].VtN
|
||||
if SideFaces[ #SideFaces].Height > SideFaces[ #SideFaces].Width then
|
||||
SideFaces[ #SideFaces].Height, SideFaces[ #SideFaces].Width = SideFaces[ #SideFaces].Width, SideFaces[ #SideFaces].Height
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return SideFaces
|
||||
end
|
||||
|
||||
function SawPlusChain.GetToolFromMachining( sMachiningName)
|
||||
local Tool = {}
|
||||
if EgtMdbSetCurrMachining( sMachiningName) then
|
||||
@@ -4755,13 +4806,7 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
Proc.Pocket = {}
|
||||
Proc.Pocket.Strategy = 'SawPlusChain'
|
||||
|
||||
if Proc.TopologyLongName == 'Pocket-Blind-RightAngles-Parallel-5' then
|
||||
Proc.Pocket.SideOpeningsCount = 0
|
||||
elseif Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' then
|
||||
Proc.Pocket.SideOpeningsCount = 1
|
||||
elseif Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' then
|
||||
Proc.Pocket.SideOpeningsCount = 2
|
||||
else
|
||||
if not SawPlusChain.IsTopologyOk( Proc) then
|
||||
local sErr = 'Feature '.. Proc.FeatureId .. ' : Strategy ' .. Proc.Pocket.Strategy .. ' not implemented for topology ' .. Proc.TopologyLongName
|
||||
return false, sErr
|
||||
end
|
||||
@@ -4775,6 +4820,7 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
-- caratteristiche della tasca
|
||||
Proc.Pocket.BottomFace = SawPlusChain.GetBottomFace( Proc)
|
||||
Proc.Pocket.FaceToMachine = SawPlusChain.GetFaceToMachine( Proc)
|
||||
Proc.Pocket.SideFaces = SawPlusChain.GetSideFaces( Proc)
|
||||
Proc.Pocket.Width = Proc.Pocket.BottomFace.Width
|
||||
Proc.Pocket.Height = Proc.Pocket.BottomFace.Height
|
||||
Proc.Pocket.Depth = Proc.Pocket.BottomFace.Elevation
|
||||
@@ -4826,6 +4872,7 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
Cutting.Workside = MCH_MILL_WS.LEFT
|
||||
Cutting.Invert = false
|
||||
end
|
||||
-- TODO gestire lama da sotto e lama downUp
|
||||
if Cutting.FaceToMachine.VtN:getZ() < - 10 * GEO.EPS_SMALL then
|
||||
Cutting.ToolInvert = true
|
||||
Cutting.Invert = not Cutting.Invert
|
||||
@@ -4847,28 +4894,53 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
-- SCC
|
||||
Cutting.SCC = SawPlusChain.GetSCC( Proc.Pocket.Direction)
|
||||
-- approccio e retrazione
|
||||
local dAddLengthToReduce = sqrt( Cutting.Depth * Cutting.Tool.Diameter - Cutting.Depth * Cutting.Depth)
|
||||
Cutting.LeadIn = {}
|
||||
Cutting.LeadOut = {}
|
||||
Cutting.LeadIn.Type = MCH_MILL_LI.LINEAR
|
||||
Cutting.LeadOut.Type = MCH_MILL_LI.LINEAR
|
||||
Cutting.LeadIn.StartAddLength = 0
|
||||
Cutting.LeadOut.EndAddLength = 0
|
||||
Cutting.LeadIn.TangentDistance = 0
|
||||
Cutting.LeadOut.TangentDistance = 0
|
||||
Cutting.LeadIn.PerpDistance = 0
|
||||
Cutting.LeadOut.PerpDistance = 0
|
||||
Cutting.LeadIn.Elevation = 0
|
||||
Cutting.LeadOut.Elevation = 0
|
||||
Cutting.LeadIn.CompLength = 0
|
||||
Cutting.LeadOut.CompLength = 0
|
||||
if Proc.Pocket.SideOpeningsCount == 0 then
|
||||
Cutting.IsStartClosed = false
|
||||
Cutting.IsEndClosed = false
|
||||
Cutting.LeadIn.StartAddLength = 0
|
||||
Cutting.LeadOut.EndAddLength = 0
|
||||
Cutting.LeadIn.PerpDistance = 0
|
||||
Cutting.LeadOut.PerpDistance = 0
|
||||
if #( Proc.Pocket.SideFaces) == 2 then
|
||||
Cutting.IsStartClosed = true
|
||||
Cutting.IsEndClosed = true
|
||||
elseif #( Proc.Pocket.SideFaces) == 1 then
|
||||
if not Cutting.ToolInvert then
|
||||
Cutting.FaceToMachine.CCWDirection = ( Cutting.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
|
||||
else
|
||||
Cutting.FaceToMachine.CCWDirection = - ( Cutting.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
|
||||
end
|
||||
if Cutting.FaceToMachine.CCWDirection * Proc.Pocket.SideFaces[1].VtN > 10 * GEO.EPS_SMALL then
|
||||
if Cutting.Tool.IsCCW then
|
||||
Cutting.IsStartClosed = true
|
||||
else
|
||||
Cutting.IsEndClosed = true
|
||||
end
|
||||
else
|
||||
if Cutting.Tool.IsCCW then
|
||||
Cutting.IsEndClosed = true
|
||||
else
|
||||
Cutting.IsStartClosed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local dAddLengthToReduce = sqrt( Cutting.Depth * Cutting.Tool.Diameter - Cutting.Depth * Cutting.Depth)
|
||||
if Cutting.IsStartClosed then
|
||||
Cutting.LeadIn.StartAddLength = -dAddLengthToReduce
|
||||
Cutting.LeadOut.EndAddLength = -dAddLengthToReduce
|
||||
Cutting.LeadIn.PerpDistance = 1
|
||||
end
|
||||
if Cutting.IsEndClosed then
|
||||
Cutting.LeadOut.EndAddLength = -dAddLengthToReduce
|
||||
Cutting.LeadOut.PerpDistance = 1
|
||||
elseif Proc.Pocket.SideOpeningsCount == 1 then
|
||||
-- BISOGNA CAPIRE DA CHE LATO ACCORCIARE!
|
||||
end
|
||||
|
||||
-- lavorazione con lama
|
||||
|
||||
Reference in New Issue
Block a user