- 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) EgtSetAxisPos( AxesNames[6], dRotative3)
end end
return dTHome - dLinear1, AxesNames return dLinear1 - dTHome
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength) local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
-- spostamento assi macchina in posizione -- spostamento assi macchina in posizione
local dDeltaXBeamOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux) local dDeltaXHeadOffset = 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)
-- si recuperano gli id delle geometrie dell'asse con cui controllare la collisione -- si recuperano gli id delle geometrie dell'asse con cui controllare la collisione
local idCollisionGroup = EgtGetFirstNameInGroup( EgtGetAxisId( sAxis), 'COLLISION') local idCollisionGroup = EgtGetFirstNameInGroup( EgtGetAxisId( sAxis), 'COLLISION')
@@ -321,14 +319,18 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
local CollisionSurfTmId = {} local CollisionSurfTmId = {}
for i = 1, #CollisionGroupEntitiesId do for i = 1, #CollisionGroupEntitiesId do
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then 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
end end
-- se presenti geometrie nel gruppo other si aggiungono anche quelle -- se presenti geometrie nel gruppo other si aggiungono anche quelle
if CollisionGroupOtherEntitiesId and #CollisionGroupOtherEntitiesId > 0 then if CollisionGroupOtherEntitiesId and #CollisionGroupOtherEntitiesId > 0 then
for i = 1, #CollisionGroupEntitiesId do for i = 1, #CollisionGroupOtherEntitiesId do
if EgtGetType( CollisionGroupEntitiesId[i]) == GDB_TY.SRF_MESH then if EgtGetType( CollisionGroupOtherEntitiesId[i]) == GDB_TY.SRF_MESH then
table.insert( CollisionSurfTmId, CollisionGroupEntitiesId[i]) local idCollisionOtherSurfTmCopy = EgtCopyGlob( CollisionGroupOtherEntitiesId[i], Part.idTempGroup)
EgtMove( idCollisionOtherSurfTmCopy, Vector3d( dDeltaXHeadOffset, 0, 0), GDB_RT.GLOB)
table.insert( CollisionSurfTmId, idCollisionOtherSurfTmCopy)
end end
end 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 -- se trovata collisione con pezzo è inutile procedere con il grezzo
if bCollisionFoundPiece then if bCollisionFoundPiece then
-- si riporta la trave in posizione originale
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
return true return true
end end
@@ -368,7 +368,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
local bCollisionFoundRestLength = false local bCollisionFoundRestLength = false
if not ( bCollisionFoundPiece or bCannotSplitRestLength) then if not ( bCollisionFoundPiece or bCannotSplitRestLength) then
local idRestLengthSurfFr = GetRestlengthSurfTm( Part, sRestLengthSideForPreSimulation) local idRestLengthSurfFr = GetRestlengthSurfTm( Part, sRestLengthSideForPreSimulation)
EgtMove( idRestLengthSurfFr, Vector3d( dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
if idRestLengthSurfFr then if idRestLengthSurfFr then
for i = 1, #CollisionSurfTmId do for i = 1, #CollisionSurfTmId do
bCollisionFoundRestLength = EgtCDeSolidSolid( idRestLengthSurfFr, CollisionSurfTmId[i], BeamData.COLL_SIC) bCollisionFoundRestLength = EgtCDeSolidSolid( idRestLengthSurfFr, CollisionSurfTmId[i], BeamData.COLL_SIC)
@@ -385,9 +384,6 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
end end
end end
-- si riporta la trave in posizione originale
EgtMove( Part.idRaw, Vector3d( -dDeltaXBeamOffset, 0, 0), GDB_RT.GLOB)
return false, bCollisionFoundRestLength return false, bCollisionFoundRestLength
end end
+3
View File
@@ -232,6 +232,9 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Tool = TOOLS[Cutting.nToolIndex], Tool = TOOLS[Cutting.nToolIndex],
dDepthToMachine = dDepthToMachine dDepthToMachine = dDepthToMachine
} }
if OppositeToolDirectionMode == 'Enabled' then
BladeEngagementParameters.Edge = EdgeToMachineOpposite
end
local BladeEngagementOptionalParameters = { local BladeEngagementOptionalParameters = {
bIsDicing = bIsDicing, bIsDicing = bIsDicing,
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation, sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,