BoM object model#

The models documented in this section are Python bindings for the Ansys Granta MI 23/01 XML schema. Not all elements are required to define a valid BoM for analysis, and not all elements have an impact on all types of analysis. For information on the relevant items for each analysis type, see API reference.

Note

The following elements are defined in the 23/01 BoM schema but are not supported in this module:

This module does not contain classes that correspond to these types and cannot serialize a BoM that includes these elements. It is still possible to deserialize an XML BoM that uses these elements, but these elements cannot be converted to Python objects.

Added in version 2.0.

class BillOfMaterials(components, transport_phase=<factory>, use_phase=None, location=None, notes=None, internal_id=None)#

Type representing the root Bill of Materials object.

components: List[Part]#

The parts contained within this BoM.

transport_phase: List[TransportStage]#

The different forms of transport to which the parts are subject.

use_phase: UsePhase | None = None#

The type of use to which this product is subject.

location: Location | None = None#

The location in which the object represented by the BoM is assembled.

notes: BoMDetails | None = None#

Any optional notes about this BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

enum DimensionType(value)#

Valid values for DimensionType.

Valid values are as follows:

Mass = <DimensionType.Mass: 0>#
MassRemoved = <DimensionType.MassRemoved: 1>#
Volume = <DimensionType.Volume: 2>#
Area = <DimensionType.Area: 3>#
Length = <DimensionType.Length: 4>#
Count = <DimensionType.Count: 5>#
Time = <DimensionType.Time: 6>#

The Enum and its members also have the following methods:

classmethod from_string(value)#

Convert string representation of this object into an instance of this object.

Parameters:
value: str

String representation of this object.

to_string()#

Convert this Enum object to its string representation.

Returns:
str

String representation of this object.

enum PseudoAttribute(value)#

Valid values for PseudoAttribute.

Valid values are as follows:

Name = <PseudoAttribute.Name: 0>#
ShortName = <PseudoAttribute.ShortName: 1>#
Subsets = <PseudoAttribute.Subsets: 2>#
ReleasedDate = <PseudoAttribute.ReleasedDate: 3>#
ModifiedDate = <PseudoAttribute.ModifiedDate: 4>#
RecordType = <PseudoAttribute.RecordType: 5>#
RecordHistoryIdentity = <PseudoAttribute.RecordHistoryIdentity: 6>#
RecordColor = <PseudoAttribute.RecordColor: 7>#
LinkedRecords = <PseudoAttribute.LinkedRecords: 8>#
VersionState = <PseudoAttribute.VersionState: 9>#
RecordGUID = <PseudoAttribute.RecordGUID: 10>#
RecordHistoryGUID = <PseudoAttribute.RecordHistoryGUID: 11>#
RecordVersionNumber = <PseudoAttribute.RecordVersionNumber: 12>#
TableName = <PseudoAttribute.TableName: 13>#
ChildRecords = <PseudoAttribute.ChildRecords: 14>#
TableFilters = <PseudoAttribute.TableFilters: 15>#

The Enum and its members also have the following methods:

classmethod from_string(value)#

Convert string representation of this object into an instance of this object.

Parameters:
value: str

String representation of this object.

to_string()#

Convert this Enum object to its string representation.

Returns:
str

String representation of this object.

enum Category(value)#

Valid values for Category.

Valid values are as follows:

Null = <Category.Null: 0>#
Incorporated = <Category.Incorporated: 1>#
MayBeIncorporated = <Category.MayBeIncorporated: 2>#
UsedInProduction = <Category.UsedInProduction: 3>#
MayBeUsedInProduction = <Category.MayBeUsedInProduction: 4>#
UsedInCoating = <Category.UsedInCoating: 5>#

The Enum and its members also have the following methods:

classmethod from_string(value)#

Convert string representation of this object into an instance of this object.

Parameters:
value: str

String representation of this object.

to_string()#

Convert this Enum object to its string representation.

Returns:
str

String representation of this object.

class PartialTableReference(table_identity=None, table_guid=None, table_name=None)#

A type that partially identifies a Table, but does not specify the MI Database. Usually, just one of the several optional fields should be provided; where more than one is provided, the highest priority one is used, where the descending priority order is: tableIdentity, tableGUID, tableName.

table_identity: int | None = None#

The identity of the table, this is the fastest way to reference a table.

