A3DObject / SceneObject / Entity

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 INamedObject

Constructor

new A3DObject(name?: string)

Properties

PropertyTypeAccessDescription
namestringread/writeHuman-readable name. Defaults to ''.
propertiesPropertyCollectionreadDynamic 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 | null

getProperty(property)

Return the value of a named property, or null if the property does not exist.

getProperty(property: string): any

setProperty(property, value)

Set the value of a named property. Creates it if it does not already exist.

setProperty(property: string, value: any): void

removeProperty(property)

Remove a named property or a Property instance from the collection.

removeProperty(property: string | Property): boolean

toString()

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 A3DObject

Inheritance

A3DObjectSceneObject

Additional property

PropertyTypeAccessDescription
sceneScene | nullread/writeThe 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 SceneObject

Inheritance

A3DObjectSceneObjectEntity

Properties

PropertyTypeAccessDescription
parentNodeNode | undefinedread/writeThe primary parent node. Setting this replaces the entire parent list with the single node, or clears it when set to undefined.
parentNodesNode[]readAll parent nodes that reference this entity (read-only copy). In most scenes an entity has exactly one parent.
excludedbooleanread/writeWhen 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(): BoundingBox

getEntityRendererKey()

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;

See Also