hm_collisiongetcomponententitypair
Returns the entity details for an entity collision pair.
Syntax
hm_collisiongetcomponententitypair collision_type component_index entity_index ?include_ignored?
Type
HyperMesh Tcl Query
Description
Returns the entity details for an entity collision pair. This must be preceded by a call to relevant hm_collision* commands to generate the collision data. In addition, the pair_results flag to hm_collisioncheck must be set to 1.
- entity_type1 entity_id1 face_index1 entity_type2 entity_id2 face_index2
- entity_type1 entity_id1 face_index1 entity_type2 entity_id2 face_index2 depth direction_x direction_y directon_z
- collision type -> component pairs -> entity pairs
- Get the number of colliding component pairs
- Get the component IDs for each component pair
- Get the number of intersected entities for each component pair
- Get the entity types, IDs, and faces (for intersections) or the entity types, IDs, faces, depths and directions (for penetrations) for each intersected entity pair.
Inputs
- collision_type
- The type of collision to query:
- component_index
- The index of the component pair to query, starting from 0. The total number of component pairs for a specific collision_type can be found using hm_collisongetcomponentpaircount.
- entity_index
- The index of the entity pair to query, starting from 0. The total number of entity pairs for a specific component_index can be found using hm_collisongetcomponententitypaircount.
- include_ignored (optional)
- Specifies if results ignored when the allowable_depth value is specified via hm_collisioninit should be reported or not:
Examples
To find intersecting surfaces from IDs 1-10, and to get the detailed list of entities for each intersection:
*createmark surfs 1 1-10
hm_collisioninit
hm_collisionentitycreate surfs 1 0 1 0 0 0 0 0 0
hm_collisioncheck 0 0 1 0 0 0 0 90.0 0 0 0.0 1
set component_pair_count [hm_collisiongetcomponentpaircount 0]
if {$pair_count > 0} {
for {set i 0} {$i < $component_pair_count} {incr i} {
set component_pairs($i) [hm_collisiongetcomponentpair 0 $i]
set entity_pair_count [hm_collisiongetcomponententitypaircount 0 $i]
if {$pair_count != 0} {
for {set j 0} {$j < $entity_pair_count} {incr j} {
set entity_pairs($i,$j) [hm_collisiongetcomponententitypair 0 $i $j]
lassign $entity_pairs($i,$j) type id1 dd1 type2 id2 dd2
}
}
}
}
hm_collisionend
To find penetrating surfaces from IDs 1-10, using the thickness assigned to the surface components, and to get the detailed list of entities for each intersection:
*createmark surfs 1 1-10
hm_collisioninit
hm_collisionentitycreate surfs 1 0 1 0 0 0 0 0 0
hm_collisioncheck 0 0 0 1 0 0 0 90.0 0 0 0.0 1
set component_pair_count [hm_collisiongetcomponentpaircount 1]
if {$pair_count > 0} {
for {set i 0} {$i < $component_pair_count} {incr i} {
set component_pairs($i) [hm_collisiongetcomponentpair 1 $i]
set entity_pair_count [hm_collisiongetcomponententitypaircount 1 $i]
if {$pair_count != 0} {
for {set j 0} {$j < $entity_pair_count} {incr j} {
set entity_pairs($i,$j) [hm_collisiongetcomponententitypair 1 $i $j]
lassign $entity_pairs($i,$j) type id1 dd1 type2 id2 dd2 depth x y z
}
}
}
}
hm_collisionend
Errors
if { [ catch {command_name...} ] } {
# Handle error
}
Version History
13.0