Model.calculateproximityelements#

Model.calculateproximityelements(input_collection, output_collection, dim_type, calc_type, self_interference, check_method, proximity_dist, pair_angle, threshold_depth)#

Allows you to find which input elements are within a specified proximity distance. There are options to narrow or expand the constraints placed on the search algorithm. These constraints include, dimension of elements considered, type of interference, whether elements of the same component can interfere, angle between interfering element face normals and a threshold depth.

Parameters:
  • input_collection (Collection) – The collection containing the entities to check for element proximity. Valid entities are elements and components.

  • output_collection (Collection) – The collection containing the element entities within proximity distance.

  • dim_type (int) –

    The dimensionality of the elements to check:

    0 - Check both 2D and 3D elements.

    2 - Only check 2D elements.

    3 - Only check 3D elements.

  • calc_type (int) –

    Type of interferences considered:

    0 - Intersections only.

    1 - Both intersections and penetrations.

    2 - Penetrations only.

  • self_interference (int) – Set to 1 to consider self-intersections and penetrations within component, otherwise set to 0.

  • check_method (int) –

    Used to specify a stricter definition of penetration - one requiring all nodes on element to be within proximity distance for the elements to be added to output_collection.

    0 - To avoid.

    1 - To utilize stricter method. This stricter check is not generally recommended.

  • proximity_dist (double) – Proximity distance - a float value greater than 0.0.

  • pair_angle (double) – Only include elements forming interference pair with another element within this angle - a float with values ranging from 0.0 to 90.0.

  • threshold_depth (double) – Results avoid elements penetrating by less than this value - float value greater than 0.0, and less than the proximity_dist.

Example#

Place on output_collection the elements contained in components selected interactively on input_collection that are within 2.0 proximity distance. Furthermore, avoid including any elements whose interference element partners normal differs by more than 45.0 degrees#
import hm
import hm.entities as ent

model = hm.Model()

out_collection = hm.Collection(model, ent.Element, populate=False)
model.calculateproximityelements(
    input_collection=hm.CollectionByInteractiveSelection(model, ent.Component),
    output_collection=out_collection,
    dim_type=0,
    calc_type=0,
    self_interference=1,
    check_method=0,
    proximity_dist=2.0,
    pair_angle=45.0,
    threshold_depth=0.0,
)