Model.morphinterpolatesurf#

Model.morphinterpolatesurf(n_collection, e_collection, sizbld, buffer, ndens, mode, plane_normal, plane_base, node_id, system_id, line_list, node_list, sym, con, covar, drift, nugget, nugval, symm, type, draw, offset, sym_plane_normal, sym_plane_base, model_shape, node1_entity, node2_entity)#

Morphs the elements on e_collection, or those of an internally generated mesh, to a surface interpolated from the nodes or lines on n_collection. The mode specifies the general shape of the interpolated surface (and internally generated mesh) and requires either a specified plane, line, node, node list, or system to orient the shape. This function may also be used to generate a surface using the interpolated surface but is limited to support only a plane as the general shape of the interpolated surface.

For a generated mesh the sizbld option can be used to specify the number of elements per side (for a rectangular mesh) or per 45 degree section (for a non-rectangular mesh), or it can be used to specify the average element size. For an existing mesh (e_collection) sizbld is the blend factor % which allows you to blend the difference between the shape of the existing mesh and the shape of the interpolated surface. A higher blend factor means that the mesh will match closer to the interpolated surface.

Covariance, drift, nugget, and nugget value are parameters sent to the Kriging algorithm which calculates the interpolated surface. Good default values are “h” for covariance, “linear” for drift, and “off” for the nugget.

Parameters:
  • n_collection (Collection) – The collection containing the entities. Valid entities are node and lines.

  • e_collection (Collection) – The collection containing the element entities.

  • sizbld (double) –

    If the e_collection is empty:

    < 0 - Element density of generated mesh (or surface for mode 8)

    > 0 - Average element size of generated mesh

    If the e_collection contains elements: blend factor % (0.0 - 100.0)

  • buffer (double) – % increase in the size of the generated mesh before morphing to interpolated surface (0.0 - 100.0) - intended mainly for planar meshes (mode 0 and 8).

  • ndens (int) – Number of nodes created on lines for interpolated surface.

  • mode (int) –

    Shape of generated mesh and general shape of interpolated surface:

    0 - plane

    1 - cylinder

    2 - sphere

    3 - ellipse

    4 - cylinder about node list

    5 - cylinder about line

    6 - enclosed cylinder about nodelist

    7 - enclosed cylinder about line

    8 - plane - create a surface instead of a mesh

  • plane_normal (hwTriple) – The hwTriple object defining the plane normal components. User can also supply a Python list of three doubles.

  • plane_base (hwTriple) – The hwTriple object defining the base point components of the plane. User can also supply a Python list of three doubles.

  • node_id (unsigned int) – ID of center node of sphere or ellipse (mode 2 and 3).

  • system_id (unsigned int) – ID of local system for ellipse (mode=3).

  • line_list (EntityList) – The list of line entities (mode 5 and 7).

  • node_list (EntityList) – The list of node entities (mode 4, 5, 6, and 7).

  • sym (int) –

    0 - Do not use symmetry links

    1 - Use symmetry links

  • con (int) –

    0 - Do not use constraints

    1 - Use constraints

  • covar (int) –

    Covariance for Kriging algorithm:

    0 - h

    1 - h^2log(h)

    2 - h^3

    3 - exp(-1/x)

  • drift (int) –

    Drift type for Kriging algorithm:

    0 - no drift

    1 - constant

    2 - linear

    3 - quadratic

    4 - cubic

    5 - trigonometric

  • nugget (int) –

    0 - off

    1 - on

  • nugval (double) – The value of nugget for Kriging algorithm.

  • symm (int) –

    0 - No symmetric surface is created (mode=8 only)

    1 - Symmetric surface is created (mode=8 only)

  • type (int) –

    0 - Smooth surface is created (mode=8 only)

    1 - Developable surface is created (mode=8 only)

  • draw (double) – Draw depth used to position the surface below the part (mode=8 only).

  • offset (double) – Used to increase the size of the surface while maintaining tangency (mode=8 only).

  • sym_plane_normal (hwTriple) – The hwTriple object defining the plane normal components. User can also supply a Python list of three doubles.

  • sym_plane_base (hwTriple) – The hwTriple object defining the base point components of the plane. User can also supply a Python list of three doubles.

  • model_shape (int) –

    0 - The surface is created using the half model given by symplane (mode=8 only)

    1 - The surface is created using the complete model (mode=8 only)

  • node1_entity (Entity) – The node entity describing the base point of vector defining the developable direction (mode=8 only). Can be set to “None” for other modes.

  • node2_entity (Entity) – The node entity describing the end point of vector defining the developable direction (mode=8 only). Can be set to “None” for other modes.

Examples#

Morph a mesh to a surface interpolated from nodes which is roughly planar#
import hm
import hm.entities as ent

model = hm.Model()

model.morphinterpolatesurf(
    n_collection=hm.Collection(model, ent.Node, [1, 2, 3, 4, 5, 6, 7, 8]),
    e_collection=hm.Collection(model, ent.Element),
    sizbld=100.0,
    buffer=10.0,
    ndens=0,
    mode=0,
    plane_normal=[1.0, 0.0, 0.0],
    plane_base=[1.0, 0.0, 0.0],
    node_id=0,
    system_id=0,
    line_list=[ent.Line(model, 1)],
    node_list=[ent.Node(model, 1)],
    sym=1,
    con=1,
    covar=0,
    drift=2,
    nugget=0,
    nugval=0.0,
    symm=0,
    type=0,
    draw=0.0,
    offset=0.0,
    sym_plane_normal=[1.0, 0.0, 0.0],
    sym_plane_base=[1.0, 0.0, 0.0],
    model_shape=0,
    node1_entity=None,
    node2_entity=None,
)
Generate a mesh, with 10 elements per 45.0 degree spherical section, and morph it to a surface interpolated from lines which is roughly spherical and oriented with a given system with a node as the origin#
import hm
import hm.entities as ent

model = hm.Model()

model.morphinterpolatesurf(
    n_collection=hm.Collection(model, ent.Node, [1, 2, 3, 4, 5, 6, 7, 8]),
    e_collection=hm.Collection(model, ent.Element),
    sizbld=-10.0,
    buffer=10.0,
    ndens=10,
    mode=2,
    plane_normal=[1.0, 0.0, 0.0],
    plane_base=[1.0, 0.0, 0.0],
    node_id=45,
    system_id=3,
    line_list=[ent.Line(model, 1)],
    node_list=[ent.Node(model, 1)],
    sym=1,
    con=1,
    covar=0,
    drift=2,
    nugget=0,
    nugval=0.0,
    symm=0,
    type=0,
    draw=0.0,
    offset=0.0,
    sym_plane_normal=[1.0, 0.0, 0.0],
    sym_plane_base=[1.0, 0.0, 0.0],
    model_shape=0,
    node1_entity=None,
    node2_entity=None,
)