SectionManager
SectionManager
Local manager for Section lifecycle and tag assignment.
The manager is intentionally not a singleton. Each instance owns an
independent tag space so future model or Model instances can keep
their own section collections.
Create an empty manager with tags starting at 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_maker
|
Model
|
The owning Model instance. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If mesh_maker is not a Model instance. |
RuntimeError
|
If the Model already owns a SectionManager. |
Attributes
Methods:
add
Add an existing section and assign a tag if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section
|
Section
|
Unmanaged or already-managed |
required |
Returns:
| Type | Description |
|---|---|
Section
|
The same |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If its preassigned tag conflicts or name is duplicate. |
get
Return the section with tag or user_name if it exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
Union[int, str]
|
Section tag (int) or name (str) to look up. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Section]
|
The matching |
remove
Remove a managed section and compact the remaining tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
Union[int, str]
|
Tag or name of the section to remove. Missing sections are ignored. |
required |
set_tag_start
Set the first tag used by this manager and retag existing objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_tag
|
int
|
Positive integer for the first assigned tag. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
create_section
Create and manage a section by type name using the manager factory map.
This is the authoritative creation path for the active runtime. It ensures that the section is context-aware during its initialization so it can resolve materials and other dependencies without global state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_type
|
str
|
Registered section type name. |
required |
user_name
|
str
|
Unique name for the section. |
required |
**section_params
|
Constructor arguments for the selected concrete class. |
{}
|
Returns:
| Type | Description |
|---|---|
Section
|
Managed |
Raises:
| Type | Description |
|---|---|
KeyError
|
If |
resolve_material
Resolve a material using the manager's Model context.
register_section_type
classmethod
Register a concrete section type for manager-owned creation.
_ensure_builtin_section_types_loaded
classmethod
Load bundled section families once so manager namespaces just work.