Skip to main content
Export the values of Ultimate tensile strength, Modulus, Baseline fiber volume, and Poisson’s ratio for a set of records from the MI Training database. This example demonstrates:
  • Retrieving a list of databases from a Granta MI server
  • Browsing the tables of a Granta MI database
  • Searching a Granta MI database using the CriteriaSearch operation
  • Retrieving values for attributes of a record

Create a Granta MI Session

Import the ansys.grantami.backend.soap package, and create a connection to a Granta MI server.

Get the Databases

Access the browse service from the session and execute the GetDatabases method.
Previous cell output:
Use pandas to display the available databases.
DBKey DBName
0 MI_Training MI Training

Get the tables in a database

Use the GetTables method from the browse service to see what tables are available in the MI Training database.
Previous cell output:

Searching a database

Search MI Training for all records in the Tensile Test Data table which have a defined Young’s modulus (11-axis) normalized)
Print the shortName and longName of the first 5 records returned by the search.
ShortName LongName
0 LBJ8312A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec…
1 LBJ5313A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec…
2 LBJ4212A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec…
3 LBJ6212A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec…
4 LBJ6213A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec…

Export data from records

Create attribute references for the attributes you want to export and export data from all records.
Print the values of the attributes from the first 5 exported records. Note that some records may not have values for all attributes.
ShortName LongName Young’s Modulus (11-axis) (normalized) Ultimate tensile strength (normalized) Baseline fiber volume Elastic Poisson’s Ratio (12-plane)
0 LBJ8312A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec… 49.276835 1559.477024 53.473 0.258
1 LBJ5313A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec… 47.249776 1490.005443 53.473 0.253
2 LBJ4212A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec… 45.774298 1580.774931 53.473 0.306
3 LBJ6212A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec… 49.076887 1379.806528 53.473 0.270
4 LBJ6213A S-Glass Unitape S2/SP381, 3M, 0° tension, Spec… 47.911673 1392.975515 53.473 0.266
Create a plot of the exported values
Previous cell output:
png