encode method
Contents
[
Hide
]encode(self, entity, options)
Encode the entity to Draco raw data
Returns
The encoded draco data represented in bytes
def encode(self, entity, options):
...
Parameter | Type | Description |
---|---|---|
entity | Entity | The entity to be encoded |
options | DracoSaveOptions | Extra 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):
...
Parameter | Type | Description |
---|---|---|
entity | Entity | The entity to be encoded |
stream | io.RawIOBase | The stream that encoded data will be written to |
options | DracoSaveOptions | Extra options for encoding the point cloud |
Exceptions
Exception | Description |
---|---|
IOException | Thrown 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):
...
Parameter | Type | Description |
---|---|---|
entity | Entity | The entity to be encoded |
file_name | str | The file name to be written |
options | DracoSaveOptions | Extra options for encoding the point cloud |
Exceptions
Exception | Description |
---|---|
IOException | Thrown 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
- module
aspose.threed.formats
- class
DracoFormat