Using a custom material#

This example shows how to use a custom material in PyAdditive simulations. For background information and file formats, see Material Tuning Tool (Beta) to Create User Defined Materials in the Additive Manufacturing Beta Features documentation. To prevent wasted time, before executing this example, carefully review the steps described in this PyAdditive documentation.

Units are SI (m, kg, s, K) unless otherwise noted.

Perform required import and connect#

Perform the required import and connect to the Additive service.

from ansys.additive.core import Additive, AdditiveMachine, SingleBeadInput

additive = Additive()

Download custom material#

Download an example of a custom material. Typically, you would have the files defining your custom material stored locally.

import ansys.additive.core.examples as examples

material_files = examples.download_custom_material()

Load custom material files#

Use the load_material() method on the additive object to load the files defining a custom material.

custom_material = additive.load_material(
    parameters_file=material_files.material_configuration_file,
    thermal_lookup_file=material_files.thermal_properties_lookup_file,
    characteristic_width_lookup_file=material_files.characteristic_width_lookup_file,
)

Use the custom material in a simulation#

Once the custom material has been loaded, you can assign it to a simulation input object.

input = SingleBeadInput(
    machine=AdditiveMachine(),
    material=custom_material,
    id="single-bead-simulation",
    bead_length=0.001,  # meters
)

# Remove '#' to run the simulation
# additive.simulate(input)

Total running time of the script: (0 minutes 0.134 seconds)

Gallery generated by Sphinx-Gallery