hm_collisiongetcomponentpair

Returns the component IDs of a collision pair.

Syntax

hm_collisiongetcomponentpair collision_type component_index ?include_ignored?

Type

HyperMesh Tcl Query Command

Description

Returns the component IDs of a 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.

For each collision type there is a list of pairs of colliding components. For each colliding component pair, there is a list of colliding entity pairs. Thus, their is a hierarchy of data with the tree looking like this:

collision type -> component pairs -> entity pairs

The data is therefore accessed as:
  1. Get the number of colliding component pairs.
  2. Get the component IDs for each component pair.
  3. Get the number of intersected entities for each component pair.
  4. 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:
0 - intersections
1 - penetrations
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.
include_ignored (optional)
Specifies if results ignored when the allowable_depth value is specified via hm_collisioninit should be reported or not:
0 - Do not include ignored results (default).
1 - Include ignored results.

Example

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]
            }
        }
    }
}
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]
            }
        }
    }
}
hm_collisionend

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

13.0