encode method

encode(self, entity, stream)

Encode the entity and save the result into the stream.


def encode(self, entity, stream):
    ...
ParameterTypeDescription
entityEntityThe entity to encode
streamio.RawIOBaseThe stream to write to, this method will not close this stream

Example

The following code shows how to encode a mesh into PLY file:

from aspose.threed import FileFormat
from aspose.threed.entities import Sphere

mesh = Sphere().to_mesh()
# encode mesh into PLY format
FileFormat.PLY.encode(mesh, "sphere.ply")

encode(self, entity, file_name)

Encode the entity and save the result into an external file.


def encode(self, entity, file_name):
    ...
ParameterTypeDescription
entityEntityThe entity to encode
file_namestrThe file to write to

Example

The following code shows how to encode a mesh into PLY file:

from aspose.threed import FileFormat
from aspose.threed.entities import Sphere

mesh = Sphere().to_mesh()
# encode mesh into PLY format
FileFormat.PLY.encode(mesh, "sphere.ply")

encode(self, entity, stream, opt)

Encode the entity and save the result into the stream.


def encode(self, entity, stream, opt):
    ...
ParameterTypeDescription
entityEntityThe entity to encode
streamio.RawIOBaseThe stream to write to, this method will not close this stream
optPlySaveOptionsSave options

Example

The following code shows how to encode a mesh into PLY file:

from aspose.threed import FileFormat
from aspose.threed.entities import Sphere

mesh = Sphere().to_mesh()
# encode mesh into PLY format
FileFormat.PLY.encode(mesh, "sphere.ply")

encode(self, entity, file_name, opt)

Encode the entity and save the result into an external file.


def encode(self, entity, file_name, opt):
    ...
ParameterTypeDescription
entityEntityThe entity to encode
file_namestrThe file to write to
optPlySaveOptionsSave options

Example

The following code shows how to encode a mesh into PLY file:

from aspose.threed import FileFormat
from aspose.threed.entities import Sphere

mesh = Sphere().to_mesh()
# encode mesh into PLY format
FileFormat.PLY.encode(mesh, "sphere.ply")

See Also