Working with Watermark

Contents
[ ]

Create a 3D Scene

First you need to create a 3d scene from a 3d file.The following code snippet shows how to use this functionality:

from aspose.threed import Scene

scene = Scene.from_file("template.3ds")

Encode Watermark

Aspose.3D adds watermark text information and watermark password to 3d files through the encode_watermark method. The following code snippet shows how to use this functionality:

from aspose import pycore
from aspose.threed.entities import Mesh
from aspose.threed.utilities import Watermark

def encode_watermark(node):
    entity = node.entity
    mesh = pycore.as_of(entity, Mesh) if pycore.is_assignable(entity, Mesh) else None
    if mesh:
        watermarked = Watermark.encode_watermark(mesh, "HelloWorld", "1234")
        if watermarked:
            node.entity = watermarked
    for child in node.child_nodes:
        encode_watermark(child)

# Encode a blind watermark into every mesh of the scene
encode_watermark(scene.root_node)

Save Document

You can save to any 3d file format you want.The following code snippet shows how to use this functionality:

from aspose.threed import FileFormat

scene.save("output.fbx", FileFormat.FBX7400ASCII)