# 2.7 Naming and Selection of Elements

Attaching properties to elements, querrying element results or controlling partial model visibility via the ModelView-component depends on element identifiers (Ids). A nifty naming scheme makes it easier to manage complex models by grouping elements into logical parts and hierarchies.

## Definition of Element Names

Element names are assigned during creation using the **Create Linear Element** or **Create Surface Element** components. They can later be modified with the **ModifyElement** component.

Valid names must start with a letter and may include letters, numbers, or underscores (`_`). Pure numeric names are not allowed because each element already has a default name based on its index in the model. Another default name is the empty string `""`, which means that using `""` as a selection string will select all elements in the model.

<figure><img src="https://2671626451-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6rkhS8IteqWJRfUuJlL5%2Fuploads%2F22OfT5Hiwr8toni0hVXP%2Fhierarchicalelementselection.png?alt=media&#x26;token=bd8fc249-aeb4-4a6f-a095-1f0d47c12ec4" alt=""><figcaption><p>Fig 2.7.1: Hierarchical naming scheme for elements.</p></figcaption></figure>

Elements can have multiple names (e.g., their index plus user-defined names). To assign multiple names, separate them with vertical bars:\
`name1|name2|name3`\
This attaches the names `name1`, `name2`, and `name3` to the element.

{% hint style="info" %}
Since element names needn't be unique multiple names on an elements may be used to categorize the latter: e.g. according to length ranges, cross section properties, joint-conditions,...\
These categories can then be conveniently visualized using a ModelView-component's "View"-input (see section [3.6.1-modelview](https://manual.karamba3d.com/3-in-depth-component-reference/3.6-results/3.7.1-general-results/3.6.1-modelview "mention")).
{% endhint %}

A hierarchical naming scheme can be created using dot notation:\
`Level1.Level2.Level3`\
Such an element can be selected using `Level1`, `Level1.Level2`, or `Level1.Level2.Level3`. This is equivalent to the shorthand:\
`Level1|Level1.Level2|Level1.Level2.Level3`.

Figure 2.7.1 shows a model with four beam elements where hierarchical naming was used to apply beam loads to different parts of the model.

## Selection of Elements via Names

When attaching loads, assigning cross sections, or controlling model visibility in Karamba3D, elements are typically referenced by their **name**. In some cases, you can also provide the element object directly, in which case its **GUID** is used during the model assembly process.

Element naming is case sensitive in Karamba3D.

**Element naming is case-sensitive** in Karamba3D. Each element has two default names:

* An empty string
* Its element index (which can be visualized in the *ModelView* component).\
  Element indexes correspond to the order in which elements were fed into the *AssembleModel* component.

You can reference elements by their IDs in three ways:

1. **Direct name**: Supply the full element name.
2. **Wildcard selection**: Use `*` or `&` in the selection string. For example, `abc*` selects all elements whose name starts with `abc` followed by any characters.
3. **Regular expressions**: Start with `&` and follow C# regex rules. For example, `&^abc\d{3}$` matches names starting with `abc` followed by exactly three digits.\
   If you’re new to regex, large language models can help you compose them.

For **shell and membrane elements**, the term “element” refers to patches of finite surface elements. Their internal order corresponds to the mesh face order of the original mesh. To reference a single finite element for display, append `/` and the index to the element name (e.g., `abc/0` refers to the first finite element within structure element `abc`).\
See the example file *OptiCroSec\_Shell\_Large.gh* for details.

{% file src="<https://2671626451-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6rkhS8IteqWJRfUuJlL5%2Fuploads%2Fy66VDrmyUk0wZ5YL0T9B%2FElement_IDs_Levels.gh?alt=media&token=38edfa2f-09dc-4cab-8a7d-6e8fe75a7d4c>" %}

{% file src="<https://2671626451-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6rkhS8IteqWJRfUuJlL5%2Fuploads%2Fqw3ZUV9fh2ujUWN2mU4j%2FOptiCroSec_Shell_Large.gh?alt=media&token=a265abab-c567-4c00-83cf-5e56571447d3>" %}
