Model.updatestackedentities#

Model.updatestackedentities(id, entitylist, method='', index=0, reorderinputbyindex=False)#

Updates the hierarchy of composite entities. It can be used to stack plies under sequences and laminates, sequences under laminates and sublaminates under interface laminates. It can also be used to unstack any child entities.

Parameters:
  • id (Entity) – The object describing the single parent entity or target stack entity. If method argument is present, this is the parent entity. Otherwise, this is a target from which the appropriate parent will be determined.

  • entitylist (hwEntityListList) – List of child entities to be stacked or unstacked. Plies and sequences are accepted are valid entity types.

  • method (hwString) –

    Specifies method in which entitylist children should be stacked. If method argument is present, the id argument above specify the parent stack entity. Otherwise, the id argument specify a target stack entity, where the function will internally determine the appropriate parent (for example, if target is stacked ply, the parent laminate will be used as parent).

    • replace - Current children of parent will be unstacked and replaced by incoming children in entitylist.

    • insert - Incoming children in entitylist will be stacked at the specified index of the current stack.

    • append - Incoming children in entitylist will be appended to the current stack.

    • remove - Incoming children in entitylist will be removed, if present, from the current stack.

  • index (unsigned int) – The index of the stack parent incoming children in entitylist will be stacked if method=insert. 0 specifies the top of the stack.

  • reorderinputbyindex (bool) – If true, reorders incoming children in entitylist such that they are ordered in the same way as displayed in the current browser. Otherwise, children are stacked in exactly the order specified in entitylist. Default is false.

Examples#

Append plies with IDs 5 , 6 , 7 , 8 into parent laminate with ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies to append
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([5, 6, 7, 8])),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1), entitylist=ply_entitylist_list, method="append"
)

# Ply ids in laminate 1 before stacking: 1 2 3 4
# Ply ids in laminate 1 after stacking: 1 2 3 4 5 6 7
Insert plies with IDs 5 , 6 , 7 , 8 into parent laminate with ID 1 at index 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies to insert
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([5, 6, 7, 8])),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1),
    entitylist=ply_entitylist_list,
    method="insert",
    index=1,
)

# Ply ids in laminate 1 before stacking: 1 2 3 4
# Ply ids in laminate 1 after stacking: 1 5 6 7 8 2 3 4
Stack plies with IDs 5 , 6 , 7 , 8 at ply target with ID 2#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies to stack
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([5, 6, 7, 8])),
    ]
)

model.updatestackedentities(
    id=ent.Ply(model, 2),
    entitylist=ply_entitylist_list,
)

# Ply ids in laminate 1 before stacking: 1 2 3 4
#P ly ids in laminate 1 after stacking: 1 2 5 6 7 8 3 4
Unstacke all plies from laminate ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains all the plies
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1),
    entitylist=ply_entitylist_list,
    method="replace",
)

# Ply ids in laminate 1 before stacking: 1 2 3 4 5 6 7 8
# Ply ids in laminate 1 after stacking: {}
Unstacke plies with Ids 1 , 3 , 6 , 7 from laminate with ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies to unstack
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([1, 3, 6, 7])),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1),
    entitylist=ply_entitylist_list,
    method="remove",
)

# Ply ids in laminate 1 before stacking: 1 2 3 4 5 6 7 8
# Ply ids in laminate 1 after stacking: 2 4 5 8
Stack combination of plies with IDs 5 , 6 , 7 , 8 and sequences with IDs 6 , 7 in laminate parent with ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies and the sequences to append
entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Sequence.fulltype, hm.hwUIntList([6])),
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([5, 6, 7, 8])),
        hm.EntityList(ent.Sequence.fulltype, hm.hwUIntList([7])),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1),
    entitylist=entitylist_list,
    method="append",
)
Stack plies with IDs 9 , 10 in sequence with ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the plies to stack
ply_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Ply.fulltype, hm.hwUIntList([9, 10])),
    ]
)

model.updatestackedentities(
    id=ent.Sequence(model, 1),
    entitylist=ply_entitylist_list,
)
Stack sublaminates with IDs 2 , 3 in interface laminate with ID 1#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the Entitylist_list that contains the sublaminates to stack
laminate_entitylist_list = hm.hwEntityListList(
    [
        hm.EntityList(ent.Laminate.fulltype, hm.hwUIntList([2, 3])),
    ]
)

model.updatestackedentities(
    id=ent.Laminate(model, 1),
    entitylist=laminate_entitylist_list,
)