pyOptiShared.Material.MaterialLibrary

class pyOptiShared.Material.MaterialLibrary

Bases: object

Material library class holds a list of materials

Methods

LoadFromFolder(material_lib_dir)

Adds all the materials in the specified folder to the list of materials.

addMaterial(material)

Adds the specified material to the list of materials.

getMatDict()

Returns a copy of the material dictionary

getMaterialFromName(matname)

Returns the material object with the specified name

getMaterialFromNum(matnum)

Returns the material object with the specified number

LoadFromFolder(material_lib_dir: str)

Adds all the materials in the specified folder to the list of materials. The material files should have the .txt extension.

Parameters:

material_lib_dir (str) – Directory where the material files are stored

addMaterial(material: Material)

Adds the specified material to the list of materials. The material number and the material name must be unique to be added into the list

Parameters:

material (Material) – Material object

getMatDict() dict[int, Material]

Returns a copy of the material dictionary

Returns:

Material dictionary

Return type:

dict[int,Material]

getMaterialFromName(matname: str) Material

Returns the material object with the specified name

Parameters:

matname (str) – Material name.

Raises:

ValueError – If material with matname is not found.

Returns:

The material object with name matname

Return type:

Material

getMaterialFromNum(matnum: int) Material

Returns the material object with the specified number

Parameters:

matnum (int) – Material number

Raises:

ValueError – If material number is not found.

Returns:

The Material object with number matnumber.

Return type:

Material