Model.hm_getsurfacethicknessvalues_bycollection#

Model.hm_getsurfacethicknessvalues_bycollection(collection, element_method, ambiguous_values=0)#

Returns the midsurface thickness and offset values for nodes, points, or elements.

An error is returned if a non-topological point or node or an element not associated to any surface, is given as input.

Parameters:
  • collection (Collection) – The collection containing the entities to query. Valid entities are nodes, points, elements.

  • element_method (unsigned int) –

    Only allowed for collection containing element entities. This determines how the thickness and offset values are measured for elements (ignored when the collection contains nodes or points). Valid values are:

    0 - Thickness and offset are measured at the element centroid.

    1 - Thickness and offset are measured as a weighted average of the element’s nodes. If an element spans multiple surfaces, -1 is returned for thickness and offset.

    2 - Thickness is measured at the element’s nodes and the minimum value is used. The offset value from this node is also reported. If an element spans multiple surfaces, -1 is returned for thickness and offset.

    3 - Thickness is measured at the element’s nodes and the maximum value is used. The offset value from this node is also reported. If an element spans multiple surfaces, -1 is returned for thickness and offset.

    4 - The thickness of each element node is returned. For elements that do not span surfaces but have nodes on shared/non-manifold edges or shared vertices, the reported values should all come from the same “common surface” of the element. For elements that do span surfaces, values for nodes on an edge/vertex between the shared surfaces, the ambiguous_values argument is used. For surfaces that do not have thickness, -1 is returned for the thickness and offset of any nodes associated with that surface.

  • ambiguous_values (unsigned int) –

    Defines what to do when an element that spans multiple surfaces and a node of that element is on an edge/vertex between the shared surfaces. This option is only used for element_method=4 when a common surface or a most common surface cannot be determined. Surfaces that do not have a thickness are ignored and not considered in the calculations. If all surfaces have no thickness, -1 is returned for all nodes. Valid values are:

    1 - Report the average value at nodes from spanned surfaces.

    2 - Report the minimum value at nodes from spanned surfaces.

    3 - Report the maximum of value at nodes from spanned surfaces.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResultList - Result list object containing HmQueryResult objects with the following output data:

    • node (Entity) - The associated node - Entity Type: Node

    • surface (Entity) - The associated surface - Entity Type: Surface

    • thickness (double) - Thickness of the surface at the node or point location (-1 if not defined)/Thickness at the element centroid if entity is of element type

    • offset (double) - Thickness offset. If entity is of element type then is the offset at element centroid

If collection contains elements and the element_method is set 0, 1, 2, or 3:

  • HmQueryResultList - Result list object containing HmQueryResult objects with the following output data:

    • element (Entity) - The associated element - Entity Type: Element

    • surface (Entity) - The associated surface - Entity Type: Surface

    • thickness (double) - Thickness of the surface at the node or point location (-1 if not defined)/Thickness at the element centroid if entity is of element type.

    • offset (double) - Thickness offset. If entity is of element type then is the offset at element centroid.

If collection contains elements and the element_method is set 4:

  • HmQueryResultList - Result list object containing HmQueryResult objects with the following output data:

    • element (Entity) - The associated element - Entity Type: Element

    • node_info (HmQueryResultList) - Result list object containing HmQueryResult objects with the following output data:

      • node (Entity) - The associated node - Entity Type: Node

      • thickness (double) - Thickness of the surface at the node or point location (-1 if not defined)/Thickness at the element centroid if entity is of element type.

      • offset (double) - Thickness offset. If entity is of element type then is the offset at element centroid.

Examples#

Retrieve the list of surfaces, thicknesses, and offsets for node with ID 100 that is located on a shared edge between surfaces ID 10 and 11.#
import hm
import hm.entities as ent

model = hm.Model()

nodes = hm.CollectionByDisplayed(model, ent.Node)

_, resultlist = model.hm_getsurfacethicknessvalues_bycollection(
    collection=nodes,
    element_method=0
)

for result in resultlist:
    print("Node Thickness:", result.thickness)
    print("Surface:", result.surface.id)
    print("Thickness offset:", result.offset)
Retrieve the thickness data for displayed elements on a midsurface using element method 4#
import hm
import hm.entities as ent

model = hm.Model()

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

_, resultlist = model.hm_getsurfacethicknessvalues_bycollection(
    collection=elems,
    element_method=4,
    ambiguous_values=1
)

for result in resultlist:
    print(f"Element ID: {result.element.id}")
    for node_info in result.node_info:
        print(f"Node ID: {node_info.node.id}, Thickness: {node_info.thickness}, Offset: {node_info.offset}")