Schema and supporting items
Last update: 16.07.2025class LinkGroupDetails
Provides access to the properties of a record link group.
property name
Name of the record link group.
- Returns: str
property table_to
Name of the table targeted by the link group.
- Returns: str
property database_to
Database key of the database target by the link group.
- Returns: str
property table_from
Name of the table the link group comes from.
- Returns: str
property database_from
Database key of the database the link group originates from.
- Returns: str
property type
Whether the record link group is ‘static’, ‘crossDatabase’ or ‘dynamic’.
- Returns: str
property reverse_name
Name of the record link group in the return direction.
- Returns: str
class TableLayout
Provides a JSON-format display of a Granta layout. You can access this through the layout property.
NOTE
Do not create new instances of this class manually.
__init__(name, table)
- Parameters:
- name – str
- table –
Tableobject
- Returns: None
property name
Layout name.
- Returns: str
property layout
JSON-formatted version of the layout.
- Returns: List[Dict[str, Union[str, List[str], Dict[str, Union[str, List[str]]]]]]
property categories
List of all the categories (headings) in the layout.
- Returns: List[str]
property attributes_by_category
Dictionary of attribute lists, indexed by the layout category they are in.
- Returns: Dict[str, List[str]]
property link_groups_by_category
Dictionary of link group lists, indexed by the layout category they are in.
- Returns: Dict[str, List[str]]
property meta_attributes_by_attribute
Dictionary of meta-attribute lists, indexed by parent attributes.
- Returns: Dict[str, List[str]]
meta_attributes_on(attribute_name)
Returns the list of meta-attributes corresponding to a given attribute in this layout.
- Parameters: attribute_name – str
- Returns: List[str]
class Exporter
__init__(mi, exporter_key)
Represents a Granta MI FEA exporter. FEA exporters are used to export record data from Granta MI into formats supported by CAD and CAE packages.
This operation performs no subset filtering, so all tabular rows will be included in the Initial XML regardless of the subset membership of the linked records.
- Parameters:
- mi – Current
Sessionobject - exporter_key – str (Unique identifier for this exporter)
- mi – Current
- Returns: None
property default_file_extension
Returns the default file extension as defined by the exporter configuration file.
- Returns: str
save(file_path, file_name=None, file_extension=None)
Saves the output of the last FEA export to the path provided using the default naming convention and file extension for the exporter; specify a file_name or file_extension to override the defaults.
- Parameters:
- file_path – str (File path of the form C:\Users\Username\)
- file_name – str (Optional - Output file name. Does not require a file extension.)
- file_extension – str (Optional - Output file extension.)
- Returns: None
property default_file_name
Returns the default file name for the last performed export, as defined by the exporter configuration file.
- Returns: str
property default_encoding
Returns the default file encoding scheme as defined by the exporter configuration file.
NOTE
This is returned as a Python-compatible string (e.g. “cp1252”) rather than the .NET codepage “1252”.
- Returns: str
property default_bom
Returns the default byte-order mark as defined by the exporter configuration file. If no BOM is required by
default, this property is None.
- Returns: Union[str, None]
get_parameters_required_for_export(records)
Returns a dictionary of all the parameter definitions the Exporter requires to export the data from the specified list of records, indexed by parameter name.
- Parameters:
records – List[
Record] - Returns:
Dict[str,
ExporterParameter]
run_exporter(records, stop_before=None, parameter_defs=None, sig_figs=None)
Performs an FEA export on the specified list of records, returning the data representing the records as a string.
- Parameters:
- records – List[
Record] - stop_before – Union[int, str] (Either refers to the index of the transform step (int) or its name (str))
- parameter_defs – Dict[str,
ExporterParameter] - sig_figs – int
- records – List[
- Returns: str (Contains data output by the exporter)
export_list_is_valid(records)
Verifies that a list of records is valid for export.
If the exporter was created from a table search, then this method verifies that all records come from this table. Otherwise, the first record is used to determine which table the exporter belongs to.
- Parameters:
records – List[
Record] - Returns: bool (Whether the specified list of records can be exported with this exporter)
property name
The name of the exporter, as defined in the .exp file
- Returns: str
property exporter_key
The unique key, that is used to identify the exporter.
- Returns: str
property model
The Finite-Element Material Model name.
NOTE
This name is exported to the initial XML file, and appears in the MI Viewer and MI Explore export interfaces.
- Returns: str
property package
The Package defines the name of the target CAE analysis package.
NOTE
This name is exported to the initial XML file, and appears in the MI Viewer and MI Explore export interfaces.
- Returns: str
property description
The Exporter description.
- Returns: str
property unit_systems
All the unit-systems this exporter supports.
- Returns: List[str]
property unit_system
The currently selected unit-system.
If None then the default unit system for the exporter will be used, otherwise the provided unit-system will be used when running the exporter.
- Returns: Optional[str]
property use_absolute_temperatures
Whether this exporter should use absolute temperatures.
If True the exporter will use the absolute form of the temperature unit defined in the
selected unit-system. Otherwise, it will use the relative form.
- Returns: bool
property absolute_temperatures_optional
Whether this exporter allows the user to specify absolute or relative temperatures.
If True the user can choose to use the absolute or relative form of the temperature
unit defined in the unit system. Otherwise, the exporter will use the form defined in the
.exp file.
- Returns: bool
property transforms
Iterable containing the transform steps defined for this exporter.
Each entry in the iterable contains the index of the transform stage, and the ID. Either can be used when running the exporter to selectively run transformation steps.
- Returns: Iterable[Mapping[str, Union[str, int]]]
class ParameterDefinition
Base class for parameters.
Provides access to parameter properties such as revision history, default and possible values, and units.
NOTE
Do not create new instances of this class; it represents a pre-existing database structure.
property name
Parameter name.
- Returns: str
property history
Revision history of the parameter, as an ObjectHistory object.
- Returns:
ObjectHistoryobject
property default_value
Default value of the parameter (all parameters must have a default value).
- Returns: str or float
property history_of_default
Revision history of the parameter’s default value, as an ObjectHistory object.
- Returns:
ObjectHistoryobject
property interpolation_type
The interpolation type for the parameter (‘None’, ‘Linear’, or ‘Cubic Spline’).
- Returns: str
property axis_scale_type
Axis scale type for the parameter (‘Linear’, ‘Log’).
None for discrete parameters.
- Returns: str
property unit
Unit symbol for the parameter.
This property is used to specify a unit in the following situations:
- Specify a unit on an object of any
ParameterDefinitionsubclass to control the unit of the values returned by thedefault_valueandvaluesproperties on that object. - Specify a unit on an
ExporterParameterobject to provide a value with a different unit to theExporterParameter.value_for_exportersproperty. - Specify a unit on an
AttributeParameterobject returned by theAttributeFunctional.parametersorAttributePoint.parameter_definitionsproperties to provide parameter values for import in a different unit.
This property does not impact data export. Attribute parameter values are always exported according to the
Database.unit_system and Database.absolute_temperatures settings.
- Returns: str
property database_unit
Database unit symbol for the parameter.
- Returns: str
reset_unit()
Resets the unit back to its original value (the unit in use when the parameter was initially exported). Does not make a call to the Service Layer.
- Returns: None
property values
List of all possible values the parameter can take.
- Returns: List[Union[str, float]]
property values_histories
Revision histories of each possible value of a parameter, as a list of ObjectHistory objects.
- Returns:
List[
ObjectHistory]
property type
Parameter type (‘Unrestricted numeric’, ‘Restricted numeric’, or ‘Discrete’).
WARNING
This property is deprecated. Use data_type and restricted.
- Returns: str
property data_type
Parameter data type (Numeric or Discrete).
- Returns: str
property restricted
Whether the parameter is restricted to specific values.
- Returns: bool
property id
Parameter identifier.
- Returns: int
class DatabaseParameter
Bases: ParameterDefinition
Definition of a parameter at the database level.
class AttributeParameter
Bases: DatabaseParameter
Definition of a parameter as configured for an attribute.
Inherited properties default_value, axis_scale_type, and interpolation_type can differ
from the database parameter definition.
property parent_attribute
Attribute to which this parameter applies.
- Returns:
AttributeDefinitionMultiValue
property order
Order in which the parameter is stored in the attribute. This is relevant for some interpolation methods, and determines the display order in MI Viewer.
- Returns: int
class ExporterParameter
Bases: DatabaseParameter
Definition of a parameter that is used by an exporter, the value and unit can be set to control the exporter’s output.
If the value is not set then the database parameter default value will be used.
property value_for_exporters
Value on the ExporterParameter instance for use in any exporters the parameter is passed to. Can be set
by the user.
If this value is unset, the exporter will use the default value defined in Granta MI.
- Returns: Union[str, float]
clear_value_for_exporters()
Clear the value on the ExporterParameter instance and return it to the default value.
class ObjectHistory
Provides access to the revision history of an MI database element. Object histories are currently supported via the following properties:
> - AttributeDefinition.history
> - AttributeDefinitionTabular.column_histories
> - ParameterDefinition.history
> - ParameterDefinition.history_of_default
> - ParameterDefinition.values_histories
> - DataRevisionHistory.history
NOTE
Do not create new instances of this class; it represents a pre-existing database structure.
__init__(_gdl_revision_info)
- Parameters:
_gdl_revision_info – Foundation API
GRANTA_MIScriptingToolkit.RevisionInfoclass - Returns: None
property last_modified_date
Date the database element was last modified.
- Returns: str
property last_modified_at
Date and time the database element was last modified.
- Returns: datetime.datetime
property date_created
Date the database element was created.
- Returns: str
property created_at
Date and time the database element was created.
- Returns: datetime.datetime
property last_modified_by
The username of the last user to modify the database element.
- Returns: str
property created_by
The username of the user who created the database element.
- Returns: str
property update_count
The number of times the object has been updated.
- Returns: str
class RecordVersionHistory
Provides access to the revision history of an MI Record.
NOTE
Do not create new instances of this class; it represents a pre-existing database structure.
__init__(record_version_history)
property created_at
Date and time the record version was created.
- Returns: datetime.datetime
property created_by
The username of the user who created the record version.
- Returns: str
property creation_notes
Notes associated with the creation of the record version.
- Returns: str
property last_modified_at
Date and time the record version was last modified.
- Returns: datetime.datetime
property last_modified_by
The username of the user who last modified the record version.
- Returns: str
property last_modification_notes
Notes associated with the last modification made to record version.
- Returns: str
property released_at
Date and time the record version was released.
- Returns: datetime.datetime
property released_by
The username of the user who released the record version.
- Returns: str
property release_notes
Notes associated with the release of the record version.
- Returns: str
property superseded_at
Date and time the record version was superseded.
- Returns: datetime.datetime
property superseded_by
The username of the user who superseded the record version.
- Returns: str
property supersession_notes
Notes associated with the last operation that superseded the record version.
- Returns: str
property withdrawn_at
Date and time the record version was withdrawn.
- Returns: datetime.datetime
property withdrawn_by
The username of the user who withdrew the record version.
- Returns: str
property withdrawal_notes
Notes associated with the withdrawal of the record version.
- Returns: str
class DataRevisionHistory
Provides revision history information about the data in an attribute of a record.
NOTE
Do not create new instances of this class; it represents a pre-existing database structure.
__init__(record_attribute)
property name
Name of the attribute.
- Returns: str
property is_populated
Whether the attribute is populated.
- Returns: bool
property created_in_record_version
Version of the record when this datum was created.
- Returns: int
property retired_in_record_version
Version of the record when this datum was retired.
- Returns: int
property data_version_number
Data version number.
- Returns: int
property history
Revision history of the attribute data, as an ObjectHistory object. Is None for empty attributes.
- Returns:
ObjectHistoryobject or None
property meta_attributes
Data revision history of meta-attributes associated with this attribute, indexed by meta-attribute name.
- Returns:
Dict[str,
DataRevisionHistory]
property is_meta_for
Name of the parent attribute, if a meta-attribute. Returns None otherwise.
- Returns: str or None
property is_meta
Whether the attribute is a meta-attribute or not.
- Returns: bool
class SearchCriterion
Defines a single criterion for use in a search. The criterion can be as simple as the presence of the
specified attribute, or as complex as the data in a specified column of the tabular attribute being
greater than a specified value. The search will use the same units as the
AttributeDefinition.
__init__(attribute, operator, value=None, column_name=None)
- Parameters:
- attribute –
AttributeDefinitionobject - operator – str
- value – Input type corresponding to your
AttributeDefinition - column_name – str
- attribute –
NOTE
To perform an exact search on a discrete attribute, the operator argument should be
either CONTAINS_ANY or CONTAINS_ALL. In the case of searching for a single discrete
value, the value argument should be a list containing the search term.
- Returns: None
property attribute
AttributeDefinition for the attribute used in this search criterion.
- Returns:
AttributeDefinitionobject
property operation
Operator used in this criterion, if provided.
- Example: ‘EXISTS’ or ‘CONTAINS’
- Returns: str
class Hyperlink
Represents hyperlinks in MI. Can be used directly in tabular data, or within AttributeHyperlink objects for
standalone hyperlink attributes.
__init__(url=None, hyperlink_display='New', hyperlink_description='')
- Parameters:
- url – str
- hyperlink_display – str (Hyperlink display mode:
New,Content,Top) - hyperlink_description – str (Hyperlink description, displayed in MI applications)
- Returns: None
property hyperlink_display
Indicates how the hyperlink should be opened when clicked on in MI applications. Takes one of the following values:
-
New: Open in a new window or tab. -
Top: Open in the current window or tab. -
Content: Open within the current MI application (for example, in a frame or dialog). -
Returns: str
class BinaryType
Stores and provides access to Pictures and Files, and associated metadata. Pictures and files can appear in Granta MI as data (for example, in a tabular data column), or as an attribute value.
The BinaryType object wraps files and images for inclusion in the corresponding MI Scripting Toolkit
classes.
__init__()
- Returns: None
property value
Current value of the attribute; BinaryType.value always returns the current instance of the class
and cannot be modified. In this case, the values are the file or picture, which can be accessed through
the load and save methods of the File or Picture classes.
- Returns:
BinaryTypeobject
property url
URL of the hosted file. Returns None if not populated.
The data can be retrieved by using a Python HTTP library (e.g. Requests, HTTPX) and by supplying the appropriate authentication for your Granta MI server.
To populate this property, the Table.bulk_fetch() method must be used with
include_binary_data = False (default). If include_binary_data = True is specified, or if the attribute
is fetched on-demand by accessing the attributes dictionary without performing a bulk fetch, this property
will always return None.
- Returns: str or None
property mime_file_type
MIME (Multipurpose Internet Mail Extensions) file type.
When exporting, this property is populated with the value of the MIME file type as determined by Granta MI.
When importing, this property is populated automatically by the load() method:
- For Picture attributes, the MIME file type is determined by the image data.
- For File attributes, this property is not used and is set to
None.
Some commonly-used extensions are:
image/png - .png
image/gif - .gif
image/bmp - .bmp
image/tiff - .tif, .tiff
text/plain - .txt
application/zip - .zip
application/pdf - .pdf
application/vnd.ms-excel - .xls
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - .xlsx
application/vnd.ms-powerpoint - .ppt
application/vnd.openxmlformats-officedocument.presentationml.presentation - .pptx
application/msword - .doc
application/vnd.openxmlformats-officedocument.wordprocessingml.document - .docx
- Returns: str
is_empty()
Checks whether the BinaryType object is populated by checking whether there is binary data in the object.
- Returns: bool
property binary_data
The binary data for the file. Binary data can be set with a bytes object or file buffer.
- Returns: bytes or None.
load(path)
Populates the object with the data located on path. Relative paths are permitted.
- Parameters: path (Union [str , pathlib.Path ]) – Path to the object to load.
- Returns: None
save(path)
Saves an object to file location path. Relative paths are permitted.
- Parameters: path (Union [str , pathlib.Path ]) – Path where the object should be saved.
- Returns: None
class Picture
Extended BinaryType class for Pictures in MI.
Pictures of up to 500 MB in size may be stored in Granta MI. To upload pictures larger than 20 Mb using Scripting Toolkit:
- Granta MI Service Layer must be configured to allow large requests. If this is not configured,
Session.update()will raise aGRANTA_ServiceLayerErrorfor a “413 Request Entity Too Large” HTTP response. For more information, contact your Ansys technical representative. - The Python client environment must have sufficient system resources to load and Base64-encode the binary data. If there are insufficient system resources, unhandled Python exceptions may be raised.
__init__(*, path=None)
- Parameters:
path (Optional *[*Union [str , pathlib.Path ] ]) – Path to the image file to load. Takes the form
C:\\Users\\username\\Pictures\\image.jpgor/home/username/Pictures/image.jpg. - Returns: None
load(path)
Populates the Picture object with the image located on path. Relative paths are permitted.
- Parameters:
path (Union [str , pathlib.Path ]) – Path to the image file to load. Takes the form
C:\\Users\\username\\Pictures\\image.jpgor/home/username/Pictures/image.jpg. - Returns: None
save(path)
Saves a Picture object to file location path. Relative paths are permitted.
- Parameters:
path (Union [str , pathlib.Path ]) – Path where the image should be saved. Takes the form
C:\\Users\\username\\Pictures\\image.jpgor/home/username/Pictures/image.jpg. - Returns: None
property binary_data
The binary data for the file. Binary data can be set with a bytes object or file buffer.
- Returns: bytes or None.
class File
Extended BinaryType class for Files in MI.
Files of up to 500 MB in size may be stored in Granta MI. To upload files larger than 20 Mb using Scripting Toolkit:
- Granta MI Service Layer must be configured to allow large requests. If this is not configured,
Session.update()will raise aGRANTA_ServiceLayerErrorfor a “413 Request Entity Too Large” HTTP response. For more information, contact your Ansys technical representative. - The Python client environment must have sufficient system resources to load and Base64-encode the binary data. If there are insufficient system resources, unhandled Python exceptions may be raised.
__init__(*, path=None)
- Parameters:
path (Optional *[*Union [str , pathlib.Path ] ]) – Path to the file to load. Takes the form
C:\\Users\\username\\Documents\\file.pdfor/home/username/Documents/file.pdf. - Returns: None
save(path)
Saves a File object to file location path. Relative paths are permitted.
- Parameters:
path (Union [str , pathlib.Path ]) – Path where the file should be saved. Takes the form
C:\\Users\\username\\Documents\\file.pdfor/home/username/Documents/file.pdf. - Returns: None
load(path)
Populates the File object with the file located by path. Relative paths are permitted.
- Parameters:
path (Union [str , pathlib.Path ]) – Path to the file to load. Takes the form
C:\\Users\\username\\Documents\\file.pdfor/home/username/Documents/file.pdf. - Returns: None
property file_name
Name of the file.
- Returns: str
property description
File description.
Stored with the data value. If provided, the description replaces the file name for the attribute when displayed on a datasheet in MI Viewer.
- Returns: str
class UnsupportedType
Represents a data type that is unsupported. No information about the value of the Attribute or the Tabular Cell is available. However, the object’s data type is available through this class, along with the underlying object, which may contain more information. Properties of this object cannot be edited.
__init__(datum)
class CurrencyInfo
Stores information about a Currency known to Granta MI.
- Parameters:
__init__(code, name, factor)
class TabularUnits
Stores and provides access to the units for a parent AttributeTabular object, in the same tabular format as
the data.
Units can be set on a cell-by-cell basis. TabularUnits is populated when the parent
AttributeTabular object is loaded.
Any changes made to the underlying AttributeTabular.value() property must also be made to the corresponding
TabularUnits.data() and vice versa, or your changes will not import successfully and may be lost
(AttributeTabular.add_row() and AttributeTabular.delete_row() make the necessary changes to both
objects, but you must duplicate other changes to data yourself).
__init__(units, default_units, database_units)
- Parameters:
- units – List[List[str]]
- default_units – List[str] the default units applied when creating new rows for each column
- database_units – List[str] the units defined in the database for each column
- Returns: None
property database_units
The database units, as a list corresponding to each column.
- Returns: List[str]
property default_units
The default units, as a list corresponding to each column.
- Returns: List[str]
property data
Data values (unit symbol strings) stored in the TabularUnits object.
- Returns: List[List[str]]