Texture3DMappingFile#

class ansys.speos.core.input_files.texture_3d.Texture3DMappingFile(patterns=None, uniform_scale=False)#

Bases: ansys.speos.core.input_files._base.SpeosTextFileFormat

Speos *.OPT3DMapping file, laying out the patterns of a 3D Texture.

The pattern count opens the file, then each pattern takes one line, x y z ix iy iz jx jy jz kx ky kz.

Parameters:
patternsList[TexturePattern], optional

Patterns of the texture. By default, [].

uniform_scalebool, optional

Whether to write a single scale factor per pattern instead of one per direction. By default, False. Reading a file sets this from the number of columns found.

Parameters:

Notes

The pattern list is copied on assignment and access, while pattern objects stay shared. Setters check the current uniform-scale constraint before storing values, and Texture3DMappingFile.validate() rechecks it after child edits. Empty lists permit drafts, not saved files.

Examples

>>> from ansys.speos.core.input_files.texture_3d import (
...     Texture3DMappingFile,
...     TexturePattern,
... )
>>> patterns = [TexturePattern(position=(x * 0.5, 0.0, 0.0)) for x in range(10)]
>>> Texture3DMappingFile(patterns=patterns).save("prisms.OPT3DMapping")

Overview#

validate

Check the mapping against the constraints of the *.OPT3DMapping format.

patterns

Pattern collection with a copied container and shared patterns.

uniform_scale

Whether the mapping writes one scale factor per pattern.

EXTENSION

Usual file extension of the format.

Import detail#

from ansys.speos.core.input_files.texture_3d import Texture3DMappingFile

Property detail#

property Texture3DMappingFile.patterns: List[TexturePattern]#

Pattern collection with a copied container and shared patterns.

Parameters:
valuesList[TexturePattern]

New patterns of the texture.

Returns:
List[TexturePattern]

Validated pattern objects.

property Texture3DMappingFile.uniform_scale: bool#

Whether the mapping writes one scale factor per pattern.

Parameters:
valuebool

New whether to write a single scale factor per pattern instead of one per direction.

Returns:
bool

True when each pattern must have equal scale factors.

Attribute detail#

Texture3DMappingFile.EXTENSION = '.OPT3DMapping'#

Usual file extension of the format.

Method detail#

Texture3DMappingFile.validate()#

Check the mapping against the constraints of the *.OPT3DMapping format.

Raises:
ValueError

If the mapping holds no pattern, or if Texture3DMappingFile.uniform_scale is set while a pattern scales differently along X, Y and Z.