ansys.dyna.core.lib.field_schema.FieldSchema#
- class ansys.dyna.core.lib.field_schema.FieldSchema#
Bases:
NamedTupleImmutable schema for a single field in a Card.
This is designed to be shared across all instances of a Card type. The default can be a value or a Flag instance for flag fields.
- Attributes:
- name
str The lookup key used for get_value/set_value and kwargs matching. This should be the Python property name (e.g., “w_mode”).
- type
Type The field type (int, float, str, bool).
- offset
int Column position in the card.
- width
int Column width.
- default
Any Default value, or a Flag instance for flag fields.
- display_name
str,optional The original field name for display in comments (e.g., “w-mode”). If not provided, uses name.
- name
- type: Type#
- default: Any = None#
- to_field(value: Any = None) ansys.dyna.core.lib.field.Field#
Create a Field instance from this schema with the given value.
- Parameters:
- value
Any,optional The value to set. If None, uses the default.
- value
- Returns:
FieldA new Field instance.
- classmethod from_field(field: ansys.dyna.core.lib.field.Field) FieldSchema#
Create a FieldSchema from an existing Field.
- Parameters:
- field
Field The field to extract schema from.
- field
- Returns:
FieldSchemaAn immutable schema representation.