此方法用于查找与给定名称匹配的对象。
它包含两个参数:
o第一个参数是所搜索的对象的名称。
o第二个参数指定是否执行递归搜索。此参数是可选参数,缺省值为 FALSE。此方法返回对象的集合。
# Search for the specified object
results = projects.primary.find('MyController', True)
for result in results:
print("Object " + result.get_name() + " found with Guid " + str(result.guid))
此方法用于删除对象。
# Finds the MyController object in the project
results = projects.primary.find("MyController", True)
for result in results:
# Removes all objects with the name MyController
result.remove()
此方法将对象重命名为新名称。
# Finds the MyController object in the project
results = projects.primary.find("MyController", True)
for result in results:
# Rename all MyController objects to MyController_2
result.rename("MyController_2")
请参见项目的导入/导出说明。唯一差别是,将针对导入/导出调用对象而不是项目。