Skip to main content

Granta MI Scripting Toolkit 4.1

What’s new in Version 4.1

Last update: 16.07.2025

Key features introduced or improved in MI Scripting Toolkit 4.1.

Highlights

Improvements to parameter classes

DatabaseParameter, AttributeParameter, and ExporterParameter classes have been added in this release. These classes are sub-classes of the base ParameterDefinition class, and represent parameters at different levels of the Granta MI data hierarchy:

Class Description Returned by
DatabaseParameter Represents a parameter defined at the database level.

These parameters are defined generically, and are not assigned to an attribute.
Database.parameters
AttributeParameter Represents a database parameter assigned to a particular attribute.

This class inherits all properties and methods from the DatabaseParameter class, and adds
AttributeParameter.order and AttributeParameter.parent_attribute.
AttributeDefinitionFloatFunctional.parameters

AttributeDefinitionPoint.parameters
ExporterParameter Represents a parameter specified as an input for an FEA Export operation.

This class inherits all properties and methods from the DatabaseParameter class, and adds
ExporterParameter.value_for_exporters and ExporterParameter.clear_value_for_exporters().
Exporter.get_parameters_required_for_export()

These improvements make it easier to understand which type of parameter is returned by properties and methods, and makes it clearer which functionality is provided by those returned objects.

Enhancements and bug fixes

The following enhancements and bug fixes have been made to parameter classes:

Backwards incompatible API changes

The following backwards-incompatible changes have been made to parameter classes:

Unit systems and absolute temperatures

Summary

Passing certain combinations of absolute_temperature and unit_system values to the Database.set_unit_system(), Database.get_table(), and Database.get_table_by_guid() methods resulted in database and table objects in unexpected states.

Fix applied:

  • The default absolute temperature scale on databases is now False.
  • The absolute_temperature and unit_system values are now always respected when passed to these methods, and will override any previously set values on the Database object.

Recommended usage:

Detailed description of changes

This section describes the previous incorrect behavior and usages that are subject to behavior changes in version 4.1.

  • If the unit_system and absolute_temperature arguments were never used, the default absolute temperature was True. It now defaults to False.
  • If only the absolute_temperature argument was provided, it was ignored and the absolute temperature scale was not updated on the database.
  • If the unit_system argument was provided, it only had an effect if the provided value was not the DATABASE_UNIT_SYSTEM and if the provided value was different from the previously active unit system:
    Unit system change absolute_temperature provided absolute_temperature not provided
    True absolute_temperature respected absolute_temperature set to False
    False absolute_temperature ignored absolute_temperature unchanged

In version 4.1, the behavior of these methods and arguments has been fixed. In order to clarify the expected behavior and to avoid unwanted interaction between independent arguments in the future and unexpected mutation of parent objects, some functionality has been deprecated:

To work with specific unit systems or absolute temperature scale, the recommended approach is to use setters on the database properties Database.unit_system and Database.absolute_temperatures. For example:

database.unit_system = "UK Imperial"
database.absolute_temperatures = True
table = database.get_table(table_name)

In all cases, it is recommended to test scripts and applications being updated to the 4.1 version of the MI Scripting Toolkit, to ensure the expected units are applied.

Enhancements

The behavior of unit systems and absolute temperature units has been standardized in this release.

Backwards incompatible API changes

The features listed in this section provide potentially confusing behavior. Code that uses these features should be modified according to the recommendations below. The features will be removed in a future release.

Streamlined API enhancements and bug fixes

Enhancements

  • Added Record.copy_to() to copy records.

  • Added Table.default_layout, providing the name of the default layout for a table.

  • Improved documentation of Database.search_for_records_where() and Table.search_for_records_where().

  • Attribute min/max information is no longer fetched by default when retrieving attributes for a table.

  • AttributeDiscrete now validates values before trying to write to the database.

    • If a value is not permitted according to the discrete values defined in the database schema, a ValueError is raised.
    • If the value is not a string or a list of strings then a TypeError is raised.

    Additionally, passing a list of values to a single-valued discrete is now deprecated and will be removed in a future release.

  • Fetching attribute definitions from a table now returns distinct classes for each type of attribute, see Attribute Definitions for more information.

  • LinkGroupDetails now includes two additional properties, database_from and database_to. These provide access to the database key of the source database and target database respectively.

  • The Exporter documentation has been extended to describe all public properties of the class.

Bug fixes

Examples

  • Added new Data validation notebook that demonstrates how to use Scripting Toolkit to validate data in a Granta MI database.

Foundation API enhancements and bug fixes

Backwards incompatible API changes

Streamlined API

Known issues

  • If an attribute is exported with the Table.bulk_fetch method with include_binary_data=False, subsequent values returned by the AttributePicture.mime_file_type property will always return image/png, regardless of the actual image format. The header returned when accessing the URL is unaffected and should be used instead.

  • In version-controlled tables, DataRevisionHistory objects have an ambiguous meaning. The history.last_modified_date for the following attribute types is updated when the release state of the parent record is modified:

    • Date
    • Hyperlink
    • Integer
    • Logical
    • Range
    • Short text

    The history.last_modified_date for the following attribute types is not updated when the release state of the parent record is modified:

    • Discrete
    • File
    • Functional
    • Long text
    • Picture
    • Point
    • Tabular

Connect with Ansys