table_guid: str | None = None#

The GUID of the table, this is likely to be a persistent way to refer to a table.

table_name: str | None = None#

The name of the table. Note that table names can vary between localisations of a database, so this may not be a safe way to refer to a table if the MI Database supports multiple locales.

class MIAttributeReference(db_key, attribute_identity=None, table_reference=None, attribute_name=None, pseudo=None, is_standard=None)#

A type that allows identification of a particular Attribute in an MI Database. This may be done directly by specifying the Identity of the Attribute, or indirectly by specifying a lookup that will match (only) the Attribute.

Note: in certain cases, an MIAttributeReference may match more than one Attribute in the MI Database; depending on the operation, this may be legal or may result in a Fault.

db_key: str#

The key that uniquely identifies a particular Database on the MI Server.

attribute_identity: int | None = None#

The identity of the attribute within the MI Database.

table_reference: PartialTableReference | None = None#

A reference to the table hosting the attribute. Required if attribute_name is specified and is_standard is not True.

attribute_name: str | None = None#

Name of the Attribute.

pseudo: PseudoAttribute | None = None#

The pseudo-attribute type if referring to a pseudo-attribute.

is_standard: bool | None = None#

If True indicates that the provided attribute_name is a Standard Name.

class MIRecordReference(db_key, record_history_identity=None, record_version_number=None, record_guid=None, record_history_guid=None, lookup_attribute_reference=None, lookup_value=None, record_uid=None)#

A type that allows identification of a particular Record in an MI Database. This may be done directly by specifying the Identity or GUID of the Record, or indirectly by specifying a lookup that will match (only) the Record.

For input, you should provide exactly one of either identity, recordGUID, recordHistoryGUID or lookupValue. If more than one element identifying the record is given, only one is used; the descending order of priority is: identity, recordGUID, recordHistoryGUID, lookupValue. The Service Layer does not check that the several elements identifying the record are all referencing the same record, it just picks the highest-priority one and uses that.

db_key: str#

The key that uniquely identifies a particular Database on the MI Server.

record_history_identity: int | None = None#

This is the best-performing and highest-priority way to reference a record; however, identities might not be suitable for long-term persistence.

record_version_number: int | None = None#

If omitted, this means the latest version visible to the user.

record_guid: str | None = None#

Identifies a particular version of a record by its GUID, this is a more persistent way to refer to a record.

record_history_guid: str | None = None#

Identifies a record history, the latest visible version will be returned. record_version_number has no effect on references that use record_history_guid.

lookup_attribute_reference: MIAttributeReference | None = None#

When provided in combination with lookup_value identifies a record by a unique short-text attribute. Specifies the attribute to be used for the lookup operation.

lookup_value: str | None = None#

When provided in combination with lookup_attribute_reference identifies a record by a unique short-text attribute. Specifies the value to be used for the lookup operation. If this is not unique an error will be returned.

record_uid: str | None = None#

The recordUID may be used to identify a particular XML element representing a record. It does not represent any property or attribute of an actual MI Record.

class EndOfLifeFate(mi_end_of_life_reference, fraction)#

The fate of a material at the end-of-life of the product. For example if a material can be recycled, and what fraction of the total mass or volume can be recycled.

mi_end_of_life_reference: MIRecordReference#

Reference identifying the applicable fate within the MI Database.

fraction: float#

Fraction of the total mass or volume of material to which this fate applies.

class UnittedValue(value, unit=None)#

A physical quantity with a unit. If provided in an input then the unit must exist within the MI database, otherwise an error will be raised.

value: float#

The value of the quantity in specified units.

unit: str | None = None#

If provided, specifies the unit symbol applying to the quantity. If absent the quantity will be treated as dimensionless.

class Location(mi_location_reference=None, identity=None, name=None, external_identity=None, internal_id=None)#

Defines the manufacturing location for the BoM for use in process calculations.

mi_location_reference: MIRecordReference | None = None#

Reference to a record in the MI database representing the manufacturing location.

identity: str | None = None#

A display identity for the object.

name: str | None = None#

A display name for the object.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class ElectricityMix(mi_region_reference=None, percentage_fossil_fuels=None)#

If the product consumes electrical power, then the amount of CO2 produced to generate depends upon the mix of fossil fuel burning power stations in the region of use. This type lets you specify the electrical generation mix by either specifying the region or country of use or by specifying the percentage of power that comes from fossil fuel sources.

