app.ActiveLayer
当前图层。等价 ActiveDocument.ActivePage.ActiveLayer。
签名
app.ActiveLayer
说明
当前图层。等价
ActiveDocument.ActivePage.ActiveLayer。Python 示例(可直接运行)
Python
layer = app.ActiveLayer # 当前页的活动图层
print("图层名:", layer.Name)
print("该层形状数:", layer.Shapes.Count)
关于本类:Application 应用对象
整个 CDR 进程的入口,主要用来拿文档、拿当前选中、建颜色。
- 本类共 13 条,这是其中之一。
- 完整分类见:Application 应用对象
同类其他接口
- app.Documents所有已打开文档的集合。取第 i 个:app.Documents.Item(i),共 app.Documents.Count 个。
- app.ActiveDocument当前激活文档。一个都没开时返回 None,所以要写 try/except 兜底 CreateDocument。
- app.CreateDocument()新建空白文档,返回 Document。
- app.OpenDocument(path)打开磁盘上的 cdr / 模板文件,返回 Document。
- app.ActiveSelectionRange(n)当前选中的第 n 个形状,返回单个 Shape。刚 Import 完图片立刻用它抓图(n 从 1 开始)。
- app.ActiveSelectionRange不带参数返回整个选区(ShapeRange),可 for s in rng 遍历。
- app.ActiveShape当前选区里的第一个形状,等价 ActiveSelectionRange(1)。
- app.ActivePage当前页。等价 ActiveDocument.ActivePage。