- in BLADETOWASTE.CalculateDiceMachinings si calcola il grezzo dinamico per la presimulazione. Da completare e gestire in presimulazione

This commit is contained in:
luca.mazzoleni
2026-06-10 18:15:17 +02:00
parent 44478b91f0
commit eec6b50985
+57 -13
View File
@@ -782,6 +782,46 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
end
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part, MainFace, OtherFace)
-- frame solidale alla feature
local vtZ = MainFace.vtN
local vtX = OtherFace and OtherFace.vtN or nil
local frMainFace = Frame3d( MainFace.ptCenter, vtZ, vtX)
-- box del cubetto in riferimento feature
local b3Surf = EgtGetBBoxRef( idParallelTm, GDB_BB.STANDARD, frMainFace)
local b3SurfPerpendicular = EgtGetBBoxRef( idPerpendicularTm, GDB_BB.STANDARD, frMainFace)
b3Surf:Add( b3SurfPerpendicular)
-- estensione box per non avere problemi nella sottrazione booleana
if OtherFace then
local vtY = vtZ ^ vtX
local ptDeltaX = b3Surf:getMax() + vtX * 1
local ptDeltaZ = b3Surf:getMax() + vtZ * 1
local ptDeltaYplus = b3Surf:getMax() + vtY * 1
local ptDeltaYminus = b3Surf:getMin() - vtY * 1
b3Surf:Add( ptDeltaX)
b3Surf:Add( ptDeltaZ)
b3Surf:Add( ptDeltaYplus)
b3Surf:Add( ptDeltaYminus)
else
b3Surf:expand( 1)
end
-- si porta il box in riferimento globale
b3Surf:toGlob( frMainFace)
-- conversione box cubetto in superficie
local idSurfTmToSubtract = EgtSurfTmBBox( Part.idTempGroup, b3Surf, false, GDB_RT.GLOB)
-- sottrazione del cubetto dal grezzo
EgtSurfTmSubtract( idRaw, idSurfTmToSubtract)
return idRaw
end
local function CalculateDiceMachinings( vCuts, Parameters)
local Machinings = {}
local bMoveAfterSplit = false
@@ -789,6 +829,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
local Proc = Parameters.Proc
local Part = Parameters.Part
local MainFace = Parameters.MainFace
local OtherFace = next( Parameters.OtherFace) and Parameters.OtherFace or nil
local Tool = Parameters.Tool
local sChosenBladeType = Parameters.sChosenBladeType
local dExtendAfterTail = Parameters.dExtendAfterTail
@@ -797,21 +838,15 @@ local function CalculateDiceMachinings( vCuts, Parameters)
local bCannotSplitRestLength = Parameters.bCannotSplitRestLength
local bReduceDiceDepth = Parameters.bReduceDiceDepth
-- trimesh con RestLength
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
local idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
-- eventuale inversione tagli ortogonali e aggiunta informazioni alla geometria
local bAreOrthogonalCutsInverted = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
SetDiceFaceInfo( Proc, vCuts[i][j])
-- TODO vedere se questa parte serve ancora; in teoria no perchè il taglio è girato automaticamente nella FaceByBlade
-- if ( i % 2) == 1 then
-- local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
-- if MachiningLib.IsFaceZOutOfRange( vtO, Tool) then
-- EgtInvertSurf( vCuts[i][j])
-- local vtCurrentFaceNormal = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
-- EgtMove( vCuts[i][j], -vtCurrentFaceNormal * Tool.dThickness, GDB_RT.GLOB)
-- bAreOrthogonalCutsInverted = true
-- end
-- end
end
end
-- calcolo lavorazioni
@@ -857,8 +892,8 @@ local function CalculateDiceMachinings( vCuts, Parameters)
local bIsDicingOk = true
if bCanMergeParallelCuts then
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( nSurfToCut, Part)
local idSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( idSurfToCut, Part)
local OptionalParametersCutWholeWaste = {
nToolIndex = Tool.nIndex,
@@ -877,8 +912,12 @@ local function CalculateDiceMachinings( vCuts, Parameters)
bMoveAfterSplit = true
end
end
-- aggiornamento grezzo dinamico
if i % 2 == 0 then
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, vCuts[i-1][#vCuts[i-1]], Part, MainFace, OtherFace)
end
else
EgtErase( nSurfToCut)
EgtErase( idSurfToCut)
bIsDicingOk = false
end
end
@@ -936,6 +975,10 @@ local function CalculateDiceMachinings( vCuts, Parameters)
if Cutting.sStage == 'AfterTail' then
bMoveAfterSplit = true
end
-- aggiornamento grezzo dinamico
if i % 2 == 0 then
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part, MainFace, OtherFace)
end
end
end
end
@@ -1013,6 +1056,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
Proc = Proc,
Part = Part,
MainFace = Face1,
OtherFace = Face2,
Tool = TOOLS[nToolIndex],
sChosenBladeType = sChosenBladeType,
dExtendAfterTail = dExtendAfterTail,