Model.modent_registerconstraintruleoptions#

Model.modent_registerconstraintruleoptions(modular_entity_type, modular_entity_action, independent_entity_type, dependent_entity_type, add_behavior_for_dependent_entity_type, add_behavior_for_shared_dependent_entity_type)#

Registers a list of options that control the behavior of add/move/remove operations for a modular entity. Valid entity combinations are:

Independent Entity Types

Dependent Entity Types

beamsectcols

beamsects

components

elements

components

materials

components

nodes

components

properties

loadcols

loads

materials

curves

properties

materials

systcols

systems

vectorcols

vectors

Parameters:
  • modular_entity_type (EntityFullType) – The type of modular entity. Valid entity types are subsystems.

  • modular_entity_action (int) –

    The type of modular entity action:

    1 - Reset to defaults.

    2 - Add/move/remove.

  • independent_entity_type (EntityFullType) – The type of independent entities to add/move/remove to/from modular entities.

  • dependent_entity_type (EntityFullType) – The type of dependent entities to add/move/remove to/from modular entities.

  • add_behavior_for_dependent_entity_type (int) –

    0 - Do not add/move/remove to modular entities.

    1 - Add/move/remove to modular entities.

  • add_behavior_for_shared_dependent_entity_type (int) –

    0 - Do not add/move/remove independent entities to modular entities if they have any dependent entities shared with other modular entities.

    1 - Do not add/move/remove dependent entities to modular entities if they are shared with other modular entities.

    2 - Add/move/remove dependent to modular entities if they are shared with other modular entities.

Examples#

When adding/moving/removing components to subsystems, add/move/remove properties and shared properties#
import hm
import hm.entities as ent

model = hm.Model()

model.modent_registerconstraintruleoptions(
    modular_entity_type=ent.Subsystem,
    modular_entity_action=2,
    independent_entity_type=ent.Component,
    dependent_entity_type=ent.Property,
    add_behavior_for_dependent_entity_type=1,
    add_behavior_for_shared_dependent_entity_type=2,
)
When adding/moving/removing components to subsystems, add/move/remove nodes, but prevent the action if there are any nodes shared with other subsystems#
import hm
import hm.entities as ent

model = hm.Model()

model.modent_registerconstraintruleoptions(
    modular_entity_type=ent.Subsystem,
    modular_entity_action=2,
    independent_entity_type=ent.Component,
    dependent_entity_type=ent.Node,
    add_behavior_for_dependent_entity_type=1,
    add_behavior_for_shared_dependent_entity_type=0,
)