Skip to content

ElementGroupNamespace

ElementGroupNamespace

ElementGroupNamespace(manager: GroupManager)

Create/retrieve cell selections through model.group.element.

Methods:

Name Description
from_cells

Construct and register a group from zero-based assembled cell indices.

from_meshparts

Select current assembled cells belonging to registered mesh parts.

add

Register a group, suffixing duplicate names and assigning a region tag.

get

Return an element group by exact registered name, or None when absent.

get_all

Return a shallow name-to-group snapshot with shared selection objects.

Methods:

from_cells

from_cells(name: str, cell_indices: ArrayLike) -> ElementGroup

Construct and register a group from zero-based assembled cell indices.

Parameters:

Name Type Description Default
name str

Preferred group label; duplicates receive numeric suffixes.

required
cell_indices ArrayLike

Nonempty one-dimensional nonnegative indices.

required

Returns:

Name Type Description
group ElementGroup

Registered group. This factory does not verify assembly existence or upper index bounds; rendering checks bounds.

from_meshparts

from_meshparts(name: str, meshparts: str | MeshPart | Sequence[str | MeshPart], *, line_cells_only: bool = False) -> ElementGroup

Select current assembled cells belonging to registered mesh parts.

Parameters:

Name Type Description Default
name str

Preferred group label.

required
meshparts str | MeshPart | Sequence

Part names/objects or a collection.

required
line_cells_only bool

Restrict matches to recognized line cell types.

False

Returns:

Name Type Description
group ElementGroup

Registered selection using current cell order.

Raises:

Type Description
ValueError

Assembly, part, required metadata, or matching cells are absent.

TypeError

A part reference has an unsupported type.

add

add(group: ElementGroup) -> ElementGroup

Register a group, suffixing duplicate names and assigning a region tag.

Parameters:

Name Type Description Default
group ElementGroup

Selection record to retain. A preassigned tag is retained; callers must not introduce region-tag conflicts.

required

Returns:

Name Type Description
group ElementGroup

Same object, possibly with a changed name.

get

get(name: str) -> Optional[ElementGroup]

Return an element group by exact registered name, or None when absent.

get_all

get_all() -> Dict[str, ElementGroup]

Return a shallow name-to-group snapshot with shared selection objects.