Model.normalsadjust2#

Model.normalsadjust2(collection, mode, orientation_element, size, display, vector, feature_angle)#

Adjusts the normals of 2D and 3D elements.

Parameters:
  • collection (Collection) –

    The collection containing the entities to adjust the normals for. Valid entities are elements, surfaces and components.

    If surfaces or components are selected, adjustment will be applied for all elements belonging to selected surfaces and components. This option is relevant for FE surfaces only.

  • mode (int) –

    The orientation mode. For elements belonging to FE-surfaces, though, each connected section is limited by surface borders and ‘dominant normal direction’ is calculated for each FE-surface separately.

    0 - For each connected section, adjust the normals for all elements in that section to be consistent with the ‘dominant normal direction’ already existing within that section. orientation_element and vector are ignored and can be None.

    1 - For each connected section, the entity in the section with its normal ‘most parallel’ to the orientation_element is found. All other elements in the section are adjusted to be consistent with this element. orientation_element and vector are ignored and can be None.

    2 - Selected elements that are associated to surfaces are adjusted to match the normal of their surfaces. This is a no-op, but not an error, for elements not associated to a surface. orientation_element and vector are ignored and can be None.

    3 - For each connected section, the elements in the section are adjusted to be consistent with the specified vector direction. vector must be a valid selection and orientation_element is ignored and can be None.

    4 - For each connected section, adjust the normals for all elements in that section to be consistent with the ‘dominant normal direction’ already existing within that section, with the sections defined based on the specified feature_angle. orientation_element and vector are ignored and can be None.

  • orientation_element (Entity) – The object describing the orientation element entity.

  • size (double) – This argument is deprecated and should be always set to zero.

  • display (int) – This argument is deprecated and should be always set to zero.

  • vector (hwTriple) – The hwTriple object defining the vector components. Valid only when mode=3. User can also supply a Python list of three doubles.

  • feature_angle (double) – If mode=4, this is the feature angle to use to define the connected sections. This is ignored and not required otherwise.

Examples#

Adjust the normals for elements with IDs 1 - 10 based on element with ID 100#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains the elements with IDs 1-10
filter_elems = hm.FilterByEnumeration(ent.Element, list(range(1, 11)))
elems_collection = hm.Collection(model, filter_elems)

model.normalsadjust2(
    collection=elems_collection,
    mode=1,
    orientation_element=ent.Element(model, 100),
    size=0,
    display=0,
    vector=None,
    feature_angle=0.0,
)
Adjustingthe normals for all surfaces with feature angle 15.0 degrees#
import hm
import hm.entities as ent

model = hm.Model()

model.normalsadjust2(
    collection=hm.Collection(model, ent.Surface),
    mode=4,
    orientation_element=None,
    size=0.0,
    display=0,
    vector=None,
    feature_angle=15.0,
)