Model.hm_proximitymarkcomponentallelementpairs#
- Model.hm_proximitymarkcomponentallelementpairs(component_pair_index, collection1, collection2)#
Registers into collections the 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().collection1 (Collection) – The output collection on which the element entities for the first component are placed.
collection2 (Collection) – The output collection on which the element entities for the second component are placed.
- Returns:
hwReturnStatus- Status object
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]) elemFromComps1 = hm.Collection(model, ent.Element, populate=False) elemFromComps2 = hm.Collection(model, ent.Element, populate=False) model.hm_proximitymarkcomponentallelementpairs( component_pair_index=i, collection1=elemFromComps1, collection2=elemFromComps2 ) print("Elements from 1st component:", [el.id for el in elemFromComps1]) print("Elements from 2nd component:", [el.id for el in elemFromComps2]) i += 1 model.hm_proximityend()