- in FeatureLib, per ScarfJoint e ScarfSimple, si scrivono sempre AdjacencyMatrix e Faces

- in STR0009 aggiunto antischeggia di lama e, nel caso sia disattivato, lavorazione con lama dell'eventuale faccia inclinata
This commit is contained in:
luca.mazzoleni
2026-04-27 18:18:07 +02:00
parent 64b2e86a2d
commit 967117cc23
2 changed files with 47 additions and 60 deletions
+3
View File
@@ -337,6 +337,9 @@ function FeatureLib.GetAdditionalInfo( Proc, Part)
Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc)
Proc.Faces = FaceData.GetFacesInfo( Proc, Part)
Proc.FeatureInfo, Proc.MainFaces = FeatureLib.GetRafterNotchData( Proc)
elseif ( ID.IsScarfJoint( Proc) or ID.IsScarfSimple( Proc)) then
Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc)
Proc.Faces = FaceData.GetFacesInfo( Proc, Part)
end
return Proc
+44 -60
View File
@@ -9,8 +9,10 @@ local BeamData = require( 'BeamDataNew')
local MachiningLib = require( 'MachiningLib')
local FeatureLib = require( 'FeatureLib')
-- strategie di base
local BladeToWaste = require('BLADETOWASTE')
local FaceByMill = require('FACEBYMILL')
local BladeToWaste = require( 'BLADETOWASTE')
local FaceByMill = require( 'FACEBYMILL')
local FaceByBlade = require( 'FACEBYBLADE')
local AntiSplintOnFace = require( 'ANTISPLINTONFACE')
-- Tabella per definizione modulo
local STR0009 = {}
@@ -18,26 +20,23 @@ local Strategy = {}
-------------------------------------------------------------------------------------------------------------
local function GetFacesIdOrder( Proc, Part)
local Faces = { {}, {}, {}, {}, {}}
local Faces = {}
if Proc.nFct == 5 then
-- carico gli id delle facce
for i = 1, Proc.nFct do
Faces[i].nFaceOrd = i - 1
Faces[i].ptC, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.id, i-1, GDB_ID.ROOT)
Faces[#Faces + 1] = BeamLib.TableCopyDeep( Proc.Faces[i])
end
elseif Proc.nFct == 4 then
local _, vtN1 = EgtSurfTmFacetCenter( Proc.id, 0, GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( Proc.id, 1, GDB_ID.ROOT)
local vtN1 = Proc.Faces[1].vtN
local vtN2 = Proc.Faces[2].vtN
local nIndex = EgtIf( abs( vtN1:getX()) > abs( vtN2:getX()), 1, 2)
for i = nIndex, Proc.nFct do
Faces[i].nFaceOrd = i - 1
Faces[i].ptC, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.id, i-1, GDB_ID.ROOT)
Faces[#Faces + 1] = BeamLib.TableCopyDeep( Proc.Faces[i])
end
-- TODO manca il caso in cui mancano facce 4 e 5
else -- Proc.nFct == 3
for i = 2, Proc.nFct do
Faces[i].nFaceOrd = i - 1
Faces[i].ptC, Faces[i].vtN = EgtSurfTmFacetCenter( Proc.id, i-1, GDB_ID.ROOT)
Faces[#Faces + 1] = BeamLib.TableCopyDeep( Proc.Faces[i])
end
end
@@ -45,36 +44,17 @@ local function GetFacesIdOrder( Proc, Part)
end
-------------------------------------------------------------------------------------------------------------
local function GetEdgeToMachine( Proc, idFace, vtEdge)
local Edge
local dBestEdgeAngle = 999
local nFaceType, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( Proc.id, idFace, GDB_ID.ROOT)
for i = 1, #EdgesEgt do
local vtEdgeN = Vector3d( EdgesEgt[i].Norm)
local dAngle = abs( GetAngle( vtEdgeN, vtEdge) or 999)
if dAngle < dBestEdgeAngle then
dBestEdgeAngle = dAngle
Edge = EdgesEgt[i]
local function GetEdgeToMachine( ClosingFace, idBottomFace)
local EdgeToMachine
for i = 1, #ClosingFace.Edges do
if ClosingFace.Edges[i].idAdjacentFace == idBottomFace then
EdgeToMachine = ClosingFace.Edges[i]
break
end
end
Edge.idAdjacentFace = Edge.Adj
Edge.dLength = Edge.Len
Edge.dElevation = abs( Edge.Elev)
Edge.bIsOpen = Edge.Open
Edge.vtN = Vector3d( Edge.Norm)
if Edge.bIsOpen then
Edge.vtN = -Edge.vtN
end
Edge.bIsStartOpen = true
Edge.bIsEndOpen = true
Edge.ptStart = Point3d( Edge.Start)
Edge.ptEnd = Point3d( Edge.Start)
Edge.vtEdge = Edge.ptEnd - Edge.ptStart ; Edge.vtEdge:normalize()
Edge.sType = 'Standard'
Edge.id = i - 1
return Edge
return EdgeToMachine
end
-------------------------------------------------------------------------------------------------------------
@@ -88,7 +68,7 @@ local function GetScarfJointStrategy( Proc, Part)
-- creo una tabella unica contenente tutte le lavorazioni
local Result = {}
local Cutting = { Machinings = {}, Result = {}}
local AntiSplint = {}
local AntiSplints = {}
local Pocketing = {}
Result.dTimeToMachine = 0
@@ -98,7 +78,7 @@ local function GetScarfJointStrategy( Proc, Part)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
-- TODO la nuova faccia creata sulla 4 può tagliare faccia 1. In caso tagliasse faccia 1, bisogna calcolare i cubetti con 2 facce
Strategy.idFeatureCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Faces[4].ptC, Faces[4].vtN, Part.b3Part, GDB_RT.GLOB)
Strategy.idFeatureCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Faces[4].ptCenter, Faces[4].vtN, Part.b3Part, GDB_RT.GLOB)
Cutting.Machinings, Cutting.Result = BladeToWaste.Make( Strategy.idFeatureCutPlane, Part)
if Cutting.Result.sStatus == 'Completed' then
Cutting.Machinings.bIsApplicable = true
@@ -106,22 +86,30 @@ local function GetScarfJointStrategy( Proc, Part)
end
-- antischeggia facce 1 e 3
local bAreAllAntisplintsApplicable = true
if Strategy.Parameters.bAntiSplint then
AntiSplints = AntiSplintOnFace.Make( Proc, Part, Faces[2])
for k = 1, #AntiSplints do
if not AntiSplints[k].bIsApplicable then
bAreAllAntisplintsApplicable = false
break
end
end
end
-- svuotatura faccia 2
if Faces[2] and Faces[2].vtN then
local frPock, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.id, Faces[2].nFaceOrd, GDB_ID.ROOT)
if Faces[2] then
local frPock, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.id, Faces[2].id, GDB_ID.ROOT)
local ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.vtToolDirection = Faces[2].vtN
ToolSearchParameters.dElevation = abs( ( Faces[2].ptC - Faces[4].ptC) * Faces[2].vtN)
ToolSearchParameters.dElevation = abs( ( Faces[2].ptCenter - Faces[4].ptCenter) * Faces[2].vtN)
ToolSearchParameters.dMaxToolDiameter = min( dL, dW)
ToolSearchParameters.ToolInfo = {}
ToolSearchParameters.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if ToolSearchParameters.ToolInfo.nToolIndex then
local Machining = MachiningLib.InitMachiningParameters( MCH_MY.POCKETING)
Machining.Geometry = {{ Proc.id, Faces[2].nFaceOrd}}
Machining.Geometry = {{ Proc.id, Faces[2].id}}
Machining.dElevation = ToolSearchParameters.dElevation
Machining.dMaxElev = Machining.dElevation
Machining.vtToolDirection = ToolSearchParameters.vtToolDirection
@@ -141,19 +129,15 @@ local function GetScarfJointStrategy( Proc, Part)
table.insert( Pocketing, Machining)
Pocketing.bIsApplicable = true
-- se non sono stati fatti i passaggi antischeggia si verifica che le facce siano a 90°, altrimenti serve passaggio con fresa
if not Strategy.Parameters.bAntiSplint or not AntiSplint.bIsApplicable then
local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.id, Faces[1].nFaceOrd, Faces[2].nFaceOrd, GDB_ID.ROOT)
if not Strategy.Parameters.bAntiSplint or not bAreAllAntisplintsApplicable then
local dAngleBetweenFaces = Proc.AdjacencyMatrix[1][2] or 0
-- si fa passaggio con fresa
if dAng > -90 then
-- TODO da fare!!
-- local EdgeToMachine = GetEdgeToMachine( Proc, Faces[1].nFaceOrd, Faces[2].vtN)
-- local Milling = FaceByMill.Make( Proc, Part, Faces[1].nFaceOrd, EdgeToMachine)
-- if Proc.AffectedFaces.bLeft then
-- Milling.sStage = 'AfterTail'
-- end
-- if Milling.bIsApplicable then
-- table.insert( Pocketing, Milling)
-- end
if dAngleBetweenFaces > -90 then
local EdgeToMachine = GetEdgeToMachine( Faces[1], Faces[2].id)
local CuttingClosingFace = FaceByBlade.Make( Proc, Part, Faces[1], EdgeToMachine)
if CuttingClosingFace.bIsApplicable then
table.insert( AntiSplints, CuttingClosingFace)
end
end
end
end
@@ -167,9 +151,9 @@ local function GetScarfJointStrategy( Proc, Part)
else
local dCompletionPercentage = 100
-- completa se svuotatura eseguita e antisplit eseguiti (o non richiesti)
if Pocketing.bIsApplicable and ( AntiSplint.bIsApplicable or not Strategy.Parameters.bAntiSplint) then
if Pocketing.bIsApplicable and ( bAreAllAntisplintsApplicable or not Strategy.Parameters.bAntiSplint) then
Result.sStatus = 'Completed'
if AntiSplint.bIsApplicable then
if bAreAllAntisplintsApplicable then
Result.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
else
Result.dQuality = FeatureLib.GetStrategyQuality( 'STD')
@@ -182,7 +166,7 @@ local function GetScarfJointStrategy( Proc, Part)
if Pocketing.bIsApplicable then
dCompletionPercentage = 90
Result.sInfo = 'Anti-Split not executed'
elseif Strategy.Parameters.bAntiSplint and AntiSplint.bIsApplicable then
elseif Strategy.Parameters.bAntiSplint and bAreAllAntisplintsApplicable then
dCompletionPercentage = 75
Result.sInfo = 'Pocketing not executed'
else
@@ -197,7 +181,7 @@ local function GetScarfJointStrategy( Proc, Part)
-- creo una tabella unica contenente tutte le lavorazioni
local Machinings = {}
EgtJoinTables( Machinings, Cutting.Machinings)
EgtJoinTables( Machinings, AntiSplint)
EgtJoinTables( Machinings, AntiSplints)
EgtJoinTables( Machinings, Pocketing)
return Machinings, Result