mi_region_reference: MIRecordReference | None = None#

Reference to a record in the MI database representing the electricity mix for the destination country.

percentage_fossil_fuels: float | None = None#

The percentage of electrical power production within the destination country that comes from fossil fuels.

class MobileMode(mi_transport_reference, days_used_per_year, distance_travelled_per_day)#

If the product is transported as part of its use then this type contains details about the way in which it is transported.

mi_transport_reference: MIRecordReference#

Reference to a record in the MI database representing the means of transport for this product during use.

days_used_per_year: float#

The number of days in a year the product will be transported during use.

distance_travelled_per_day: UnittedValue#

The distance the product will be transported each day as part of its use.

class StaticMode(mi_energy_conversion_reference, power_rating, days_used_per_year, hours_used_per_day)#

Specifies the primary energy conversion that occurs during the product’s use.

mi_energy_conversion_reference: MIRecordReference#

Reference to a record in the MI database representing the primary energy conversion taking place when the product is in use.

power_rating: UnittedValue#

The power rating of the product whilst in use.

days_used_per_year: float#

The number of days per year that the product will be used.

hours_used_per_day: float#

The number of hours per day of use that the product will be used.

class UtilitySpecification(industry_average_duration_years=None, industry_average_number_of_functional_units=None, utility=None)#

Specifies how much use can be obtained from the product represented by this BoM in comparison to a representative industry average.

industry_average_duration_years: float | None = None#

The average lifespan of all examples, throughout the industry, of the kind of product described herein.

industry_average_number_of_functional_units: float | None = None#

The average number of functional units delivered, in their lifespan, by all examples, throughout the industry, of the kind of product represented by this object.

utility: float | None = None#

Directly specifies the utility.

class ProductLifeSpan(duration_years, number_of_functional_units=None, functional_unit_description=None, utility=None)#

Specifies the average life span for the product represented by the BoM.

duration_years: float#

The product lifespan in years.

number_of_functional_units: float | None = None#

The number of functional units delivered in the lifespan of the product represented by the BoM.

functional_unit_description: str | None = None#

A short (ideally one-word) description of a single functional unit.

utility: UtilitySpecification | None = None#

Indicates how much use can be obtained from the product represented by the BoM, compared to an industry-average example.

class UsePhase(product_life_span, electricity_mix=None, static_mode=None, mobile_mode=None)#

Provides information about the sustainability of the product whilst in use, including electricity use, emissions due to transport, emissions due to electricity consumption, and the expected life span of the product.

product_life_span: ProductLifeSpan#

Specifies the expected life span of the product.

electricity_mix: ElectricityMix | None = None#

Specifies the proportion of electricity within the destination country that comes from fossil fuels.

static_mode: StaticMode | None = None#

Provides information about the expected static use of the product.

mobile_mode: MobileMode | None = None#

Provides information about the expected mobile use of the product.

class BoMDetails(notes=None, picture_url=None, product_name=None)#

Explanatory information about a BoM.

notes: str | None = None#

General notes for the BoM object.

picture_url: str | None = None#

The URL of an image to include at the top of the report. This URL must be accessible from the reporting services server.

product_name: str | None = None#

The product name.

class TransportStage(name, mi_transport_reference, distance, internal_id=None)#

Defines the transportation applied to an object, in terms of the generic transportation type (stored in the Database) and the amount of that transport used in this instance.

name: str#

Name of this transportation stage, used only to identify the stage within the BoM.

mi_transport_reference: MIRecordReference#

Reference to a record in the MI Database representing the means of transportation for this stage.

distance: UnittedValue#

The distance covered by this transportation stage.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class Specification(mi_specification_reference, quantity=None, identity=None, name=None, external_identity=None, internal_id=None)#

A specification for a surface treatment, part, process, or material. Refers to a record within the MI Database storing the details of the specification and its impact.

mi_specification_reference: MIRecordReference#

Reference identifying the record representing this specification in the MI Database.

quantity: UnittedValue | None = None#

A quantification of the specification, if applicable.

identity: str | None = None#

A display identity for the object.

name: str | None = None#

A display name for the object.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class Substance(mi_substance_reference, percentage=None, category=None, identity=None, name=None, external_identity=None, internal_id=None)#

