MatmlReader
#
- class ansys.materials.manager.util.matml.matml_parser.MatmlReader(file_path: _PATH_TYPE)#
Parse a MatML (engineering data xml) file.
Fills a nested dict with all the materials and their properties. The key of the first layer are the material names. The conversion into a specific format/object representation is implemented separately.
The data can be accessed via matml_reader.materials
Overview#
Read MATML (engineering data XML) file. |
|
Return a certain material. |
Return the parsed material data from the MatML file. |
|
Return the parsed Workbench Transfer IDs from the MatML file. |
|
Return the path to the target MatML file. |
Read MatML (engineering data XML) data from a file. |
|
Read MatML (engineering data XML) data from a string. |
Import detail#
from ansys.materials.manager.util.matml.matml_parser import MatmlReader
Property detail#
- property MatmlReader.materials: Dict | None#
Return the parsed material data from the MatML file.
Property will be None unless the parser has successfully parsed a MatML file.
- Returns:
- Dict:
Material
data
from
the
MatML
file
Deprecated since version 0.2.3: materials will be removed in version 0.3.0, instead use the static methods parse_from_file and parse_from_text to parse the MatML file and obtain the parsed material dictionary.
- Dict:
- property MatmlReader.transfer_ids: Dict[str, str] | None#
Return the parsed Workbench Transfer IDs from the MatML file.
Property will be None unless the parser has successfully parsed a MatML file.
- Returns:
- Dict:
Workbench
transfer
IDs
from
the
MatML
file
Deprecated since version 0.2.3: transfer_ids will be removed in version 0.3.0, instead use the static methods parse_from_file and parse_from_text to parse the MatML file and obtain the Workbench transfer IDs.
- Dict:
- property MatmlReader.matml_file_path: str#
Return the path to the target MatML file.
Deprecated since version 0.2.3: matml_file_path will be removed in version 0.3.0, instead use the static methods parse_from_file and parse_from_text to parse the MatML file and obtain the parsed material dictionary and the Workbench transfer IDs.
Method detail#
- static MatmlReader.parse_from_file(file_path: _PATH_TYPE) Dict[str, str | Dict] #
Read MatML (engineering data XML) data from a file.
Returns the material information and the workbench transfer identities (if present).
- static MatmlReader.parse_text(matml_content: str) Dict[str, str | Dict] #
Read MatML (engineering data XML) data from a string.
Returns the material information and the workbench transfer identities (if present).
- MatmlReader.parse_matml() int #
Read MATML (engineering data XML) file.
Output can be consumed via matml_reader.materials or matml_reader.get_material(name).
- Returns:
- int:
Number
of
imported
materials.
Deprecated since version 0.2.3: parse_matml will be removed in version 0.3.0, it is replaced by parse_from_file and parse_from_text.
- int:
- MatmlReader.get_material(name: str) Dict #
Return a certain material.
Deprecated since version 0.2.3: get_material will be removed in version 0.3.0, instead use the static methods parse_from_file and parse_from_text to parse the MatML file and obtain the parsed material dictionary and the Workbench transfer ID.