PyGranta BoM Analytics 2.0.0#

Introduction#

This project is part of the larger PyAnsys effort to facilitate the use of Ansys technologies directly from within Python.

Granta MI provides a mature and feature-rich method for managing restricted substances and sustainability data as part of the Granta MI Restricted Substances and Sustainability database. When combined with the Granta MI BoM Analyzer and Reports, the data managed in Granta MI can be leveraged to determine compliance and sustainability for components, assemblies, and even entire products.

The grantami-bomanalytics package takes the functionality available interactively through the web Granta MI browser and exposes it as an API. The expected use cases for this package are as follows:

  • Rolling up compliance and sustainability results periodically and storing these results in Granta MI.

  • Scripting compliance and sustainability calculations as part of a release process.

  • Allowing compliance and sustainability to be determined for BoMs (Bills of Materials) stored in third-party systems, such as PLM or ERP systems.

Background#

This package provides access to two similar but distinct APIs:

  1. The Granta MI Restricted Substances API is used to determine the impacted substances and compliance of products, assemblies, specifications, and materials against one or more legislations.

  2. The Granta MI Sustainability API is used to evaluate the environmental performance of products, assemblies, materials, manufacturing processes and transport stages.

In both cases, this package makes the underlying REST APIs easier to use by providing idiomatic Python interfaces and example scripts.

This package also provides a sub-package to help constructing Granta XML BoMs.

Dependencies#

To use the grantami-bomanalytics package, you must have access to a Granta MI server that includes MI Restricted Substances and Sustainability Reports 2024 R1 or later. This package also has the following Python package dependencies:

  • ansys-grantami-bomanalytics-openapi package

  • ansys-openapi-common package

These package dependencies are installed automatically by pip, the package installer for Python. For more information, see the installation information in Getting started.

Quick code#

To show how the grantami-bomanalytics package works, this brief compliance example shows how to find the percentage content of all SVHCs (substances of very high concern) in an ABS/PVC blend:

>>> from pprint import pprint
>>> from ansys.grantami.bomanalytics import Connection, queries
>>> cxn = Connection(servicelayer_url="http://my_mi_server/mi_servicelayer") \
...     .with_autologon().connect()
>>> query = (
...     queries.MaterialImpactedSubstancesQuery()
...     .with_material_ids(['plastic-abs-pvc-flame'])
...     .with_legislation_ids(['Candidate_AnnexXV'])
... )
>>> result = cxn.run(query)
>>> pprint(result.impacted_substances)
[<ImpactedSubstance: {"cas_number": 10108-64-2, "percent_amount": 1.9}>,
 <ImpactedSubstance: {"cas_number": 107-06-2, "percent_amount": None}>,
 <ImpactedSubstance: {"cas_number": 115-96-8, "percent_amount": 15.0}>,
...

The sequence of events is as follows:

  1. Connect to Granta MI.

  2. Create the appropriate query with the relevant parameters and references (see API reference for more details).

  3. Run the query.

  4. Process the results.

API reference#

For comprehensive API documentation, see API reference.

Contributing#

Contributions to PyGranta BoM Analytics are welcomed. For more information, see Contributing.

Project index#