Model.morphsaveshape#

Model.morphsaveshape(scollection, savefile, filetype)#

Reads local shapes stored in the specified file.

Parameters:
  • scollection (Collection) – The collection containing the shape entities to read.

  • savefile (hwString) – Name of file to be saved.

  • filetype (int) –

    0 - Grid IDs and perturbations

    1 - Grids, elements, and perturbations

Example#

Save the shapes selected interactively as nodes, node perturbations, and elements#
import hm
import hm.entities as ent

model = hm.Model()

model.morphsaveshape(
    scollection=hm.CollectionByInteractiveSelection(model, entity_class=ent.Shape),
    savefile="morphing.shp",
    filetype=1,
)

Note

Shapes saved as filetype =0 will be saved in the same format as OptiStruct shape variables.

Shapes saved as filetype =1 can later be read in and applied to a file with a completely different mesh with the saved shapes being applied to the nearest nodes in the new model. The saved shapes can also be read in as their original elements and perturbations (see Model.morphloadshape()).