- in BeamLib creata funzione GetPartBoxWithHeadTailOvermaterial per recuperare il box della parte con aggiunto il sovramateriale di testa e/o coda; implementata in vari punti

- in LeadInOutLib e PreSimulationLib se necessario si estende il box per contemplare materiale in testa e in coda
This commit is contained in:
luca.mazzoleni
2026-01-28 15:59:35 +01:00
parent 995917672c
commit ee4d443074
9 changed files with 93 additions and 39 deletions
+37
View File
@@ -65,6 +65,43 @@ function BeamLib.AddPartEndFace( PartId, b3Solid)
return true
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPartBoxWithHeadTailOvermaterial( Part, sSide)
local _sSide = sSide or ''
-- il box del grezzo contiene sempre il sovramateriale di testa
if _sSide == 'Head' then
local b3WithHead = BBox3d( Part.b3Raw)
return b3WithHead
-- per aggiungere il materiale di coda si aggiunge il box dell'eventuale grezzo successivo
elseif _sSide == 'Tail' then
local b3WithTail = BBox3d( Part.b3Part)
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
if nNextRawId then
local b3Tail = EgtGetRawPartBBox( nNextRawId)
b3WithTail:Add( b3Tail)
end
return b3WithTail
-- per aggiungere entrambi si procede come per la coda ma partendo dal box del grezzo, che già contiene la testa
else
local b3WithHeadTail = BBox3d( Part.b3Raw)
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
if nNextRawId then
local b3Tail = EgtGetRawPartBBox( nNextRawId)
b3WithHeadTail:Add( b3Tail)
end
return b3WithHeadTail
end
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPartSplittingPoints( Part)
local PartSplittingPoints = {}
+1
View File
@@ -941,6 +941,7 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
local dNotClampableLengthTail = 0
-- se il grezzo non è definito, prendo il box del pezzo
-- TODO 1- si sta passando b3part per riferimento, 2- non dovrebbe essre sempre definito?
if not Part.b3Raw then
Part.b3Raw = Part.b3Part
end
+18 -2
View File
@@ -8,6 +8,7 @@ local LeadInOutLib = {}
require( 'EgtBase')
local BeamData = require( 'BeamDataNew')
local FaceData = require( 'FaceData')
local BeamLib = require( 'BeamLib')
EgtOutLog( ' LeadInOutLib started', 1)
@@ -99,7 +100,7 @@ end
-------------------------------------------------------------------------------------------------------------
function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters)
function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters, OptionalParameters)
-- parametri obbligatori
local Face = Parameters.Face
@@ -108,6 +109,11 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters)
local Tool = Parameters.Tool
local dDepthToMachine = Parameters.dDepthToMachine
-- parametri opzionali
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
local bMoveAfterSplit = OptionalParameters.bMoveAfterSplit or false
local LeadInOut = {}
local bIsStartClosed = not Edge.bIsStartOpen
local bIsEndClosed = not Edge.bIsEndOpen
@@ -159,8 +165,18 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters)
local ptEndBladeCenter = ptEndAtDepth + Edge.vtN * Tool.dDiameter / 2
-- box per calcolo uscita lama
-- se è un taglio di testa o coda oppure se di coda e non si sposta dopo separazione va aggiunto il sovramateriale
local b3BoxPartExpanded = BBox3d( Part.b3Part)
if bCannotSplitRestLength or ( not bMoveAfterSplit) then
if ( sRestLengthSideForPreSimulation == 'Head') or Part.bIsLastPart then
b3BoxPartExpanded = BeamLib.GetPartBoxWithHeadTailOvermaterial( Part, sRestLengthSideForPreSimulation)
elseif sRestLengthSideForPreSimulation == 'Tail' then
local ptPointAtRestLength = Point3d( b3BoxPartExpanded:getMin():getX() - Part.dRestLength, b3BoxPartExpanded:getMin():getY(), b3BoxPartExpanded:getMin():getZ())
b3BoxPartExpanded:Add( ptPointAtRestLength)
end
end
-- il box si espande in tutte le direzioni per contemplare la sicurezza CUT_SIC
local b3BoxPartExpanded = BBox3d( Part.b3Part) ; b3BoxPartExpanded:expand( BeamData.CUT_SIC)
b3BoxPartExpanded:expand( BeamData.CUT_SIC)
-- calcolo attacco scelto
if sLeadInOutType == 'Perpendicular' then
+7 -2
View File
@@ -350,9 +350,14 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
-- calcolo e check attacchi
local LeadInOut = {}
local LeadInOutOptionalParameters = {
sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation,
bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength,
bMoveAfterSplit = bMoveAfterSplit
}
-- attacco perpendicolare
local PerpendicularLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Perpendicular', Parameters)
local PerpendicularLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Perpendicular', Parameters, LeadInOutOptionalParameters)
-- check extracorsa nei punti di attacco
PointsOnToolTipCenter = {
@@ -376,7 +381,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
end
-- attacco tangenziale
local TangentLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Tangent', Parameters)
local TangentLeadInOut = LeadInOutLib.CalculateLeadInOut( 'Tangent', Parameters, LeadInOutOptionalParameters)
-- check extracorsa nei punti di attacco
PointsOnToolTipCenter = {
PreSimulationLib.GetPointOnToolTipCenter( TangentLeadInOut.LeadIn.ptPoint, vtHead, Face.vtN, Edge.vtN, Tool),
+9 -9
View File
@@ -69,15 +69,15 @@ end
local function GetRestlengthSurfTm( Part, sRestLengthSideForPreSimulation)
-- si costruisce il box in globale
local b3RestLength = BBox3d()
if sRestLengthSideForPreSimulation == 'Tail' then
local ptRestLengthMax = Point3d( Part.b3Part:getMin()) + X_AX() * 500 * GEO.EPS_SMALL
local ptRestLengthMin = Point3d( Part.b3Part:getMin():getX() - Part.dRestLength, Part.b3Part:getMax():getY(), Part.b3Part:getMax():getZ())
b3RestLength = BBox3d( ptRestLengthMin, ptRestLengthMax)
elseif sRestLengthSideForPreSimulation == 'Head' then
local ptRestLengthMin = Point3d( Part.b3Part:getMax() - X_AX() * 500 * GEO.EPS_SMALL)
local ptRestLengthMax = Point3d( Part.b3Part:getMaX():getX() + Part.dHeadOverMaterial, Part.b3Part:getMin():getY(), Part.b3Part:getMin():getZ())
b3RestLength = BBox3d( ptRestLengthMin, ptRestLengthMax)
local b3RestLength
if ( sRestLengthSideForPreSimulation == 'Head') or Part.bIsLastPart then
b3RestLength = BeamLib.GetPartBoxWithHeadTailOvermaterial( Part, sRestLengthSideForPreSimulation)
elseif sRestLengthSideForPreSimulation == 'Tail' then
b3RestLength = BBox3d( Part.b3Part)
local ptPointAtRestLength = Point3d( b3RestLength:getMin():getX() - Part.dRestLength, b3RestLength:getMin():getY(), b3RestLength:getMin():getZ())
b3RestLength:Add( ptPointAtRestLength)
else
b3RestLength = BBox3d( Part.b3Part)
end
-- si crea la trimesh dal box