Entity

Methods

Methods Entity class は、アタッチできるオブジェクトの抽象基底クラスです Node Aspose.3D シーン グラフ内です。具体的なサブクラスには Mesh, Camera, Light,、および Geometry. Entity 親ノード階層へのアクセスを提供し、 excluded 可視性制御用のプロパティを公開します。.

以下に列挙されたすべての属性は プロパティ;;括弧なしでアクセスできます。.

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'}")

Methods

A3DObjectSceneObjectEntity

サブクラス: GeometryMesh, Camera, Light,、その他。.

Methods

Entity は抽象基底クラスであり、直接インスタンス化されません。具体的なサブクラス(例:)を使用してください Mesh.

Methods

MethodsMethodsMethods
parent_nodeslist[Node] (読み取り専用)このエンティティがアタッチされているすべての親ノード。インスタンシングをサポートします(同じエンティティが複数のノードから参照される)。.
parent_nodeOptional[Node] (読み書き可能)主な親ノード、または None エンティティがアタッチされていない場合。.
excludedbool (読み書き可能)Methods True,、このエンティティはレンダリングから除外されます。プロパティとしてアクセスおよび設定できます:: entity.excluded = True.
namestr (読み書き可能)このエンティティの人が読みやすい名前。.
propertiesPropertyCollection (読み取り専用)カスタムプロパティのコレクション。.

Methods

Methods戻り値の型Methods
get_property(name)Any名前でプロパティの値を取得します。.
find_property(name)Optional[Property]名前でプロパティを検索します。.

重要:: parent_node, parent_nodes, および excludedプロパティ, メソッドではありません。括弧で呼び出さないでください。正しいパターンは次のとおりです::

# 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()     # TypeError

設定するには parent_node, プロパティに代入します::

entity.parent_node = some_node    # CORRECT

Methods

シーンをロードした後にエンティティの状態を検査します:

from 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}")

関連項目

 日本語