Model.ME_ModuleOccurrenceClone#

Model.ME_ModuleOccurrenceClone(part_entity, copy_contents=1, matrix=hwMatrix44(1.0), name='')#

Create a module as a copy of another. Module contents are copied unless specified otherwise.

Parameters:
  • part_entity (Entity) – The object describing the part entity to clone.

  • copy_contents (int) –

    0 - Do not copy contents.

    1 - Default. Copy contents.

  • matrix (hwMatrix44) – A list of 16 doubles that describe the 4x4 relative transformation matrix.

  • name (hwString) – The name of the new module. If not specified, the new module will get a default name <original name>.i.<number of instances of the same prototype&gt>.

Examples#

Create a copy of module with ID 3 with a default name and without copy the contents#
import hm
import hm.entities as ent

model = hm.Model()

model.ME_ModuleOccurrenceClone(part_entity=ent.Part(model, 3), copy_contents=0)
Create a copy of module with ID 3 named “MyClone” copy all contents, and specify a unit transformation matrix#
import hm
import hm.entities as ent

model = hm.Model()

model.ME_ModuleOccurrenceClone(
    part_entity=ent.Part(model, 3),
    copy_contents=1,
    matrix=hm.hwMatrix44(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
    name="MyClone",
)