Model.swapcards#

Model.swapcards(collection, target_card_image=s_defaultString)#

Swaps the card image of an entity. This function is used to swap the of selected contact entities specific to the supported solver profile and retain main and secondary entities.

Note

  • In OptiStruct, it is used to swap groups CONTACT and TIE.

  • In NASTRAN it is used to swap groups BCTSET and BGSET.

Parameters:
  • collection (Collection) – The collection containing the entities to update. Valid entity types are group.

  • target_card_image (hwString) – The target card image to which the entities need to be swapped. If not specified, a default mapping is done.

Example#

Swap contacts with IDs 1 and 2#
import hm
import hm.entities as ent

model = hm.Model()

model.swapcards(collection=hm.Collection(model, ent.Group, [1, 2]))