Model.hm_getelemcheckelems#

Model.hm_getelemcheckelems(elementsCollection, dimension, check_type, check_mode, threshold=0, tolerance=0, time_failure=0.005)#

Returns the elements that match the specified element check criteria. Only the elements on elementsCollection and of the specified dimension are considered when determining which elements match the specified criteria.

Parameters:
  • elementsCollection (Collection) – The collection containing the element entities.

  • dimension (int) –

    The dimension of the elements on elements to consider. Valid values are:

    1 - 1D elements

    2 - 2D elements

    3 - 3D elements

    If no elements of the specified dimension are on elements, an error is returned.

  • check_type (hwString) –

    The type of element check to return the bounds from. The allowable values depend on the dimension specified:

    • dimension=1: length, timestep

    • dimension=2: addedmass, aspect, cellsquish, chordaldev, equiskew, jacobian, length, maxinterangle, maxlength, mininterangle, minlength, skew, taper, timestep, volumeareaskew, warpage

    • dimension=3: addedmass, altitudeaspect, aspect, cellsquish, equiskew, jacobian, length, maxinterangle, maxlength, mininterangle, minlength, ortho_3d, size_ratio_3d, skew, taper, tetracollapse, timestep, volumeareaskew, volumetricskew, warpage

  • check_mode (hwString) –

    The type of element check to perform. Valid values are:

    above - Return the entities that are above the specified threshold value of the check_type from the elements on elementsCollection of the specified dimension.

    below - Return the entities that are below the specified threshold value of the check_type from the elements on elementsCollection of the specified dimension.

    exact - Return the entities that have the specified threshold value (within tolerance) of the check_type from the elements on elementsCollection of the specified dimension.

    max - Return the entity(ies) that have the maximum value of the check_type from the elements on elementsCollection of the specified dimension.

    min - Return the entity(ies) that have the minimum value of the check_type from the elements on elementsCollection of the specified dimension.

  • threshold (double) – The threshold value to use when check_mode is set to above, below or exact. This is ignored and not required when check_mode is set to max or min.

  • tolerance (double) – The tolerance value to use when check_mode is set exact. This is ignored and not required when check_mode is set to max, min, above or below.

  • time_failure (double) – The value to use as a threshold beyond which the input elements should be considered to have failed the test. This is required only when check_type="addedmass".

Returns:

Examples#

Get the 1D elements that have the minimum length from the elements in component with name “ comp1 “#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.Collection(
    model, ent.Element, hm.Collection(model, ent.Component, "name=comp1")
)

_, result = model.hm_getelemcheckelems(
    elementsCollection=element_collection,
    dimension=1,
    check_type="length",
    check_mode="min",
)

print("Element IDs:",[e.id for e in result.elements])
Get the 2D elements that have the maximum warpage from the displayed elements#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.CollectionByDisplayed(model, ent.Element)

_, result = model.hm_getelemcheckelems(
    elementsCollection=element_collection,
    dimension=2,
    check_type="warpage",
    check_mode="max",
)

print("Element IDs:", [e.id for e in result.elements])
Get the 2D elements that have a warpage above 5.0 from the displayed elements#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.CollectionByDisplayed(model, ent.Element)

_, result = model.hm_getelemcheckelems(
    elementsCollection=element_collection,
    dimension=2,
    check_type="warpage",
    check_mode="above",
    threshold=5.0,
)

print("Element IDs:", [e.id for e in result.elements])
Get the 3D elements that have a tetracollapse below 0.1 from all elements#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.Collection(model, ent.Element)

_, result = model.hm_getelemcheckelems(
    elementsCollection=element_collection,
    dimension=3,
    check_type="tetracollapse",
    check_mode="below",
    threshold=0.1,
)

print("Element IDs:", [e.id for e in result.elements])
Get the 3D elements that have a jacobian of exactly 1.0 from all elements , with a tolerance of 0.01#
import hm
import hm.entities as ent

model = hm.Model()

element_collection = hm.Collection(model, ent.Element)

_, result = model.hm_getelemcheckelems(
    elementsCollection=element_collection,
    dimension=3,
    check_type="jacobian",
    check_mode="exact",
    threshold=1.0,
    tolerance=0.01,
)

print("Element IDs:", [e.id for e in result.elements])