encode method

encode(self, entity, options)

Encode the entity to Draco raw data

Returns

The encoded draco data represented in bytes


def encode(self, entity, options):
    ...
ParameterTypeDescription
entityEntityThe entity to be encoded
optionsDracoSaveOptionsExtra options for encoding the point cloud

Example

The following code shows how to encode and decode a Mesh to/from byte array:

from aspose import pycore
from aspose.threed import FileFormat
from aspose.threed.entities import Mesh, Sphere

mesh = Sphere().to_mesh()
# encode mesh into Draco format
draco = FileFormat.DRACO.encode(mesh)
# decode mesh from Draco format
decodedMesh = pycore.cast(Mesh, FileFormat.DRACO.decode(draco))

encode(self, entity, stream, options)

Encode the entity to specified stream


def encode(self, entity, stream, options):
    ...
ParameterTypeDescription
entityEntityThe entity to be encoded
streamio.RawIOBaseThe stream that encoded data will be written to
optionsDracoSaveOptionsExtra options for encoding the point cloud

Exceptions

ExceptionDescription
IOExceptionThrown when failed to read from stream

Example

The following code shows how to encode and decode a Mesh to/from byte array:

from aspose import pycore
from aspose.threed import FileFormat
from aspose.threed.entities import Mesh, Sphere

mesh = Sphere().to_mesh()
# encode mesh into Draco format
draco = FileFormat.DRACO.encode(mesh)
# decode mesh from Draco format
decodedMesh = pycore.cast(Mesh, FileFormat.DRACO.decode(draco))

encode(self, entity, file_name, options)

Encode the entity to specified file


def encode(self, entity, file_name, options):
    ...
ParameterTypeDescription
entityEntityThe entity to be encoded
file_namestrThe file name to be written
optionsDracoSaveOptionsExtra options for encoding the point cloud

Exceptions

ExceptionDescription
IOExceptionThrown when failed to read from file

Example

The following code shows how to encode and decode a Mesh to/from byte array:

from aspose import pycore
from aspose.threed import FileFormat
from aspose.threed.entities import Mesh, Sphere

mesh = Sphere().to_mesh()
# encode mesh into Draco format
draco = FileFormat.DRACO.encode(mesh)
# decode mesh from Draco format
decodedMesh = pycore.cast(Mesh, FileFormat.DRACO.decode(draco))

See Also