Model.duplicateentities#

Model.duplicateentities(input_collection, output_collection, destcomponent, destloadcol, transformloads=0, reverseloads=0)#

Duplicates elements, nodes and components along with any attached loads.

Parameters:
  • input_collection (Collection) – The collection containing the entities to duplicate. Valid entities are elements, components, nodes.

  • output_collection (Collection) – The collection containing the new entities.

  • destcomponent (unsigned int) –

    Required option.

    1 - New component.

    2 - Current component.

  • destloadcol (unsigned int) –

    Valid only if transformloads=1. Required option.

    1 - New load collector.

    2 - Current load collector.

  • transformloads (int) –

    0 - Do not transform loads. (default)

    1 - Transform loads.

  • reverseloads (int) –

    Valid only if transformloads=1.

    0 - Do not reverse loads. (default)

    1 - Reverse loads.

Examples#

Duplicate the element with ID 1 and place the new element in the current component#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains the elements to duplicate
element_collection = hm.Collection(model, ent.Element, [1])

# Creating an empty collection
output = hm.Collection(model, ent.Element, populate=False)

model.duplicateentities(
    input_collection=element_collection,
    output_collection=output,
    destcomponent=2,
    destloadcol=1,
)
Duplicate all elements , place the elements in a new component , and transform the loads and place them in a new load collector#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains the elements to duplicate
element_collection = hm.Collection(model, ent.Element)

# Creating an empty collection
output = hm.Collection(model, ent.Element, populate=False)

model.duplicateentities(
    input_collection=element_collection,
    output_collection=output,
    destcomponent=1,
    destloadcol=2,
    transformloads=1,
)