Model.hm_proximityinitwithtarget#

Model.hm_proximityinitwithtarget(source_collection, target_collection, max_proximity_distance, check_side=3, proximity_scheme=1, proximity_by_edge=0, min_angle_limit=0, max_angle_limit=180)#

Checks the proximity between elements or components, allowing the user to specify the target, and stores the results internally. Other APIs can be used to query the results.

This must precede any calls to other hm_proximityget/ hm_proximitymark APIs, and must be followed by a call to Model.hm_proximityend().

Parameters:
  • source_collection (Collection) – The collection containing the source input entities to query. Valid entities are elements and components.

  • target_collection (Collection) – The collection containing the target input entities to query. Valid entities are elements and components.

  • max_proximity_distance (double) – The maximum distance beyond which proximity is not reported.

  • check_side (unsigned int) –

    1 - Check both sides of the elements.

    2 - Check the element normal side only.

    3 - Check ‘outward volume’ side (default behavior if not specified).

    4 - Check ‘inward volume’ side.

  • proximity_scheme (unsigned int) –

    0 - Checks basic proximity along a ray from the element center along the normal direction.

    1 - Checks comprehensive proximity. Reports any proximity within an imaginary offsetted volume of the element (default behavior if not specified).

  • proximity_by_edge (unsigned int) –

    0 - Ignores proximity for nearby edges (default behavior if not specified).

    1 - Considers proximity for nearby edges.

  • min_angle_limit (double) – If the angle between the proximate element pairs is less than this value, such pairs are not reported.

  • max_angle_limit (double) – If the angle between the proximate element pairs is greater than this value, such pairs are not reported.

Returns:

Example#

Find elements in proximity between the “ source “ and “ target “ components , and highlight the found entities#
import hm
import hm.entities as ent

model = hm.Model()

components_collection_source = hm.Collection(model, ent.Component, "name=source")
components_collection_target = hm.Collection(model, ent.Component, "name=target")

model.hm_proximityinitwithtarget(
    source_collection=components_collection_source,
    target_collection=components_collection_target,
    max_proximity_distance=2.5,
)

elemFromComps_source = hm.Collection(model, ent.Element, populate=False)
elemFromComps_target = hm.Collection(model, ent.Element, populate=False)

model.hm_proximitymarksourceproximityelements(collection=elemFromComps_source)
model.hm_proximitymarktargetproximityelements(collection=elemFromComps_target)

model.hm_highlightmark(collection=elemFromComps_source, highlight="h")
model.hm_highlightmark(collection=elemFromComps_target, highlight="h")

model.hm_proximityend()