Entity

نظرة عامة

Entity هي فئة في Aspose.3D FOSS لـ Python. تورث من: SceneObject.

كائنات الكيان تعرض get_bounding_box() للاستعلامات المكانية ومجموعة كاملة من طرق إدارة الخصائص (find_property, get_property, set_property, remove_property).

هذه الفئة تعلن عن 7 طرق لكائنات الكيان في برامج Python. الطرق المتاحة تشمل: __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.

خصائص

اسمالنوعالوصولوصف
parent_nodesList['Node']قراءةيحصل على العقد الأصلية.
parent_nodeOptional['Node']قراءة/كتابةيحصل أو يضبط العقدة الأصلية.
excludedboolقراءة/كتابةيحصل أو يضبط المستبعد.
scene``قراءة/كتابةيحصل أو يعيّن المشهد.
namestrقراءة/كتابةيحصل أو يضبط الاسم.
propertiesPropertyCollectionقراءةيحصل على الخصائص.

الطرق

التوقيعوصف
__init__(name: str)Calls init(name) على هذه الحالة من الكيان.
get_bounding_box() → BoundingBoxغير مُنفَّذ في نسخة FOSS — يطرح استثناءً أثناء وقت التشغيل. يرجع صندوق الإحاطة.
get_entity_renderer_key()غير مُنفَّذ في نسخة FOSS — يطرح استثناءً أثناء وقت التشغيل. يعيد مفتاح عارض الكيان.
find_property(property_name: str)يستدعي find_property(property_name) على هذا المثيل من Entity.
get_property(property: str)يستدعي get_property(property) على هذا المثيل من Entity.
set_property(property: str, value)يضبط قيمة الخاصية.
remove_property(property)يستدعي remove_property(property) على هذا المثيل من Entity.

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()     # TypeError
entity.parent_node = some_node    # CORRECT
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}")

انظر أيضاً

 العربية