Model.cleanupmodelfile#

Model.cleanupmodelfile(collection_set, x0, y0, z0, x1, y1, z1, operation)#

Cleans up model specific data after a box trim operation.

Parameters:
  • collection_set (CollectionSet) – The set of collections containing possibly multiple type of input entities. The use depends on the operation argument. Valid entities are Groups, Controlvols and Loads.

  • x0 (double) – Lower bound x-coordinate.

  • y0 (double) – Lower bound y-coordinate.

  • z0 (double) – Lower bound z-coordinate.

  • x1 (double) – Upper bound x-coordinate.

  • y1 (double) – Upper bound y-coordinate.

  • z1 (double) – Upper bound z-coordinate.

  • operation (hwString) –

    The operation to perform. Valid values are:

    deleteoutsidebox - Deletes all elements, connectors, blocks and groups outside the specified box.

    deleteemptyunused - Deletes all empty components, assemblies, sets, contactsurfs, outputblocks, groups, plies and rigidwalls, and all unused materials, properties, sets, beamsects, curves, systems, vectors, laminates, plies and tables. collection_set and x0 through z1 are ignored.

    preservesolverdata - Preserves all control cards by adding them to collection_set. x0 through z1 are ignored.

    postclean - Delete the rest of the items not on collection_set. x0 through z1 are ignored.

Example#

Cleanup model and solver data for LS-DYNA, using a box of 0, 0, 0 - 100,100,100#
import hm
import hm.entities as ent

model = hm.Model()

template_type = "lsdyna"

# Create element collection outside the box
filter = hm.FilterByBox(
    ent.Element, [0, 0, 0], [100, 100, 100], hm.RELATIVE_LOCATION_OUTSIDE, 0, False, 0.0
)
element_collection = hm.Collection(model, filter)

colset = hm.CollectionSet(model)
colset.set(element_collection)
model.cleanupmodelfile(
    collection_set=colset,
    x0=0,
    y0=0,
    z0=0,
    x1=100,
    y1=100,
    z1=100,
    operation="deleteoutsidebox",
)

model.cleanupmodelfile(
    collection_set=colset,
    x0=0,
    y0=0,
    z0=0,
    x1=0,
    y1=0,
    z1=0,
    operation="deleteemptyunused",
)

component_collection = hm.Collection(model, ent.Component)

outColSet = hm.CollectionSet(model)
model.hm_getincludeisolationentitiesmark(
    components=component_collection,
    output_collectionset=outColSet,
    isolate_special=True,
    reserved=0,
)

if template_type == "lsdyna":
    model.solverdeckcleanup(solver="LSDYNA", collection_set=outColSet)

model.cleanupmodelfile(
    collection_set=colset,
    x0=0,
    y0=0,
    z0=0,
    x1=0,
    y1=0,
    z1=0,
    operation="deleteemptyunused",
)

model.cleanupmodelfile(
    collection_set=colset,
    x0=0,
    y0=0,
    z0=0,
    x1=0,
    y1=0,
    z1=0,
    operation="postclean",
)