Model.ME_ModuleOccurrenceReparent#

Model.ME_ModuleOccurrenceReparent(child_part_entity, parent_part_entity, options)#

Move a module part or part assembly underneath another part assembly in the model hierarchy. This is only allowed in cases where it does not break sub-assembly instancing.

Parameters:
  • child_part_entity (Entity) – The object describing the part entity to move. The module must be an occurrence.

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

  • options (hwString) –

    List of input options, passed as a comma separated string enclosed in quotes. Valid options are:

    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#

Reparente the part module with ID 100 under part assembly with ID 8 in the hierarchy, keep the absolute matrix#
import hm
import hm.entities as ent

model = hm.Model()

model.ME_ModuleOccurrenceReparent(
    child_part_entity=ent.Part(model, 100),
    parent_part_entity=ent.Part(model, 8),
    options="matrix_mode=1",
)