Entity

Methods

Methods Entity class היא המחלקה הבסיסית המופשטת עבור אובייקטים שיכולים להיות מצורפים ל‑ Node ב‑Aspose.3D scene graph. תתי‑מחלקות קונקרטיות כוללות Mesh, Camera, Light, ו Geometry. Entity מספק גישה להיררכיית צמתים הורה ומחשוף את excluded property לבקרת נראות.

All attributes המופיעים למטה הם properties; גישה אליהם ללא סוגריים.

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

בדקו את מצב ה‑entity לאחר טעינת סצנה:

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

ראה גם

 עברית