文章目录
1.算法程序
- 1.算法程序
- 2.作者答疑
illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是参考线,开发一个创建参考线功能,以下功能仅用于学习交流,请勿用于非法用途,源代码如下所示:
var nSel = app.selection.length;
if (nSel > 0) {
doWindow();
} else {
alert("选择对象以创建参考线标记");
}
function doWindow() {
var win = new Window("dialog", "创建参考线", [150, 150, 666, 550]);
win.edgesPanel = win.add("panel", [25, 20, 290, 100], "方位");
win.one4allPanel = win.add("panel", [25, 120, 290, 180], "类别");
win.visgeoPanel = win.add("panel", [25, 200, 290, 260], "边界");
win.offsetPanel = win.add("panel", [25, 280, 290, 355], "位移");
win.edgesPanel.chkTop = win.edgesPanel.add("checkbox", [16, 10, 80, 30], "上");
win.edgesPanel.chkBottom = win.edgesPanel.add("checkbox", [62, 10, 180, 30], "下");
win.edgesPanel.chkLeft = win.edgesPanel.add("checkbox", [149, 10, 220, 30], "左");
win.edgesPanel.chkRight = win.edgesPanel.add("checkbox", [206, 10, 280, 30], "右");
win.edgesPanel.chkCntrHor = win.edgesPanel.add("checkbox", [16, 40, 120, 60], "纵向中心");
win.edgesPanel.chkCntrVert = win.edgesPanel.add("checkbox", [149, 40, 300, 60], "横向中心");
win.edgesPanel.chkTop.value = true;
win.edgesPanel.chkBottom.value = true;
win.edgesPanel.chkLeft.value = true;
win.edgesPanel.chkRight.value = true;
win.edgesPanel.chkCntrHor.value = true;
win.edgesPanel.chkCntrVert.value = true;
win.one4allPanel.each = win.one4allPanel.add("radiobutton", [16, 10, 150, 34], "逐个对象");
win.one4allPanel.all = win.one4allPanel.add("radiobutton", [149, 10, 280, 34], "视为整体");
win.one4allPanel.each.value = true;
win.visgeoPanel.vis = win.visgeoPanel.add("radiobutton", [16, 10, 150, 34], "视觉边界");
win.visgeoPanel.geo = win.visgeoPanel.add("radiobutton", [149, 10, 280, 34], "轮廓边界");
win.visgeoPanel.geo.value = true;
win.offsetPanel.vOffLbl = win.offsetPanel.add("statictext", [16, 10, 100, 30], " 纵向");
win.offsetPanel.vOff = win.offsetPanel.add("edittext", [68, 8, 118, 28], "0");
win.offsetPanel.vOffLbl = win.offsetPanel.add("statictext", [125, 10, 147, 30], "mm ");
win.offsetPanel.hOffLbl = win.offsetPanel.add("statictext", [16, 40, 100, 60], " 横向");
win.offsetPanel.hOff = win.offsetPanel.add("edittext", [68, 38, 118, 58], "0");
win.offsetPanel.hOffLbl = win.offsetPanel.add("statictext", [125, 40, 147, 60], "mm ");
win.cancelBtn = win.add("button", [120, 370, 198, 390], "取消");
win.quitBtn = win.add("button", [213, 370, 291, 390], "确定");
win.defaultElement = win.quitBtn;
win.cancelElement = win.cancelBtn;
win.quitBtn.onClick = function() {
var bVB = win.visgeoPanel.vis.value;
var bEach = win.one4allPanel.each.value;
var xOff = win.offsetPanel.hOff.text.replace(",", ".");
var yOff = win.offsetPanel.vOff.text.replace(",", ".");
if (yOff.search("pt") > 0) {
yOff = yOff.replace("pt", "");
yOff = yOff * 1;
} else {
yOff = (yOff * 72) / 25.4;
}
if (xOff.search("pt") > 0) {
xOff = xOff.replace("pt", "");
xOff = xOff * 1;
} else {
xOff = (xOff * 72) / 25.4;
}
var bTop = win.edgesPanel.chkTop.value;
var bLeft = win.edgesPanel.chkLeft.value;
var bRight = win.edgesPanel.chkRight.value;
var bBottom = win.edgesPanel.chkBottom.value;
var bVC = win.edgesPanel.chkCntrVert.value;
var bHC = win.edgesPanel.chkCntrHor.value;
win.close();
doGuides(bTop, bLeft, bBottom, bRight, bVC, bHC, bVB, bEach, xOff, yOff);
};
win.center();
win.show();
}
function doGuides(bTop, bLeft, bBottom, bRight, bVC, bHC, bVB, bEach, xOff, yOff) {
if (bEach == true) {
for (var n = 0; n
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?