Model.trim_mesh_by_mesh#

Model.trim_mesh_by_mesh(collection_source, collection_target, ImprintOnMesh=2, NodeCollection=Collection(), FetchImprintedEdges=1, ImprintedEdgesComp=0, RetainMarkedNodeCluster=0, SliverRatio=0.0)#

Trims intersecting meshes using the source, target, or both.

Parameters:
  • collection_source (Collection) – The collection containing the entities (components or elements) of the source.

  • collection_target (Collection) – The collection containing the entities (componenets or elements) of the target.

  • ImprintOnMesh (int) –

    Specifies where the imprint of the intersection edges should happen:

    0 - Imprint on source entities

    1 - Imprint on target entities

    2 - Imprint on both source and target entities (default)

  • NodeCollection (Collection) – The collection containing the entities to delete or retain (deleting other clusters). If the imprint happens on the source, the marked nodes should belong to the source collection. If the imprint happens on the target, the marked nodes should be on the target collection. If the imprint happens on both the source and target, the marked nodes can be on the source collection or the target collection.

  • FetchImprintedEdges (int) –

    Enables 1D element creation for the intersected edges:

    0 - Disabled

    1 - Enabled, see ImprintedEdgesComp. (default)

  • ImprintedEdgesComp (int) – If FetchImprintedEdges=1 this specifies the component ID to organize the 1D elements. If not specified, a default component named ^intersected_edges is used.

  • RetainMarkedNodeCluster (int) –

    When NodeCollection has valid nodes specified, this option determines if the cluster attached to the marked nodes, bounded by the imprint edges, is to be retained or deleted:

    0 - Delete

    1 - Retain (default)

  • SliverRatio (double) – Reserved for future development.

Example#

Trim elements of part A , with elements of part B . The imprint of the intersction edges will happen on the source elements. 1D elements will be created for the intersected edges and these elements will be part of the component with ID 4.#
import hm
import hm.entities as ent

model = hm.Model()


# Creating a collection that contains all the elements of the part 'A'
filter_source = hm.FilterByCollection(ent.Element, ent.Part)
parts_source = hm.Collection(model, ent.Part, ['A'])
elements_source = hm.Collection(model, filter_source, parts_source)

# Creating a collection that contains all the elements of the part 'B'
filter_target = hm.FilterByCollection(ent.Element, ent.Part)
parts_target = hm.Collection(model, ent.Part, ['B'])
elements_target = hm.Collection(model, filter_target, parts_target)

model.trim_mesh_by_mesh(
    collection_source=elements_source,
    collection_target=elements_target,
    ImprintOnMesh=0,
    FetchImprintedEdges=1,
    ImprintedEdgesComp=4,
)