select_single_object method
select_single_object(self, path)
Select single object under current node using XPath-like query syntax.
Returns
Object located by the XPath-like query.
def select_single_object(self, path):
...
| Parameter | Type | Description |
|---|---|---|
| path | System.String | The XPath-like query |
Exceptions
| Exception | Description |
|---|---|
ParseException | ParseException will be thrown if the path contains malformed query. |
Example
Select a single node using XPath-like expression
from aspose.threed import Scene
from aspose.threed.entities import Camera, Light
# Test için bir sahne oluştur
s = Scene()
a = s.root_node.create_child_node("a")
a.create_child_node("a1")
a.create_child_node("a2")
s.root_node.create_child_node("b")
c = s.root_node.create_child_node("c")
c.create_child_node("c1").add_entity(Camera("cam"))
c.create_child_node("c2").add_entity(Light("light"))
# Kök düğüm altında, adı 'c' olan düğümün altındaki çocuk düğümler içinde tek bir kamera nesnesi seç
c1 = s.root_node.select_single_object("/c/*/<Camera>")
# Kök düğüm altında, 'a1' adlı düğümü seç, 'a1' doğrudan bir çocuk düğüm olmasa bile
obj = s.root_node.select_single_object("a1")
# Düğümü kendisini seç, çünkü '/' kök düğümde doğrudan seçildi, bu yüzden kök düğüm seçildi.
obj = s.root_node.select_single_object("/")
See Also
- module
aspose.threed - class
Node - class
ParseException