hm_collisiongetcomponentpaircount
Returns the number of component collision pairs.
Syntax
hm_collisiongetcomponentpaircount collision_type ?include_ignored?
Type
HyperMesh Tcl Query Command
Description
Returns the number of component collision pairs. 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
- 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:
- 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 {$component_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 {$entity_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 {$component_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 {$entity_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
if { [ catch {command_name...} ] } {
# Handle error
}
Version History
13.0