See the following procedures for custom Element Creation dialog and submenu creation.

Updating the Element Creation dialog/submenu

Once you have created the new Element Creation dialog/submenu, activate it via the (2026x Refresh1) Activating Element Creation dialog.

The default name for the Element Creation dialog's invocation command is Create Element. If you create a dialog from scratch and do not set a new name for the command, the default name remains.

Creating a custom Element Creation dialog/submenu

To create a custom Element Creation dialog/submenu


  1. In the Containment tree, create a new root namespace.
  2. Open the Textual Editor for the new namespace.
  3. In the Textual Editor, create a package and name it.
  4. Within the body of the package, declare a part definition, specify the name for the dialog instance, subclassify the ElementCreationDialog definition from the DS_UIComponents::CoreUIComponents::Dialogs package, then, within the body of the definition:
    1. Manage the Element Creation dialog/submenu command categories 
    2. Manage the Element Creation dialog/submenu commands
  5. Click the Synchronize button.

package CustomElementCreationDialogs {
    part def NewCustomElementCreationDialog :> DS_UIComponents::CoreUIComponents::Dialogs::ElementCreationDialog { // naming the new dialog instance and subclassifying the ElementCreationDialog
    }
}

Managing the Element Creation dialog/submenu command categories

Creating element creation command categories for the Element Creation dialog/submenu

To create element creation command categories for the Element Creation dialog/submenu


  1. Within the body of the part definition element of the new Element Creation dialog instance, declare a part usage, name it (optional), then subset the itemCategories element.
  2. Click the Synchronize button.

package CustomElementCreationDialogs {
    part def NewCustomElementCreationDialog :> DS_UIComponents::CoreUIComponents::Dialogs::ElementCreationDialog {
        part customElementsCategory :> itemCategories { // adding a command category
        }
    }
}

Specifying the element creation command category attributes for the Element Creation dialog/submenu

To specify the element creation command category attributes for the Element Creation dialog/submenu


  1. Place the cursor within the body of the new command category's element and redefine the inherited attributes that you want to modify with the needed values.
  2. Click the Synchronize button.

package CustomElementCreationDialogs {
    part def NewCustomElementCreationDialog :> DS_UIComponents::CoreUIComponents::Dialogs::ElementCreationDialog {
        part customElementsCategory :> itemCategories {
            attribute :>> label default "Custom Elements"; // naming the element creation command category
            attribute :>> isCollapsed default true; // modified element creation command category default collapse state
        }
    }
}

Managing the Element Creation dialog/submenu commands

You can customize the Element Creation dialog/submenu content by specifying which element creation commands it should contain. The element creation commands are created by targeting one of the following:

  • predefined element metaclass. All predefined SysML v2 elements that already exist in the tool can be targeted via the OperationByMetaclass, targeting the element's metaclass. 
  • custom element template. Any custom-created element can be targeted via the OperationFromTemplate, targeting the corresponding custom-created element templates. For creating custom element templates, see the Creating element templates for custom templated element creation commands procedure.

Adding element creation commands to the Element Creation dialog/submenu command categories

To add element creation commands to the Element Creation dialog/submenu command categories


  1. Within the body of the command category's element, declare a part usage defined by DS_UIComponents::CoreUIComponents::Dialogs::DialogItem and subset abstractItems. This element instantiates the new command.
  2. For creating an element creation command for a predefined element:
    1. Within the body of the new command's instance, declare a perform action usage defined by DS_UIComponents::CoreUIComponents::Operations::OperationByMetaclass and redefine operation. In the element's body, specify the in direction based on the element you want to use for the command using a metadata access expression.
  3. For creating an element creation command for a custom element:
    1. Within the body of the new command's instance, specify the command's name by redefining the label attribute and specifying the command's name.
    2. Ensure a template for the custom element is created. See the Creating element templates for custom templated element creation commands procedure.
    3. Within the body of the new command's instance, declare a perform action usage defined by DS_UIComponents::CoreUIComponents::Operations::OperationFromTemplate and redefine operation. In the element's body, specify the in direction based on the element template you want to use for the command using a metaclassification expression.
  4. Click the Synchronize button.

package CustomElementCreationDialogs {
    part def NewCustomElementCreationDialog :> DS_UIComponents::CoreUIComponents::Dialogs::ElementCreationDialog {
        attribute :>> actionName default "Create Custom Element";
        part customElementsCategory2 :> itemCategories {
            attribute :>> isCollapsed default true;
            attribute :>> hasVisibleLabels default true;
            attribute :>> label default "SysMLv2 Elements";

            // element creation command targeting a predefined element via its metaclass:
            part : DS_UIComponents::CoreUIComponents::Dialogs::DialogItem :> abstractItems {  // new element creation command instance
                perform action : DS_UIComponents::CoreUIComponents::Operations::OperationByMetaclass :>> operation {   // specifying the element by metaclass that should be targeted upon the clicking of the new command
                    in ref = SysML::Systems::RequirementUsage.metadata; // the specified element is a predefined element, which can be targeted by its metaclass
                }
            }
        }
        part customElementsCategory1 :> itemCategories {
            attribute :>> isCollapsed default false;
            attribute :>> hasVisibleLabels default true;
            attribute :>> label default "Custom Elements";

            // element creation command targeting a custom element via its template:
            part : DS_UIComponents::CoreUIComponents::Dialogs::DialogItem :> abstractItems {  // new element creation command instance
                attribute :>> label default "software usage"; // specifying the command's name
                perform action : DS_UIComponents::CoreUIComponents::Operations::OperationFromTemplate :>> operation {  // specifying the element template that should be targeted upon the clicking of the new command
                    in ref = (softwareReqTemplate meta KerML::Package).ownedElement; // the specified template is a custom element template, see the procedure 'Creating element templates for custom templated element creation commands'
                }
            }
        }
    }
}

Creating element templates for custom templated element creation commands 

To create element templates for custom templated element creation commands 


  1. Within the body of the new dialog instance's package, do the following:
    1. Declare a metadata definition. In its body, subset annotatedElement and define it by the predefined SysML v2 element used for the customized element.
    2. Create a new package for the specific custom element template. In its body, apply the metadata definition to the predefined SysML v2 element used for the customized element and name it.
  2. Click the Synchronize button.

package CustomElementCreationDialogs {
    metadata def Software {
        :> annotatedElement : SysML::Systems::RequirementUsage;
    }
    package softwareReqTemplate { // the new template's package, which you will have to target using the OperationFromTemplate to create an element creation command for the custom element
        #Software requirement softwareRequirement;  
    }
}