-in SawPlusChain implementato tunnel, per ora funzionante solo per lama
This commit is contained in:
+44
-2
@@ -1186,11 +1186,19 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetFacetsInfo( Proc, b3Raw)
|
||||
Face = {}
|
||||
local Face = {}
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local vAdj
|
||||
if Proc.AdjacencyMatrix then
|
||||
vAdj = Proc.AdjacencyMatrix
|
||||
else
|
||||
vAdj = BeamLib.GetAdjacencyMatrix( Proc)
|
||||
end
|
||||
|
||||
for i = 1, Proc.Fct do
|
||||
Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )}
|
||||
Face[i] = {}
|
||||
Face[i].Id = i - 1
|
||||
Face[i].PtCenter, Face[i].VtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
if Proc.Fct < 10 then
|
||||
local frHV, dFaceWidthTrimmed, dFaceHeightTrimmed = BeamLib.GetFaceHvRefDim( Proc.Id, i - 1, b3Raw)
|
||||
-- frame OCS faccia
|
||||
@@ -1206,12 +1214,46 @@ function BeamLib.GetFacetsInfo( Proc, b3Raw)
|
||||
Face[i].Height = dFaceHeight
|
||||
-- elevazione calcolata rispetto al box della parte
|
||||
Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
|
||||
-- area della faccia
|
||||
-- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo
|
||||
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
Face[i].Area = dShortEdgeDimension * dLongEdgeDimension
|
||||
-- adiacenze della faccia
|
||||
-- TODO chiamarle in modo che si capisca che sono solo gli id e non l'intero oggetto faccia
|
||||
Face[i].Adjacencies = {}
|
||||
for j = 1, Proc.Fct do
|
||||
if vAdj[i][j] and vAdj[i][j] ~= 0 and ( i ~= j) then
|
||||
table.insert( Face[i].Adjacencies, j - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Face
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
|
||||
function BeamLib.GetAdjacencyMatrix( Proc)
|
||||
local vAdj = {}
|
||||
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i] = {}
|
||||
for j = i + 1, Proc.Fct do
|
||||
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
|
||||
if not vAdj[i][j] then vAdj[i][j] = 0 end
|
||||
end
|
||||
end
|
||||
-- riempio di conseguenza il resto della matrice
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i][i] = 0
|
||||
for j = i + 1, Proc.Fct do
|
||||
vAdj[j][i] = vAdj[i][j]
|
||||
end
|
||||
end
|
||||
return vAdj
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
|
||||
|
||||
@@ -19,32 +19,10 @@ local BL = require( 'BeamLib')
|
||||
|
||||
EgtOutLog( ' FeatureTopology started', 1)
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
|
||||
local function GetAdjacencyMatrix( Proc)
|
||||
local vAdj = {}
|
||||
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i] = {}
|
||||
for j = i + 1, Proc.Fct do
|
||||
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
|
||||
if not vAdj[i][j] then vAdj[i][j] = 0 end
|
||||
end
|
||||
end
|
||||
-- riempio di conseguenza il resto della matrice
|
||||
for i = 1, Proc.Fct do
|
||||
vAdj[i][i] = 0
|
||||
for j = i + 1, Proc.Fct do
|
||||
vAdj[j][i] = vAdj[i][j]
|
||||
end
|
||||
end
|
||||
return vAdj
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
|
||||
function FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, nAdj)
|
||||
if not vAdj then vAdj = GetAdjacencyMatrix( Proc) end
|
||||
if not vAdj then vAdj = BL.GetAdjacencyMatrix( Proc) end
|
||||
local nFct = #( vAdj or {})
|
||||
local vFacesWithGivenAdj = {}
|
||||
for i = 1, nFct do
|
||||
@@ -188,7 +166,7 @@ function FeatureTopology.Classify( Proc, b3Raw)
|
||||
Proc.Face = BL.GetFacetsInfo( Proc, b3Raw)
|
||||
end
|
||||
|
||||
local vAdj = GetAdjacencyMatrix( Proc)
|
||||
local vAdj = Proc.AdjacencyMatrix or BL.GetAdjacencyMatrix( Proc)
|
||||
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
|
||||
|
||||
+194
-94
@@ -4629,7 +4629,8 @@ SawPlusChain.ApplyOnlySawblade = false
|
||||
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
|
||||
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' or
|
||||
Proc.TopologyLongName == 'Tunnel-Through-RightAngles-Parallel-4' then
|
||||
|
||||
return true
|
||||
else
|
||||
@@ -4638,7 +4639,59 @@ function SawPlusChain.IsTopologyOk( Proc)
|
||||
end
|
||||
|
||||
|
||||
function SawPlusChain.GetTunnelFaces( Proc)
|
||||
local TunnelAddedFaces = {}
|
||||
|
||||
-- TODO scrivere il box della parte nella Proc o fare funzione per recuperarlo
|
||||
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( Proc.PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
|
||||
if not ( Proc.IsThrough and Proc.AllRightAngles and Proc.Fct < 5) then
|
||||
error( 'GetTunnelFaces : Topology not implemented')
|
||||
end
|
||||
|
||||
-- direzione del tunnel
|
||||
local vtTunnelDirection = Proc.Face[1].VtN ^ Proc.Face[ Proc.Face[1].Adjacencies[1] + 1].VtN
|
||||
|
||||
-- centro del tunnel
|
||||
local frTunnel = Frame3d( Proc.Face[1].PtCenter, vtTunnelDirection)
|
||||
local b3Tunnel = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frTunnel)
|
||||
local ptTunnelCenter = b3Tunnel:getCenter()
|
||||
ptTunnelCenter:toGlob( frTunnel)
|
||||
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
|
||||
if not nAddGrpId then
|
||||
EgtOutLog( 'Error : missing AddGroup')
|
||||
return TunnelAddedFaces
|
||||
end
|
||||
|
||||
-- faccia centrale, si crea larga come la parte e poi si trimma
|
||||
TunnelAddedFaces.MiddleFaceTm = {}
|
||||
TunnelAddedFaces.MiddleFaceTm.Id = EgtSurfTmPlaneInBBox( nAddGrpId, ptTunnelCenter, vtTunnelDirection, b3Part, GDB_ID.ROOT)
|
||||
-- TODO se non si riesce a costruire la faccia bisogna dare errore o semplicemente non ritornarla??
|
||||
for i = 1, Proc.Fct do
|
||||
EgtCutSurfTmPlane( TunnelAddedFaces.MiddleFaceTm.Id, Proc.Face[i].PtCenter, -Proc.Face[i].VtN, false, GDB_ID.ROOT)
|
||||
end
|
||||
|
||||
local _, dFaceWidth, dFaceHeight = BL.GetFaceHvRefDim( TunnelAddedFaces.MiddleFaceTm.Id, 0)
|
||||
-- larghezza OCS faccia
|
||||
TunnelAddedFaces.MiddleFaceTm.Width = dFaceWidth
|
||||
-- altezza OCS faccia
|
||||
TunnelAddedFaces.MiddleFaceTm.Height = dFaceHeight
|
||||
if TunnelAddedFaces.MiddleFaceTm.Height > TunnelAddedFaces.MiddleFaceTm.Width then
|
||||
TunnelAddedFaces.MiddleFaceTm.Height, TunnelAddedFaces.MiddleFaceTm.Width = TunnelAddedFaces.MiddleFaceTm.Width, TunnelAddedFaces.MiddleFaceTm.Height
|
||||
end
|
||||
|
||||
return TunnelAddedFaces
|
||||
end
|
||||
|
||||
|
||||
function SawPlusChain.GetBottomFace( Proc)
|
||||
local BottomFace = {}
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 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)
|
||||
local nBottomFace
|
||||
@@ -4658,7 +4711,6 @@ function SawPlusChain.GetBottomFace( Proc)
|
||||
nBottomFace = vBottomFace[1]
|
||||
end
|
||||
|
||||
local BottomFace = {}
|
||||
BottomFace.Id = nBottomFace
|
||||
BottomFace.Width = Proc.Face[nBottomFace + 1].Width
|
||||
BottomFace.Height = Proc.Face[nBottomFace + 1].Height
|
||||
@@ -4677,13 +4729,25 @@ function SawPlusChain.GetLongFace( Proc)
|
||||
Proc.MainFaces.BottomFace = SawPlusChain.GetBottomFace( Proc)
|
||||
end
|
||||
|
||||
-- facce adiacenti a quella di fondo, ordinate
|
||||
local FacesAdjacentToBottom = BL.GetAdjacentFaces( Proc, Proc.MainFaces.BottomFace.Id)
|
||||
table.sort( FacesAdjacentToBottom, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
|
||||
local FacesToAnalyze = {}
|
||||
-- tutte le facce, ordinate per dimensione
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
for i = 1, Proc.Fct do
|
||||
FacesToAnalyze[i] = {}
|
||||
FacesToAnalyze[i].Id = Proc.Face[i].Id
|
||||
FacesToAnalyze[i].Area = Proc.Face[i].Area
|
||||
FacesToAnalyze[i].LengthOnMainFace = Proc.Face[i].LengthOnMainFace
|
||||
end
|
||||
table.sort( FacesToAnalyze, function( a, b) return a.Area > b.Area end)
|
||||
-- facce adiacenti a quella di fondo, ordinate per lunghezza sul lato di fondo
|
||||
else
|
||||
FacesToAnalyze = BL.GetAdjacentFaces( Proc, Proc.MainFaces.BottomFace.Id)
|
||||
table.sort( FacesToAnalyze, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
|
||||
end
|
||||
|
||||
-- si sceglie la faccia adiacente sul lato più lungo
|
||||
-- si sceglie la più grande (tunnel) o quella adiacente sul lato lungo
|
||||
local LongFace = {}
|
||||
LongFace.Id = FacesAdjacentToBottom[1].Id
|
||||
LongFace.Id = FacesToAnalyze[1].Id
|
||||
for i = 1, Proc.Fct do
|
||||
if LongFace.Id == Proc.Face[i].Id then
|
||||
LongFace.Width = Proc.Face[i].Width
|
||||
@@ -4710,24 +4774,35 @@ function SawPlusChain.GetSideFaces( Proc)
|
||||
Proc.MainFaces.LongFace = SawPlusChain.GetLongFace( Proc)
|
||||
end
|
||||
|
||||
-- facce adiacenti a quella di fondo, ordinate
|
||||
local FacesAdjacentToBottom = BL.GetAdjacentFaces( Proc, Proc.MainFaces.BottomFace.Id)
|
||||
table.sort( FacesAdjacentToBottom, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
|
||||
|
||||
local FacesToAnalyze = {}
|
||||
-- tutte le facce, ordinate per dimensione
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
for i = 1, Proc.Fct do
|
||||
FacesToAnalyze[i] = {}
|
||||
FacesToAnalyze[i].Id = Proc.Face[i].Id
|
||||
FacesToAnalyze[i].Area = Proc.Face[i].Area
|
||||
FacesToAnalyze[i].LengthOnMainFace = Proc.Face[i].LengthOnMainFace
|
||||
end
|
||||
table.sort( FacesToAnalyze, function( a, b) return a.Area > b.Area end)
|
||||
-- facce adiacenti a quella di fondo, ordinate per lunghezza sul lato di fondo
|
||||
else
|
||||
FacesToAnalyze = BL.GetAdjacentFaces( Proc, Proc.MainFaces.BottomFace.Id)
|
||||
table.sort( FacesToAnalyze, function( a, b) return a.LengthOnMainFace > b.LengthOnMainFace end)
|
||||
end
|
||||
-- si determina il criterio di scelta delle facce laterali
|
||||
local FacesAdjacentToLongFace = BL.GetAdjacentFaces( Proc, Proc.MainFaces.LongFace.Id)
|
||||
local bIsLongFaceTheLargest = not ( Proc.Fct == 4 and #FacesAdjacentToLongFace == 3)
|
||||
|
||||
local SideFaces = {}
|
||||
for i = 1, #FacesAdjacentToBottom do
|
||||
if ( not bIsLongFaceTheLargest and i < #FacesAdjacentToBottom) or
|
||||
for i = 1, #FacesToAnalyze do
|
||||
if ( not bIsLongFaceTheLargest and i < #FacesToAnalyze) or
|
||||
( bIsLongFaceTheLargest and 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
|
||||
table.insert( SideFaces, FacesToAnalyze[i])
|
||||
SideFaces[#SideFaces].Id = FacesToAnalyze[i].Id
|
||||
SideFaces[#SideFaces].Width = Proc.Face[FacesToAnalyze[i].Id + 1].Width
|
||||
SideFaces[#SideFaces].Height = Proc.Face[FacesToAnalyze[i].Id + 1].Height
|
||||
SideFaces[#SideFaces].Elevation = Proc.Face[FacesToAnalyze[i].Id + 1].Elevation
|
||||
SideFaces[#SideFaces].VtN = Proc.Face[FacesToAnalyze[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
|
||||
@@ -4764,14 +4839,22 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face)
|
||||
CurrentEdge.IsStartOpen = ( vEdges[nPreviousEdgeIndex].Open)
|
||||
CurrentEdge.IsEndOpen = ( vEdges[nNextEdgeIndex].Open)
|
||||
|
||||
if CurrentEdge.AdjacentFaceId == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.BottomEdge = CurrentEdge
|
||||
elseif vEdges[nNextEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.SideEdges.StartEdge = CurrentEdge
|
||||
elseif vEdges[nPreviousEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.SideEdges.EndEdge = CurrentEdge
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
if CurrentEdge.AdjacentFaceId > -1 then
|
||||
table.insert( Edges.SideEdges, CurrentEdge)
|
||||
else
|
||||
table.insert( Edges.OppositeEdges, CurrentEdge)
|
||||
end
|
||||
else
|
||||
table.insert( Edges.OppositeEdges, CurrentEdge)
|
||||
if CurrentEdge.AdjacentFaceId == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.BottomEdge = CurrentEdge
|
||||
elseif vEdges[nNextEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.SideEdges.StartEdge = CurrentEdge
|
||||
elseif vEdges[nPreviousEdgeIndex].Adj == Proc.MainFaces.BottomFace.Id then
|
||||
Edges.SideEdges.EndEdge = CurrentEdge
|
||||
else
|
||||
table.insert( Edges.OppositeEdges, CurrentEdge)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -4814,37 +4897,6 @@ function SawPlusChain.GetToolFromMachining( sMachiningName)
|
||||
end
|
||||
|
||||
|
||||
function SawPlusChain.IsStartOrEndClosed( Proc, Machining)
|
||||
local bIsStartClosed = false
|
||||
local bIsEndClosed = false
|
||||
local bIsMortising = ( Machining.Type == MCH_OY.MORTISING)
|
||||
if #( Proc.MainFaces.SideFaces) == 2 then
|
||||
bIsStartClosed = true
|
||||
bIsEndClosed = true
|
||||
elseif #( Proc.MainFaces.SideFaces) == 1 then
|
||||
local CCWDirection = ( Machining.FaceToMachine.VtN ^ Proc.MainFaces.BottomFace.VtN)
|
||||
if Machining.ToolInvert or bIsMortising then
|
||||
CCWDirection = - CCWDirection
|
||||
end
|
||||
if CCWDirection * Proc.MainFaces.SideFaces[1].VtN > 10 * GEO.EPS_SMALL then
|
||||
if Machining.Tool.IsCCW then
|
||||
bIsStartClosed = true
|
||||
else
|
||||
bIsEndClosed = true
|
||||
end
|
||||
else
|
||||
if Machining.Tool.IsCCW then
|
||||
bIsEndClosed = true
|
||||
else
|
||||
bIsStartClosed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return bIsStartClosed, bIsEndClosed
|
||||
end
|
||||
|
||||
|
||||
function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine)
|
||||
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
||||
|
||||
@@ -5025,6 +5077,13 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
||||
Cutting.Message = ''
|
||||
Cutting.ProcId = Proc.Id
|
||||
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Height
|
||||
else
|
||||
dPocketHeight = Proc.MainFaces.BottomFace.Height
|
||||
end
|
||||
|
||||
-- ricerca lavorazione
|
||||
Cutting.Name = ML.FindCutting( 'HeadSide', true, false)
|
||||
if not Cutting.Name then
|
||||
@@ -5038,7 +5097,7 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- se tasca meno spessa della lama la strategia non è applicabile
|
||||
if Cutting.Tool.Thickness > Proc.MainFaces.BottomFace.Height + 10 * GEO.EPS_SMALL then
|
||||
if Cutting.Tool.Thickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
||||
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for saw blade thickness'
|
||||
Cutting.CanApply = false
|
||||
EgtOutLog( Cutting.Message)
|
||||
@@ -5098,11 +5157,11 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
||||
end
|
||||
end
|
||||
-- step verticale e offset longitudinale
|
||||
Cutting.Steps = BL.GetMachiningSteps( Proc.MainFaces.BottomFace.Height, Cutting.Tool.Thickness)
|
||||
Cutting.Steps = BL.GetMachiningSteps( dPocketHeight, Cutting.Tool.Thickness)
|
||||
Cutting.Steps.StepType = MCH_MILL_ST.ONEWAY
|
||||
Cutting.MaxElev = Cutting.Steps.StepLength * Cutting.Steps.Count - 10 * GEO.EPS_SMALL
|
||||
if Cutting.ToolInvert and Cutting.Steps.Count > 1 then
|
||||
Cutting.LongitudinalOffset = - Proc.MainFaces.BottomFace.Height
|
||||
Cutting.LongitudinalOffset = - dPocketHeight
|
||||
else
|
||||
Cutting.LongitudinalOffset = 0
|
||||
end
|
||||
@@ -5183,10 +5242,16 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
||||
Mortising.CanApply = true
|
||||
Mortising.Message = ''
|
||||
Mortising.ProcId = Proc.Id
|
||||
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.TunnelAddedFaces.MiddleFaceTm.Height
|
||||
else
|
||||
dPocketHeight = Proc.MainFaces.BottomFace.Height
|
||||
end
|
||||
|
||||
-- ricerca lavorazione
|
||||
-- TODO gestire elevazione negativa (determina come devo lavorare)
|
||||
Mortising.Name = ML.FindSawing( 'Sawing', EdgeToMachine.Elevation)
|
||||
Mortising.Name = ML.FindSawing( 'Sawing', abs( EdgeToMachine.Elevation))
|
||||
if not Mortising.Name then
|
||||
Mortising.Name = ML.FindSawing( 'Sawing', nil, nil, 'Longest')
|
||||
end
|
||||
@@ -5201,7 +5266,7 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- se tasca meno spessa della sega a catena la strategia non è applicabile
|
||||
if Mortising.Tool.Thickness > Proc.MainFaces.BottomFace.Height + 10 * GEO.EPS_SMALL then
|
||||
if Mortising.Tool.Thickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
||||
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for chainsaw thickness'
|
||||
Mortising.CanApply = false
|
||||
EgtOutLog( Mortising.Message)
|
||||
@@ -5229,14 +5294,25 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
||||
Mortising.Workside = MCH_MILL_WS.LEFT
|
||||
Mortising.Invert = 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 > EdgeToMachine.Elevation - 10 * GEO.EPS_SMALL then
|
||||
Mortising.Depth = EdgeToMachine.Elevation
|
||||
Mortising.LongitudinalOffset = 0
|
||||
if Mortising.Tool.MaxMat > abs( EdgeToMachine.Elevation) - 10 * GEO.EPS_SMALL then
|
||||
Mortising.Depth = abs( EdgeToMachine.Elevation)
|
||||
if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.LongitudinalOffset = 0
|
||||
else
|
||||
Mortising.LongitudinalOffset = EdgeToMachine.Elevation
|
||||
end
|
||||
else
|
||||
Mortising.Depth = Mortising.Tool.MaxMat
|
||||
Mortising.LongitudinalOffset = EdgeToMachine.Elevation - Mortising.Depth
|
||||
if EdgeToMachine.Elevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.LongitudinalOffset = EdgeToMachine.Elevation - Mortising.Depth
|
||||
else
|
||||
Mortising.LongitudinalOffset = -Mortising.Depth
|
||||
end
|
||||
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.Elevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.Depth, 1) .. ')'
|
||||
EgtOutLog( Mortising.Message)
|
||||
end
|
||||
@@ -5247,7 +5323,11 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
||||
-- overlap
|
||||
Mortising.Overlap = 0
|
||||
-- faceuse
|
||||
Mortising.Faceuse = BL.GetNearestParalOpposite( EdgeToMachine.ToolDirection)
|
||||
if EdgeToMachine.Elevation > - 10 * GEO.EPS_SMALL then
|
||||
Mortising.Faceuse = BL.GetNearestParalOpposite( EdgeToMachine.ToolDirection)
|
||||
else
|
||||
Mortising.Faceuse = BL.GetNearestParalOpposite( -EdgeToMachine.ToolDirection)
|
||||
end
|
||||
-- SCC
|
||||
Mortising.SCC = MCH_SCC.NONE
|
||||
-- asse bloccato e angoli suggeriti
|
||||
@@ -5261,7 +5341,7 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
||||
-- approccio e retrazione
|
||||
Mortising.LeadIn, Mortising.LeadOut = SawPlusChain.CalculateLeadInOut( Mortising, EdgeToMachine)
|
||||
-- eventuale step verticale
|
||||
Mortising.VerticalSteps = BL.GetMachiningSteps( Proc.MainFaces.BottomFace.Height, Mortising.Tool.Thickness)
|
||||
Mortising.VerticalSteps = BL.GetMachiningSteps( dPocketHeight, Mortising.Tool.Thickness)
|
||||
-- geometria
|
||||
Mortising.Geometry = {{Proc.Id, FaceToMachine.Id}}
|
||||
-- nome operazione
|
||||
@@ -5313,9 +5393,17 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
||||
Proc.MainFaces.BottomFace = SawPlusChain.GetBottomFace( Proc)
|
||||
Proc.MainFaces.LongFace = SawPlusChain.GetLongFace( Proc)
|
||||
Proc.MainFaces.SideFaces = SawPlusChain.GetSideFaces( Proc)
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
Proc.MainFaces.TunnelAddedFaces = SawPlusChain.GetTunnelFaces( Proc)
|
||||
end
|
||||
|
||||
-- lavorazione di lama - fondo della tasca
|
||||
local Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge)
|
||||
-- lavorazione di lama - fondo della tasca o fino a massimo materiale se tunnel
|
||||
local Cutting = {}
|
||||
if Proc.Topology == 'Tunnel' then
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1])
|
||||
else
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge)
|
||||
end
|
||||
local bIsCuttingOk = false
|
||||
if Cutting.CanApply then
|
||||
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
||||
@@ -5325,33 +5413,45 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
||||
end
|
||||
local dBottomDepthToMachine = Cutting.RadialOffset
|
||||
|
||||
-- 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
|
||||
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsStartOpen then
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.StartEdge)
|
||||
bIsCuttingOk = false
|
||||
if Cutting.CanApply then
|
||||
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
||||
if not( Proc.Topology == 'Tunnel') then
|
||||
-- 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
|
||||
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsStartOpen then
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.StartEdge)
|
||||
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 not bIsCuttingOk then
|
||||
return bIsCuttingOk, Cutting.Message
|
||||
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
||||
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsEndOpen then
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.EndEdge)
|
||||
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
|
||||
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
|
||||
elseif #( Proc.MainFaces.SideFaces) == 0 then
|
||||
SawPlusChain.ApplyOnlySawblade = true
|
||||
end
|
||||
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
||||
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsEndOpen then
|
||||
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.EndEdge)
|
||||
bIsCuttingOk = false
|
||||
if Cutting.CanApply then
|
||||
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
||||
end
|
||||
if not bIsCuttingOk then
|
||||
return bIsCuttingOk, Cutting.Message
|
||||
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
|
||||
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
|
||||
elseif #( Proc.MainFaces.SideFaces) == 0 then
|
||||
SawPlusChain.ApplyOnlySawblade = true
|
||||
end
|
||||
|
||||
if SawPlusChain.ApplyOnlySawblade then
|
||||
|
||||
Reference in New Issue
Block a user