- in PreSimulationLIb correzioni importanti in test collisione

This commit is contained in:
luca.mazzoleni
2026-05-08 11:54:16 +02:00
parent 7c485360de
commit f58004dfeb
2 changed files with 13 additions and 14 deletions
+10 -14
View File
@@ -301,16 +301,14 @@ local function MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
EgtSetAxisPos( AxesNames[6], dRotative3)
end
return dTHome - dLinear1, AxesNames
return dLinear1 - dTHome
end
-------------------------------------------------------------------------------------------------------------
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
-- spostamento assi macchina in posizione
local dDeltaXBeamOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
-- spostamento trave in posizione macchina (è da riportare in posizione originale prima di return)
EgtMove( Part.idRaw, Vector3d( dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
-- si recuperano gli id delle geometrie dell'asse con cui controllare la collisione
local idCollisionGroup = EgtGetFirstNameInGroup( EgtGetAxisId( sAxis), 'COLLISION')
@@ -321,14 +319,18 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
local CollisionSurfTmId = {}
for i = 1, #CollisionGroupEntitiesId do
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then
table.insert( CollisionSurfTmId, CollisionGroupEntitiesId[i])
local idCollisionSurfTmCopy = EgtCopyGlob( CollisionGroupEntitiesId[i], Part.idTempGroup)
EgtMove( idCollisionSurfTmCopy, Vector3d( dDeltaXHeadOffset, 0, 0), GDB_RT.GLOB)
table.insert( CollisionSurfTmId, idCollisionSurfTmCopy)
end
end
-- se presenti geometrie nel gruppo other si aggiungono anche quelle
if CollisionGroupOtherEntitiesId and #CollisionGroupOtherEntitiesId > 0 then
for i = 1, #CollisionGroupEntitiesId do
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then
table.insert( CollisionSurfTmId, CollisionGroupEntitiesId[i])
for i = 1, #CollisionGroupOtherEntitiesId do
if EgtGetType( CollisionGroupOtherEntitiesId[i]) == GDB_TY.SRF_MESH then
local idCollisionOtherSurfTmCopy = EgtCopyGlob( CollisionGroupOtherEntitiesId[i], Part.idTempGroup)
EgtMove( idCollisionOtherSurfTmCopy, Vector3d( dDeltaXHeadOffset, 0, 0), GDB_RT.GLOB)
table.insert( CollisionSurfTmId, idCollisionOtherSurfTmCopy)
end
end
end
@@ -357,8 +359,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
-- se trovata collisione con pezzo è inutile procedere con il grezzo
if bCollisionFoundPiece then
-- si riporta la trave in posizione originale
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
return true
end
@@ -368,7 +368,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
local bCollisionFoundRestLength = false
if not ( bCollisionFoundPiece or bCannotSplitRestLength) then
local idRestLengthSurfFr = GetRestlengthSurfTm( Part, sRestLengthSideForPreSimulation)
EgtMove( idRestLengthSurfFr, Vector3d( dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
if idRestLengthSurfFr then
for i = 1, #CollisionSurfTmId do
bCollisionFoundRestLength = EgtCDeSolidSolid( idRestLengthSurfFr, CollisionSurfTmId[i], BeamData.COLL_SIC)
@@ -385,9 +384,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
end
end
-- si riporta la trave in posizione originale
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
return false, bCollisionFoundRestLength
end
+3
View File
@@ -232,6 +232,9 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Tool = TOOLS[Cutting.nToolIndex],
dDepthToMachine = dDepthToMachine
}
if OppositeToolDirectionMode == 'Enabled' then
BladeEngagementParameters.Edge = EdgeToMachineOpposite
end
local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing,
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,