Model.ME_ModuleOccurrencesReparent#

Model.ME_ModuleOccurrencesReparent(child_entity_list, parent_part_entity, options)#

Moves a list of module parts or part assemblies underneath another part assembly in the model hierarchy.

This is only allowed in cases where it does not break sub-assembly instancing.

Parameters:
  • child_entity_list (EntityList) – A list containing the part entities to move.

  • parent_part_entity (Entity) – The object describing the part entity to become the parent.

  • options (hwString) –

    The string of input options.

    matrix_mode=<mode>

    0 - Retain the relative position of the child module (default). This may cause the part to translate if there are matrices stored at different levels in the hierarchy.

    1 - Retain the absolute position of the child module.

Example#

Place the module parts with IDs 100, 101 and 102 under part assembly with ID 8 in the hierarchy. No translation should take place since the parts positions are not change relative to their parents#
import hm
import hm.entities as ent

model = hm.Model()

model.ME_ModuleOccurrencesReparent(
    child_entity_list=[
        ent.Part(model, 100),
        ent.Part(model, 101),
        ent.Part(model, 102),
    ],
    parent_part_entity=ent.Part(model, 8),
    options="matrix_mode=1",
)