Model.hm_proximitygetcomponentelementpaircount#
- Model.hm_proximitygetcomponentelementpaircount(component_pair_index)#
Returns the number of element pairs for a specific component pair.
This must be preceded by a call to
Model.hm_proximityinit()and followed by a call toModel.hm_proximityend().- Parameters:
component_pair_index (unsigned int) – The index of the component pair. This starts from 0 and must be less that the value returned by
Model.hm_proximitygetcomponentpaircount().- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:numberOfPair (int)
Example#
Calculate the proximity between all components use a max distance of 2.5 and to query the component pairs#import hm import hm.entities as ent model = hm.Model() components_collection = hm.Collection(model, ent.Component) model.hm_proximityinit(components_collection, max_distance=2.5) _, result = model.hm_proximitygetcomponentpaircount() comp_pair_count = result.numberOfPairs i = 0 while i < comp_pair_count: _, result = model.hm_proximitygetcomponentpair(component_pair_index=i) comp_pair = result.entityPair print(f"Component pair {i}:", [c.id for c in comp_pair]) _, result = model.hm_proximitygetcomponentelementpaircount(component_pair_index=i) elem_pair_count = result.numberOfPair j = 0 while j < elem_pair_count: _, result = model.hm_proximitygetcomponentelementpair( component_pair_index=i, element_pair_index=j ) elem_pair = result.entityPair print(f" Element pair {j}:", [e.id for e in elem_pair]) j += 1 i += 1 model.hm_proximityend()