A3DObject, SceneObject, Entity — Aspose.3D TypeScript API Reference
Package: @aspose/3d (v24.12.0)
These three classes form the base of the @aspose/3d class hierarchy. Every public object in the library ultimately extends A3DObject, which supplies the name and dynamic property system. SceneObject adds scene membership tracking. Entity is the base for all objects that can be attached to a Node as its primary entity (meshes, cameras, lights, etc.).
import { A3DObject, SceneObject, Entity } from '@aspose/3d';A3DObject
The root base class for all @aspose/3d objects. Implements INamedObject.
export class A3DObject implements INamedObjectConstructor
new A3DObject(name?: string)Properties
| Property | Type | Access | Description |
|---|---|---|---|
name | string | read/write | Human-readable name. Defaults to ''. |
properties | PropertyCollection | read | Dynamic property collection. Iterate with for...of or query by name. |
Methods
findProperty(propertyName)
Return the Property with the given name, or null if absent.
findProperty(propertyName: string): Property | nullgetProperty(property)
Return the value of a named property, or null if the property does not exist.
getProperty(property: string): anysetProperty(property, value)
Set the value of a named property. Creates it if it does not already exist.
setProperty(property: string, value: any): voidremoveProperty(property)
Remove a named property or a Property instance from the collection.
removeProperty(property: string | Property): booleantoString()
Returns "ClassName(name)".
Example
import { Scene } from '@aspose/3d';
const scene = new Scene();
const node = scene.rootNode.createChildNode('my_node');
node.setProperty('exportLayer', 2);
console.log(node.getProperty('exportLayer')); // 2
const prop = node.findProperty('name');
if (prop) {
console.log(prop.value); // my_node
console.log(prop.valueType); // string
}
for (const p of node.properties) {
console.log(`${p.name} = ${p.value}`);
}
node.removeProperty('exportLayer');
console.log(node.getProperty('exportLayer')); // null
SceneObject
Extends A3DObject with a reference to the owning Scene.
export class SceneObject extends A3DObjectInheritance
A3DObject → SceneObject
Additional property
| Property | Type | Access | Description |
|---|---|---|---|
scene | Scene | null | read/write | The scene this object belongs to. null until the object is added to a scene graph. |
Example
import { Scene } from '@aspose/3d';
const scene = new Scene();
const node = scene.rootNode.createChildNode('child');
console.log(node.scene === scene); // true
Entity
Abstract base for all objects that can be attached to a Node as its primary scene entity. Subclasses include Mesh, Camera, Light, and geometry types.
export class Entity extends SceneObjectInheritance
A3DObject → SceneObject → Entity
Properties
| Property | Type | Access | Description |
|---|---|---|---|
parentNode | Node | undefined | read/write | The primary parent node. Setting this replaces the entire parent list with the single node, or clears it when set to undefined. |
parentNodes | Node[] | read | All parent nodes that reference this entity (read-only copy). In most scenes an entity has exactly one parent. |
excluded | boolean | read/write | When true, the entity is excluded from rendering and export. Defaults to false. |
Methods
getBoundingBox()
Return the axis-aligned bounding box for this entity. Throws on the base class; implemented by concrete subclasses such as Mesh.
getBoundingBox(): BoundingBoxgetEntityRendererKey()
Return a renderer key that identifies the render path for this entity type. Throws on the base class; used internally.
Example
import { Scene, Mesh } from '@aspose/3d';
const scene = new Scene();
const mesh = new Mesh();
// Add control points and a polygon
// ...
const node = scene.rootNode.createChildNode('geo', mesh);
console.log(mesh.parentNode === node); // true
console.log(mesh.excluded); // false
// Exclude from next export
mesh.excluded = true;