Model.decimate_mesh#

Model.decimate_mesh(comps_collection, nodes_collection, failed_comps_collection, size_or_factor, feature_angle, options)#

Performs mesh decimation on selected components. The decimation is performed either based on the element size, or based on a decimation factor.

Parameters:
  • comps_collection (Collection) – The collection containing the input component entities. These components must also include any 1D multi-leg rigid elements that will be processed by the update_rigids option.

  • nodes_collection (Collection) – The collection containing the any node entities to be treated as sacred/fixed. These nodes must belong to the initial mesh.

  • failed_comps_collection (Collection) – The collection containing any failed component entities after the mesh decimation process.

  • size_or_factor (double) – If Bit10 is set to 0 in the options flag, this is the element size to use for decimation. This must be larger than the initial mesh size. The coefficient for the decimation is found by dividing the average triangle’s area for the input mesh to the equilateral tria’s area for the output size.If Bit10 is set to 1 in the options flag, this is the decimation factor.

  • feature_angle (double) – This specifies the maximum angle between the normals of two connected elements. This value is ignored for shell elements. For 3D elements, the appropriate free faces of shell elements are created and meshed with the given feature angle. This value is also used to construct the connected edges for the failed components. Then these components are decimated in a second attempt. If this value is less than 1.0, the default value of 85.0 degrees is used.

  • options (int) –

    Flags that specify various additional options/behaviors.

    Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2 + 8*Bit3 + 16*Bit4 + 1024*Bit10). Valid Bit values are:

    Bit0

    1D handling before coarsening. Valid values are:

    0 - Do not utilize this option.

    1 - All selected 1D element paths not sharing sacred nodes must be deleted before mesh coarsening. 1D elements paths comprising sacred nodes are preserved. Unselected 1D elements are ignored. Preserved 1D elements which are not free should be attached to the shell mesh after coarsening.

    Bit1

    1D free element handling after coarsening. Valid values are:

    0 - Do not utilize this option.

    1 - Selected 1D elements that appear free (are not attached to the shell or solid mesh) after mesh coarsening must be deleted after meshing. 1D elements sharing sacred nodes must be preserved.

    Bit2

    1D element free leg handling after coarsening. Valid values are:

    0 - Do not utilize this option.

    1 - Selected 1D multi-leg elements having free legs after mesh coarsening (are not attached to shell or solid mesh) must be updated by deleting the free legs.

    Bit3

    1D elements convert to plot elements. Valid values are:

    0 - Do not utilize this option.

    1 - Selected 1D elements remaining after meshing should be converted to plot elements after coarsening.

    Bit4

    2D elements convert to plot elements. Valid values are:

    0 - Do not utilize this option.

    1 - Selected 2D elements should be converted to plot elements after coarsening. This flag is utilized only for the OptiStruct user profile.

    Bit10

    Element size versus decimation factor. Valid values are:

    0 - Perform decimation based on element size.

    1 - Perform decimation based on a decimation factor.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    1D handling before coarsening (Bit0)
    1D free element handling after coarsening (Bit1)
    1D element free leg handling after coarsening (Bit2)
    1D elements convert to plot elements (Bit3)
    2D elements convert to plot elements (Bit4)
    Element size versus decimation factor (Bit10)
    Calculated argument value: 0

Examples#

Create a decimated mesh with element size 30 using all components. Keep node IDs 16 and 27 as anchor nodes. If the model has rigidlink/RBE3, delete any free legs in the input components. Before coarsing also handling the 1D elements.#
import hm
import hm.entities as ent

model = hm.Model()
"""
Creating collections for:
  1. Input components
  2. Anchor/Sacred nodes
  3. Failed components
"""

comp_col = hm.Collection(model, ent.Component)
node_col = hm.Collection(model, ent.Node, [16, 27])
failed_col = hm.Collection(model, ent.Component, populate=False)

# Decimating process {Bit0, Bit2}=1
model.decimate_mesh(
    comps_collection=comp_col,
    nodes_collection=node_col,
    failed_comps_collection=failed_col,
    size_or_factor=30.0,
    feature_angle=45.0,
    options=5,
)
Create a decimated mesh of all displayed components with deformation factor of 0.5 . Before coarse also handle the 1D elements .#
import hm
import hm.entities as ent

model = hm.Model()
"""
Creating collections for:
  1. Input components
  2. Failed components
"""

comp_col = hm.CollectionByDisplayed(model, ent.Component)
node_col = hm.Collection(model, ent.Node, populate=False)
failed_col = hm.Collection(model, ent.Component, populate=False)

# Decimating process {Bit0, Bit2}=1
model.decimate_mesh(
    comps_collection=comp_col,
    nodes_collection=node_col,
    failed_comps_collection=failed_col,
    size_or_factor=0.5,
    feature_angle=45.0,
    options=1025,
)