mbdlyb_ui.functional.helpers ============================ .. py:module:: mbdlyb_ui.functional.helpers .. autoapi-nested-parse:: Copyright (c) 2023 - 2026 TNO-ESI All rights reserved. Classes ------- .. autoapisummary:: mbdlyb_ui.functional.helpers.AffectsRelation mbdlyb_ui.functional.helpers.FunctionalRelation mbdlyb_ui.functional.helpers.IndicatesRelation mbdlyb_ui.functional.helpers.ObservesRelation mbdlyb_ui.functional.helpers.RealizesRelation mbdlyb_ui.functional.helpers.RequiredForRelation mbdlyb_ui.functional.helpers.State mbdlyb_ui.functional.helpers.StateTable mbdlyb_ui.functional.helpers.SubfunctionOfRelation mbdlyb_ui.functional.helpers.TestsRelation Functions --------- .. autoapisummary:: mbdlyb_ui.functional.helpers.build_tree mbdlyb_ui.functional.helpers.save_new_object mbdlyb_ui.functional.helpers.state_table Module Contents --------------- .. py:class:: AffectsRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable affects relation. .. py:class:: FunctionalRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`mbdlyb_ui.helpers.Relation` Represent an editable functional relation. .. py:method:: get_props() -> dict Return the relation properties needed for persistence. :returns: Properties to persist on the relation. .. py:attribute:: weight :type: float .. py:class:: IndicatesRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable indicates relation. .. py:class:: ObservesRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable observes relation. .. py:class:: RealizesRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable realizes relation. .. py:class:: RequiredForRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0, operating_modes: Optional[list[str]] = None) Bases: :py:obj:`FunctionalRelation` Represent an editable required for relation. .. py:method:: get_props() -> dict Return the relation properties needed for persistence. :returns: Properties to persist on the relation. .. py:attribute:: operating_modes :type: list[str] .. py:class:: State(name: str) Represent a named functional node state. .. py:attribute:: name .. py:class:: StateTable(states: list[State]) Manage editable functional node states. .. py:method:: add_state() Append a uniquely named state and refresh the state editor. .. py:method:: drop_state(state: State) Remove a state and refresh the state editor. :param state: State entry to remove. .. py:method:: from_list(l: list[str]) -> StateTable :classmethod: Create editable state entries from stored names. :param l: Stored state or operating mode names to turn into entries. :returns: Editable collection initialized from the stored values. .. py:method:: to_list() -> list[str] Extract state names from the editable entries. :returns: Stored values represented by the editable entries. .. py:attribute:: states :type: list[State] .. py:class:: SubfunctionOfRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable subfunction of relation. .. py:class:: TestsRelation(start_node: Optional[mbdlyb.gdb.GMBDElement] = None, end_node: Optional[mbdlyb.gdb.GMBDElement] = None, start_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, end_node_type: Optional[type[mbdlyb.gdb.GMBDElement]] = None, weight: float = 1.0) Bases: :py:obj:`FunctionalRelation` Represent an editable tests relation. .. py:function:: build_tree(node: mbdlyb.functional.gdb.GFunctionalNode | mbdlyb.functional.gdb.GCluster) -> dict Build a nested tree entry with node identity and CPT metadata. :param node: Node whose identity, CPT status, and children are serialized. :returns: Nested tree entry describing the node and its children. .. py:function:: save_new_object(obj: mbdlyb.gdb.GMBDElement, net: mbdlyb.functional.gdb.GCluster, disable_redirect: bool = False) Save a functional element and optionally navigate to its cluster. :param obj: Functional element to add to the cluster. :param net: Cluster containing the new model object. :param disable_redirect: Whether to suppress navigation after saving. .. py:function:: state_table(state_table: StateTable, default_states: list[str]) Render editable state names and controls for adding or removing states. :param state_table: Editable collection of states. :param default_states: Fallback state names shown when no custom states are set.