Entity
概要
Entity Python の FOSS でのクラスです. 遺産は: SceneObject.
Entity.get_bounding_box は,エンティティを囲む軸に並んだ境界框を返します.
このクラスでは,Python プログラムで Entity オブジェクトと作業するための 7 つの方法が提供されています. 可能な方法には: __init__, find_property, get_bounding_box, get_entity_renderer_key, get_property, remove_property, set_property. すべてのパブリックメンバーは,Python パッケージのAspose.3D FOSSをインストールした後で,任意の Python アプリケーションにアクセスできます. 特性: excluded, name, parent_node, parent_nodes, properties, scene.
プロパティ
| 名称 (名) | タイプ | Access | 記述 |
|---|---|---|---|
parent_nodes | List['Node'] | 読み取ること | 元のノードを入手します. |
parent_node | Optional['Node'] | 読み書きする | 取得または設定する. |
excluded | bool | 読み書きする | 値が割り切れるか,または設定する. |
scene | `` | 読み書きする | 舞台を立てたり,作ったりする. |
name | str | 読み書きする | 名前をつけられるか設定する. |
properties | PropertyCollection | 読み取ること | 財産を手に入れる. |
メソッド
| Signature | 記述 |
|---|---|
__init__(name: str) | |
get_bounding_box() → BoundingBox | FOSS版では実装されていません. は実行時に投げられます. 制限ボックスを返します. |
get_entity_renderer_key() | FOSS版では実装されていません. は実行時に投げられます. エンティティレンダリングキーを返します. |
find_property(property_name: str) | |
get_property(property: str) | |
set_property(property: str, value) | 資産の値を設定します. |
remove_property(property) |
参照する
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}")