Entity
Overview
Entity is a class in Aspose.3D FOSS for Python.
Inherits from: SceneObject.
Entity objects expose get_bounding_box() for spatial queries and a full set of property‑management methods (find_property, get_property, set_property, remove_property).
This class declares 8 methods for Entity objects in Python programs.
Available methods include: __init__, __repr__, find_property, get_bounding_box, get_entity_renderer_key, get_property, remove_property, set_property.
Public members are accessible to any Python application after installing the Aspose.3D FOSS for Python package.
Properties: excluded, name, parent_node, parent_nodes, properties, scene.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
parent_nodes | List['Node'] | Read | Gets the parent nodes. |
parent_node | Optional['Node'] | Read/Write | Gets or sets the parent node. |
excluded | bool | Read/Write | Gets or sets the excluded. |
scene | `` | Read/Write | Gets or sets the scene. |
name | str | Read/Write | Gets or sets the name. |
properties | PropertyCollection | Read | Gets the properties. |
Methods
| Signature | Description |
|---|---|
__init__(name: str) | Calls init(name) on this Entity instance. |
get_bounding_box() → BoundingBox | Not implemented in the FOSS edition — throws at runtime. Returns the bounding box. |
get_entity_renderer_key() | Not implemented in the FOSS edition — throws at runtime. Returns the entity renderer key. |
find_property(property_name: str) | Calls find_property(property_name) on this Entity instance. |
get_property(property: str) | Calls get_property(property) on this Entity instance. |
set_property(property: str, value) | Sets the property value. |
remove_property(property) | Calls remove_property(property) on this Entity instance. |
__repr__() → str | Calls repr on this Entity instance. |
Examples
from aspose.threed import Scene
from aspose.threed.entities import Mesh
scene = Scene.from_file("model.obj")
for node in scene.root_node.child_nodes:
entity = node.entity
if entity is not None:
# excluded is a property, not a method call
if not entity.excluded:
# parent_node is a property, not a method call
parent = entity.parent_node
print(f"Active entity '{entity.name}', parent: {parent.name if parent else 'None'}")# CORRECT
is_excluded = entity.excluded
parent = entity.parent_node
parents = entity.parent_nodes
# WRONG: do not do this
is_excluded = entity.excluded() # TypeError
parent = entity.parent_node() # TypeErrorentity.parent_node = some_node # CORRECTfrom aspose.threed import Scene
from aspose.threed.entities import Mesh
scene = Scene.from_file("model.stl")
for node in scene.root_node.child_nodes:
entity = node.entity
if entity is None:
continue
# Properties accessed without parentheses
print(f"Entity: {entity.name or '(unnamed)'}")
print(f" Type: {type(entity).__name__}")
print(f" Excluded: {entity.excluded}")
print(f" Parent node: {entity.parent_node.name if entity.parent_node else 'None'}")
if isinstance(entity, Mesh):
print(f" Vertices: {len(entity.control_points)}")
print(f" Polygons: {entity.polygon_count}")