Model.hm_proximitygetcomponentpaircount#
- Model.hm_proximitygetcomponentpaircount()#
Returns the number of proximity component pairs.
his must be preceded by a call to
Model.hm_proximityinit()and followed by a call toModel.hm_proximityend().- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:numberOfPairs (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()