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.

Fig 2.7.1: Hierarchical naming scheme for elements.

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.

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.

Last updated