Model.ME_ModuleOccurrenceConvert#

Model.ME_ModuleOccurrenceConvert(part_entity, type, reserved)#

Converts a module from part to part assembly and vice-versa, assuming it’s allowed from the current hierarchy status and entity containment rules. To check if the conversion is allowed, use hm_me_moduleoccurrenceconvert_isallowed.

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

  • type (hwString) –

    part - Converts the module to a part. That means it will become a leaf in module hierarchy and cannot contain other parts or part assemblies, only other entity types. A module explicitly created as part assembly cannot be converted to part.

    assembly - Converts the module to a part assembly. That means it will be able to hold other parts and part assemblies, as well as other entity types based on entity containment rules.

  • reserved (hwString) – Reserved for future use. Must be set as “”.

Example#

Convert module with ID 168 from a part assembly to a part#
import hm
import hm.entities as ent

model = hm.Model()

model.ME_ModuleOccurrenceConvert(
    part_entity=ent.Part(model, 168), type="part", reserved=""
)