def testGroup(): cdrObj = CDR() layer = cdrObj.getLayer("秒秒学装饰") s1 = layer.FindShape("test1") s2 = layer.FindShape("test2") s3 = layer.FindShape("test3") s4 = layer.FindShape("test4") # 创建4个边界三角形 if s1 == None: s1 = cdrObj.drawDecorationTriangle("test1", {"background-color": [255, 0, 0]}, { "bottom": 300, "left": 600 }, 'lefttop') if s2 == None: s2 = cdrObj.drawDecorationTriangle("test2", {"background-color": [255, 0, 0]}, { "top": 300, "right": 600 }, 'rightbottom') if s3 == None: s3 = cdrObj.drawDecorationTriangle("test3", {"background-color": [255, 0, 0]}, { "top": 300, "right": 600 }, 'rightbottom') if s4 == None: s4 = cdrObj.drawDecorationTriangle("test4", {"background-color": [255, 0, 0]}, { "top": 300, "right": 600 }, 'rightbottom')
def testPowerClip(): d1 = CDR() layer = d1.getLayer("秒秒学装饰") # 必须设置活动的layer,这样调用vb.exe才会在这个layer的内部 layer.Activate() imgShape = d1.addImage(layer, "C:\\Users\\Administrator\\Desktop\\111\\1.png") #设置单位像素 d1.doc.Unit = 5 ellipse = layer.CreateEllipse(100, 100, 500, 500) imgShape.AddToSelection() imgShape.AddToPowerClip(ellipse)
def addShapeToGroup(): cdrObj = CDR() layerObj = cdrObj.getLayer('秒秒学装饰') g1 = cdrObj.groupShapeObjs( layerObj, "占位组", ) g2 = cdrObj.groupShapeObjs(layerObj, "子组占位组1", g1) g3 = cdrObj.groupShapeObjs(layerObj, "子组占位组2", g2) g4 = cdrObj.groupShapeObjs(layerObj, "子组占位组3", g3) s1 = layerObj.FindShape("test1") if s1 == None: s1 = cdrObj.drawDecorationTriangle("test1", {"background-color": [255, 0, 0]}, { "bottom": 300, "left": 600 }, 'lefttop') # 增加一个对象到组 cdrObj.addShapeToGroup(g4, s1)