Model.imprint_elements#

Model.imprint_elements(collection_target, collection_source, options)#

Imprints, connects and optionally remeshes source 1D/2D elements onto target 2D elements.

Parameters:
  • collection_target (Collection) – The collection containing the target (destination) entities to imprint onto. Valid entities are components and elements.

  • collection_source (Collection) – The collection containing the entities.

  • options (hwString) –

    Additional strings defining extended parameters/options. Options are defined in "name value(s)" format. Valid options are:

    • projection_vector

    The 3 doubles defining the vector direction. If not defined, normal projection is used.

    • remain

    1 - Source remains, source node coordinates are kept (default if not provided).

    2 - Destination remains, node coordinates projected to destination are used.

    3 - Both remain, source entities are projected and a copy is imprinted to destination.

    • max_distance

    The function will exit with an error if the distance between source and destination exceeds this value. If not specified, this is ignored.

    • to_dest_component

    0 - Do not organize imprinted elements to destination component (default if not provided).

    1 - Organize imprinted elements to destination component.

    • angle

    The angle used to define feature edges on the mesh. If not defined, 25.0 is used.

    • remesh_mode

    -1 - No remesh. Element connectivity is maintained by recovery of the imprinting element edges.

    0 - Do not remesh destination. Destination mesh is stitched to maintain element connectivity.

    1 - Remesh all input destination elements.

    2 - Remesh destination elements defined by remesh_layers.

    • remesh_layers

    Must be defined if remesh_mode is 2.

    0 - Remesh only the elements attached to the border of the imprinted element image.

    > 0 - Remesh additional layers in addition to the elements attached to the imprinted element image.

    • mesh_type

    Automatically detected from input mesh if not provided. Valid values are:

    0 - tria

    1 - quad

    2 - mixed

    3 - R-tria

    4 - quad only

    • mesh_size

    Automatically detected from input mesh if not provided.

    • create_joint_elems

    Only valid when remain is 3.

    0 - Do not generate patch elements between source and destination elements (default if not provided).

    1 - Generate patch elements between source and destination elements.

Example#

Imprint elements from component named “conn_imprint” to component named “auto1”, using a normal projection, a feature angle of 30, keeping the source, and remeshing the destination using 2 layers#
import hm
import hm.entities as ent

model = hm.Model()

target_component_collection = hm.Collection(model, ent.Component, "name=auto1")
source_component_collection = hm.Collection(model, ent.Component, "name=conn_imprint")

model.imprint_elements(
    collection_target=target_component_collection,
    collection_source=source_component_collection,
    options="remain 1 remesh_mode 2 remesh_layers 2 angle 30.0",
)