ansys.dyna.core.lib.deck#
Module provides a collection of keywords that can read and write to a keyword file.
Classes#
Provides a collection of keywords that can read and write to a keyword file. |
Module Contents#
- class ansys.dyna.core.lib.deck.Deck(title: str = None, **kwargs)[source]#
Provides a collection of keywords that can read and write to a keyword file.
- property format: ansys.dyna.core.lib.format_type.format_type[source]#
Format type of the deck.
- append(keyword: ansys.dyna.core.lib.keyword_base.KeywordBase | str, check=False) None [source]#
Add a keyword to the collection.
- property all_keywords: List[str | ansys.dyna.core.lib.keyword_base.KeywordBase][source]#
List of all keywords.
- extend(kwlist: list) None [source]#
Add a list of keywords to the deck.
- Parameters:
- kwlist
list
List of keywords.
- kwlist
- expand(cwd=None)[source]#
Get a new deck that is flat.
This method makes the
include
method obsolete.
- dumps() str [source]#
Get the keyword file representation of all keywords as a string.
- Returns:
str
Keyword file representation of all keywords as a string.
- write(buf: TextIO | None = None, format: ansys.dyna.core.lib.format_type.format_type | None = None)[source]#
Write the card in the dyna keyword format.
- Parameters:
- buf
optional
Buffer to write to. The default is
None
, in which case the output is returned as a string.- format
optional
Format to write in. The default is
None
.
- buf
- loads(value: str) ansys.dyna.keywords.lib.deck_loader.DeckLoaderResult [source]#
Load all keywords from the keyword file as a string.
When adding all keywords from the file, this method overwrites the title and user comment, if any.
- Parameters:
- value
str
- value
- get_kwds_by_type(type: str) Iterator[ansys.dyna.core.lib.keyword_base.KeywordBase] [source]#
Get all keywords for a given type.
- Parameters:
- type
str
Keyword type.
- type
- Returns:
typing.Iterator
[KeywordBase
]
Examples
Get all SECTION keyword instances in the collection.
>>>deck.get_kwds_by_type(“SECTION”)
- get_section_by_id(id: int) ansys.dyna.core.lib.keyword_base.KeywordBase | None [source]#
Get the SECTION keyword in the collection for a given section ID.
- get(**kwargs) List[ansys.dyna.core.lib.keyword_base.KeywordBase] [source]#
Get a list of keywords.
- Parameters:
- :Keyword Arguments:
- * *type* (``str``) –
The type of keyword to get. For example, “SECTION” returns all section keywords.
- * *filter* (``callable``) –
The filter to apply to the result. Only keywords which pass the filter will be returned.
- import_file(path: str, encoding='utf-8') ansys.dyna.keywords.lib.deck_loader.DeckLoaderResult [source]#
Import a keyword file.
- Parameters:
- path
str
Full path for the keyword file.
- path
- export_file(path: str, encoding='utf-8') None [source]#
Export the keyword file to a new keyword file.
- Parameters:
- path
str
Full path for the new keyword file.
- path