Skip to main content

Rocky PrePost scripting 2026 R1

RAMaterialCollection

Last update: 23.02.2026

class RAMaterialCollection

Rocky PrePost Scripting wrapper for the collection of materials in a project.

This wrapper corresponds to the “Materials” item on the project’s data tree. Retrieve the RAMaterialCollection from a RAStudy via:

material_collection = study.GetMaterialCollection()

Instances of the RAMaterialCollection class act as regular Python lists and can be iterated on, individual materials accessed and deleted via index, etc:

material_1 = material_collection.AddSolidMaterial()
material_2 = material_collection.AddFluidMaterial()
material_2 = material_collection[3]
del material_collection[2]

Items in this list are of type RASolidMaterial and RAFluidMaterial.

Methods:

Name Description
Clear() Remove all items from the list.
GetBulkSolidFraction() Get the value of "Bulk Solid Fraction".
GetDefaultSolidMaterials() Get a list with the default solid materials, in order of Particle, Belt and Boundary.
GetFluidMaterial(material_name) Get the fluid material with the given name.
GetMaterialsInteractionCollection() Get the study's Materials Interaction Collection.
GetSolidMaterial(material_name) Get the solid material with the given name.
New() Deprecated: Use Add{Solid, Fluid}Material() instead.
Remove(item) Remove an item from the list.
SetBulkSolidFraction(value) Set the value of "Bulk Solid Fraction".

Clear()

Remove all items from the list.

GetBulkSolidFraction()

Get the value of “Bulk Solid Fraction”.

GetDefaultSolidMaterials()

Get a list with the default solid materials, in order of Particle, Belt and Boundary.

GetFluidMaterial(material_name: str)

Get the fluid material with the given name.

GetMaterialsInteractionCollection()

Get the study’s Materials Interaction Collection.

GetSolidMaterial(material_name: str)

Get the solid material with the given name.

New()

Deprecated: Use Add{Solid, Fluid}Material() instead.

Remove(item: ApiElementItem)

Remove an item from the list.

SetBulkSolidFraction(value: str | float)

Set the value of “Bulk Solid Fraction”.

  • Parameters: value – The value to set. This value can be an expression with input variables or float type.

Connect with Ansys