#
# This example demonstrates how to test each selected item to see whether
# it is selected in branch (BRANCH/TREE/MODEL) or not.
#
from win32com.client import constants as cns
app = Application
# Create a bunch of objects for selection tests
app.NewScene("", 0)
app.CreatePrim("Disc", "MeshSurface")
app.CreatePrim("Torus", "MeshSurface")
app.CreatePrim("Grid", "MeshSurface")
app.CreatePrim("Sphere", "MeshSurface")
app.CreatePrim("Cube", "MeshSurface")
app.CreatePrim("Cone", "MeshSurface")
# Select a number of objects with different hierarchical levels
app.SelectObj("disc", "BRANCH")
app.AddToSelection("torus", "TREE")
app.AddToSelection("grid", "NODE")
app.AddToSelection("sphere", "MODEL")
app.AddToSelection("cube")
for sel in app.Selection :
strResults = ""
if sel.BranchFlag == 0 :
strResults = "siNode"
elif sel.BranchFlag == 1 :
strResults = "siBranch"
elif sel.BranchFlag == 3 :
strResults = "siUnspecified"
else :
strResults = "<unrecognized value>"
app.LogMessage( sel.FullName + ".BranchFlag == " + strResults )
# Expected results:
# INFO : disc.BranchFlag == siBranch
# INFO : torus.BranchFlag == siBranch
# INFO : grid.BranchFlag == siNode
# INFO : sphere.BranchFlag == siBranch
# INFO : cube.BranchFlag == siNode
|