Skip to main content

Rocky PrePost scripting 2024 R2

RAMaterialCollection

Last update: 17.07.2025

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".
GetDefaultMaterials() Deprecated: Use GetDefaultSolidMaterials() instead.
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.
GetMaterial(material_name) Deprecated: Use GetSolidMaterial() instead.
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”.

GetDefaultMaterials()

Deprecated: Use GetDefaultSolidMaterials() instead.

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.

GetMaterial(material_name: str)

Deprecated: Use GetSolidMaterial() instead.

GetSolidMaterial(material_name: str)

Get the solid material with the given name.

New()

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

Remove(item: T)

Remove an item from the list.

SetBulkSolidFraction(value: Union[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