Entity
Methods
Methods Entity class는 첨부될 수 있는 객체를 위한 추상 기본 클래스입니다 Node Aspose.3D 씬 그래프에서. 구체적인 하위 클래스에는 Mesh, Camera, Light, and Geometry. Entity 는 부모 노드 계층에 대한 접근을 제공하고 excluded 가시성 제어를 위한 property를 제공합니다.
아래에 나열된 모든 속성은 속성; 괄호 없이 접근할 수 있습니다.
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
A3DObject → SceneObject → Entity
하위 클래스: Geometry → Mesh, Camera, Light, 및 기타.
Methods
Entity 은(는) 추상 기본 클래스이며 직접 인스턴스화되지 않습니다. 다음과 같은 구체적인 하위 클래스를 사용하십시오 Mesh.
Methods
| Methods | Methods | Methods |
|---|---|---|
parent_nodes | list[Node] (읽기 전용) | 이 엔터티가 연결된 모든 상위 노드입니다. 인스턴싱을 지원합니다(여러 노드에서 동일한 엔터티를 참조). |
parent_node | Optional[Node] (읽기/쓰기) | 주 기본 상위 노드, 또는 None 엔터티가 연결되지 않은 경우. |
excluded | bool (읽기/쓰기) | Methods True, 이 엔터티는 렌더링에서 제외됩니다. 속성으로 접근하고 설정하십시오: entity.excluded = True. |
name | str (읽기/쓰기) | 이 엔터티에 대한 사람이 읽을 수 있는 이름. |
properties | PropertyCollection (읽기 전용) | 사용자 정의 속성 컬렉션. |
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 # CORRECTMethods
씬을 로드한 후 엔티티 상태를 검사합니다:
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}")