A substance within a part, semi-finished part, material or specification. The substance is stored in the Database.

mi_substance_reference: MIRecordReference#

Reference identifying the record representing the substance in the MI Database.

percentage: float | None = None#

If the parent object consists of more than one substance, this defines the percentage of this substance.

category: Category | None = None#

Represents whether the substance remains present in the material after production.

identity: str | None = None#

A display identity for the object.

name: str | None = None#

A display name for the object.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class Process(mi_process_reference, dimension_type, percentage=None, quantity=None, identity=None, name=None, external_identity=None, internal_id=None)#

A process that is applied to a subassembly, part, semi-finished part or material. The process is stored in the Database.

mi_process_reference: MIRecordReference#

Reference identifying a record in the MI Database containing information about this process.

dimension_type: DimensionType#

Object defining the dimension affected by the process, for example area for coatings, or mass removed for machining operations.

percentage: float | None = None#

Fraction of the object affected by the process, with basis specified by dimension_type. Only supported for dimension types Mass and MassRemoved.

quantity: UnittedValue | None = None#

A quantification of the process according to its dimension type.

identity: str | None = None#

A display identity for the object.

name: str | None = None#

A display name for the object.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class Material(mi_material_reference, percentage=None, mass=None, recycle_content_percentage=None, processes=<factory>, end_of_life_fates=<factory>, identity=None, name=None, external_identity=None, internal_id=None)#

A Material within a part or semi-finished part. The material is stored in the Database.

mi_material_reference: MIRecordReference#

Reference identifying the material record within the MI Database.

percentage: float | None = None#

The fraction of the part consisting of this material. Provide either this or mass.

mass: UnittedValue | None = None#

The mass of this material present within the part. Provide either this or percentage.

recycle_content_percentage: float | None = None#

If the recyclability is not typical for this material, or no typical value is available in the MI Database, this value indicates which percentage of this material can be recycled.

processes: List[Process]#

Any processes associated with the production and preparation of this material.

end_of_life_fates: List[EndOfLifeFate]#

The fates of this material once the product is disposed of.

identity: str | None = None#

A display identity for the object.

name: str | None = None#

A display name for the object.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.

class Part(part_number, quantity=None, mass_per_unit_of_measure=None, volume_per_unit_of_measure=None, mi_part_reference=None, part_name=None, external_identity=None, components=<factory>, specifications=<factory>, materials=<factory>, substances=<factory>, processes=<factory>, rohs_exemptions=<factory>, end_of_life_fates=<factory>, internal_id=None)#

A single part which may or may not be stored in the MI Database.

part_number: str#

The Part Number associated with this part.

quantity: UnittedValue | None = None#

The quantity of part(s) used in the parent part. For discrete parts, this will be the part count - an integer with a blank unit (or “Each”). For continuous parts, it will be a mass, length, area or volume - a float value with an appropriate units.

mass_per_unit_of_measure: UnittedValue | None = None#

The mass of the part, after processing, relative to the unit that Quantity is given in. If MassPerUom is specified and VolumePerUom is not, then specifying materials within this part is interpreted to be percentage by mass.

volume_per_unit_of_measure: UnittedValue | None = None#

The volume of the part, after processing, relative to the unit that Quantity is given in. If VolumePerUom is specified and MassPerUom is not, then specifying materials within this part is interpreted to be percentage by volume.

mi_part_reference: MIRecordReference | None = None#

A reference identifying a part stored in the MI Database.

part_name: str | None = None#

Display name for the part.

external_identity: str | None = None#

A temporary reference populated and used by applications to refer to the item within the BoM.

components: List[Part]#

List of subcomponents for this part.

specifications: List[Specification]#

List of specifications applying to this part.

materials: List[Material]#

List of constituent materials making up this part.

substances: List[Substance]#

List of substances contained within this part.

processes: List[Process]#

List of processes used in the manufacture of this part.

rohs_exemptions: List[str]#

If the part has a RoHS exemption, provide one or more justifications for the exemptions here. If the part is analyzed as Non-Compliant then the RoHS indicator will return Compliant with Exemptions instead.

end_of_life_fates: List[EndOfLifeFate]#

The fate(s) of the part, at the end-of-life of the product.

internal_id: str | None = None#

A unique identity for this object in this BoM. This identity is only for internal use, allowing other elements to reference this element.