- 精华
- 活跃值
-
- 积分
- 223
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
累计签到:221 天 连续签到:0 天
|
楼主 |
发表于 2016-11-17 18:19:50
|
显示全部楼层
本帖最后由 ggcupp 于 2016-11-17 18:37 编辑
添加到cpg框架里的窗体,增加一个按钮,复制到按钮单击就可以了,实现同颜色曲线合并的功能!
实现了基本的vba转成cpg插件的功能。
procedure TForm1.btn1Click(Sender: TObject);
var
st: string;
st1: string;
sh: Shape;
sr1: ShapeRange;
js: Integer;
t: Integer;
n: Integer;
i: Integer;
label
n1, n2;
begin
FApp.ActiveDocument.Unit_ := cdrMillimeter;
if FApp.ActiveLayer.Shapes.Count = 0 then
begin
MessageBox(0, '图层为空', '提示', MB_OK);
exit;
end;
FApp.ActiveWindow.Refresh;
FApp.ActiveDocument.BeginCommandGroup('rename');
FApp.Optimization := True;
js := 1;
i := FApp.ActiveLayer.Shapes.Count;
n1:
sr1 := FApp.CreateShapeRange;
if FApp.ActiveLayer.Shapes[js].type_ = cdrCurveShape then
begin
st := FApp.ActiveLayer.Shapes[js].Outline.Color.Name[True];
if (st = 'R: 0 G: 0 B: 0') or (st = '') or (st = 'R: 255 G: 0 B: 0') or (st = 'C: 0 M: 0 Y: 0 K: 100') or (st = 'C: 0 M: 100 Y: 100 K: 0') then
begin
if js < FApp.ActiveLayer.Shapes.Count then
begin
js := js + 1;
goto n1;
end;
end;
n := FApp.ActiveLayer.Shapes.Count;
if js = n then
begin
MessageBox(0, '绘制完成!', '提示', MB_OK);
goto n2;
end;
[sell=1]for t := js to n do
begin
st1 := FApp.ActiveLayer.Shapes[t].Outline.Color.Name[True];
if st1 = st then
sr1.Add(FApp.ActiveLayer.Shapes[t]);
if t = n then
begin
if sr1.Count >= 2 then
sh := sr1.Combine;
sr1 := nil;
js := js + 1;
if js > FApp.ActiveLayer.Shapes.Count then
begin
MessageBox(0, '绘制完成!', '提示', MB_OK);
goto n2;
end;
goto n1;
end;
end;
end
else
begin
if js < FApp.ActiveLayer.Shapes.Count then
begin
js := js + 1;
goto n1;
end;
end;
if sr1.Count >1 then
begin
sr1.Combine;
MessageBox(0, '绘制完成!', '提示', MB_OK);
end;
n2:
if i = FApp.ActiveLayer.Shapes.Count then
MessageBox(0, '激活层无满足条件的对象!', '提示', MB_OK);
FApp.Optimization := False;
FApp.ActiveDocument.EndCommandGroup;
FApp.ActiveWindow.Refresh;
FApp.Application.Refresh;
[/sell]
end;
|
|