A3DObject, SceneObject, CustomObject — Aspose.3D Python API Reference
Package: aspose.threed (aspose-3d-foss 26.1.0)
These three classes form the base of the Aspose.3D class hierarchy. Every public object in the library inherits from A3DObject, which provides a name and a dynamic property collection. SceneObject extends A3DObject with scene membership tracking. CustomObject is a lightweight concrete subclass for storing arbitrary user metadata.
A3DObject
The root base class for all Aspose.3D managed objects. Every named object in the library — Node, Mesh, AnimationClip, Material, and so on — inherits from A3DObject.
from aspose.threed import A3DObjectProperties
| Property | Type | Access | Description |
|---|---|---|---|
name | str | read/write | Human-readable name of the object. Defaults to an empty string. |
properties | PropertyCollection | read | The dynamic property collection attached to this object. Iterate it or use find_property() for named lookups. |
Methods
find_property(property_name)
Search for a named property in this object’s PropertyCollection and return the Property instance, or None if not found.
| Parameter | Type | Description |
|---|---|---|
property_name | str | The name to search for. |
Returns: Property | None
from aspose.threed import Scene
scene = Scene()
node = scene.root_node.create_child_node("origin")
prop = node.find_property("name")
if prop is not None:
print(prop.value) # "origin"get_property(property)
Return the current value of a named property, or None if the property does not exist.
| Parameter | Type | Description |
|---|---|---|
property | str | Property name. |
Returns: Any
val = node.get_property("name")
print(val) # "origin"set_property(property, value)
Set the value of a named property. Creates the property if it does not already exist.
| Parameter | Type | Description |
|---|---|---|
property | str | Property name. |
value | Any | New value. |
Returns: None
node.set_property("layer", 3)
print(node.get_property("layer")) # 3remove_property(property)
Remove a named property from the collection.
| Parameter | Type | Description |
|---|---|---|
property | str | Property | Property name or Property instance to remove. |
Returns: bool — True if the property was found and removed.
Example
from aspose.threed import Scene
scene = Scene()
node = scene.root_node.create_child_node("my_node")
# Set and retrieve a custom property
node.set_property("export_lod", 2)
print(node.get_property("export_lod")) # 2
# Enumerate all properties
for prop in node.properties:
print(f" {prop.name} = {prop.value!r}")
# Find and inspect a specific property
p = node.find_property("name")
if p:
print(p.value_type) # <class 'str'>SceneObject
Extends A3DObject with a reference to the owning Scene. Node, Entity, and related classes inherit from SceneObject.
from aspose.threed import SceneObjectInheritance
A3DObject → SceneObject
Additional property
| Property | Type | Access | Description |
|---|---|---|---|
scene | Scene | None | read/write | The Scene this object belongs to, or None if not yet attached. |
from aspose.threed import Scene
scene = Scene()
node = scene.root_node.create_child_node("child")
print(node.scene is scene) # True (Node inherits SceneObject)CustomObject
A lightweight concrete subclass of A3DObject that carries only a name and an arbitrary PropertyCollection. Use it to attach free-form metadata to a scene without subclassing any entity type.
from aspose.threed import CustomObjectInheritance
A3DObject → CustomObject
Constructor
CustomObject(name: str = None)Example
from aspose.threed import CustomObject, Scene
# Attach pipeline metadata to a node as a custom object
meta = CustomObject("render_settings")
meta.set_property("max_bounces", 8)
meta.set_property("use_denoiser", True)
scene = Scene()
# Store as a user property on the root node
scene.root_node.set_property("render_meta", meta.name)
print(meta.get_property("max_bounces")) # 8