Model.interactiveremeshelems#

Model.interactiveremeshelems(collection, elementsize, elem_type, elem_type2, size_control, skew_control, break_connect, angle)#

Brings all the marked elements into the automeshing module and prepares it for processing, enabling the use of all the restricted module functions. All elements previously attached to this collection are deleted. The Model.ameshclearsurface() function should always be used at the end of the sequence of meshing functions in order to free the memory.

Parameters:
  • collection (Collection) – The collection containing the element entities to be meshed.

  • elementsize (double) – The default element edge size to use for calculating element densities along the edges (where necessary).

  • elem_type (int) –

    Flag indicating the elements generated for mapped meshing algorithms. Valid values are:

    0 - trias

    1 - quads

    2 - mixed

    3 - right trias

    4 - quads only

  • elem_type2 (int) –

    Flag indicating the elements generated for free meshing algorithms. Valid values are:

    0 - trias

    1 - quads

    2 - mixed

    3 - right trias

    4 - quads only

  • size_control (int) –

    Determines if uniform size elements in mapping algorithms should be created. Valid values are:

    0 - No

    1 - Yes

  • skew_control (int) –

    Determines if optimal shape elements in mapping algorithms should be created. Valid values are:

    0 - No

    1 - Yes

  • break_connect (int) –

    Determines if connectivity will be broken along shared edges between elements when a different element size is chosen. Valid values are:

    0 - No

    1 - Yes

    Element size along shared edges can not be changed.

  • angle (double) – Determines angle between two edge segments when vertex is created.

Example#

In this example, the automeshing module processes two separate groups with four and six elements each (each group forms a quad with four edges). To generate a mesh for each group, the automeshing module sets up values for the element densities and biasing with the Model.set_meshedgeparams() function. Automeshing parameters for each group are specified with the Model.set_meshfaceparams() function. Prior to meshing, parameters for the first group were changed. This required additional setedgeparams calls for four edges. Each group of elements is sent to the Model.automesh() function so it can determine the appropriate meshing algorithm and create an all-quads mesh. Two meshes are then saved to the HyperMesh database. The Model.ameshclearsurface() function clears from the memory any information regarding the current surface so that a new surface can be processed.#
import hm
import hm.entities as ent

model = hm.Model()

model.surfacemode(mode=1)

input_elements = hm.Collection(
    model, ent.Element, [11, 12, 19, 20, 79, 80, 82, 84, 86, 90]
)
model.interactiveremeshelems(
    collection=input_elements,
    elementsize=10.0,
    elem_type=1,
    elem_type2=1,
    size_control=1,
    skew_control=1,
    break_connect=0,
    angle=30.0,
)
# Automeshing for face 0
model.set_meshedgeparams(
    edge_index=0,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=1,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=2,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=3,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=4,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=5,
    elem_density=3,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=6,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=7,
    elem_density=3,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=0,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=1,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=2,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=3,
    elem_density=3,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)

model.set_meshfaceparams(
    face_index=0,
    shape_type=1,
    elem_type=1,
    alg_type=0,
    elem_size=0,
    smooth_method=0,
    smooth_tol=0.1,
    size_control=0,
    skew_control=0,
)
model.automesh(face_index=0, algorithm=5, elem_type=0)
# Automeshing for face 1
model.set_meshedgeparams(
    edge_index=4,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=5,
    elem_density=3,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=6,
    elem_density=2,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshedgeparams(
    edge_index=7,
    elem_density=3,
    alg_type=0,
    bias_style=0,
    bias=0.0,
    min_size=0.0,
    max_size=0.0,
    chordal_dev=0.0,
    max_angle=0.0,
)
model.set_meshfaceparams(
    face_index=1,
    shape_type=1,
    elem_type=1,
    alg_type=0,
    elem_size=0,
    smooth_method=0,
    smooth_tol=0.1,
    size_control=0,
    skew_control=0,
)
model.automesh(face_index=1, algorithm=2, elem_type=1)
model.storemeshtodatabase(elemstosurfcomp=0)
model.ameshclearsurface()