在Illustrator中我们可以依据对象的属性 如:填充颜色、描边颜色或描边宽度来选择相同属性的对象,但是Illustrator中没有根据不同大小尺寸来选择对象的功能,下面介绍的就是根据大小尺寸选择对象的脚本。
1、下面是当前画板中的所有对象,我们想把一些在尺寸小一些的方形物体删除
2、运行脚本,在弹出的对话框中输入宽度和高度值,(其实只输入其中一个值也可)单击Select;
3、宽度和高度小于20.1的对象将被选中;
4、单击delete键删除对象;
/
//Select Paths By Size v.4.1.1.0 -- CS, CS2, CS3,CS4 (Change extension from 'jsx' to 'js' to run in CS)
//>=--------------------------------------
// Selects all Path Objects, smaller/larger than given threshold
// Only works for path and compound path objects.
//
// If paths are selected, script runs on selected items only,
// If nothing is selected, script runs on all paths in document.
// ::: Updates in V2 :::
// • Rebuilt to select based on Size, Area, Width or by Height.
// • Added "same size as" option
// • If one object is selected, starts threshold at that size.
// • Added Tool Tips
// ::: Updates in V3 :::
// • Added status indicator
// • Rebuilt processing engine so it's faster and more accurate
// ::: Updates in V4 :::
// • Added progress bar (CS3 and above)
// • Speed increase
// ::: Update v4.1 :::
// • Select by stroke weight (patched in 4.1.1)
//
/* Notes:
*/
var u
function Loadbar(x){
this.versionNum= app.version.split(".")[0] ;
if (this.versionNum >= 13){
this.w = new Window('window', "处理中...", undefined, {independent:true});
this.w.frameLocation = [600,500];
this.w.tracker = this.w.add ('statictext' , [15,15,250,35], "processing");
this.w.prog = this.w.add ('progressbar' , [15,15,250,35], 0, x);
//this.w.show();
}
}
Loadbar.prototype.close = function(){
if (this.versionNum >= 13){
this.w.close();
}
}
Loadbar.prototype.hide=function(){
if (this.versionNum >= 13){
this.w.hide();
}
}
Loadbar.prototype.show=function(){
if (this.versionNum >= 13){
this.w.show();
}
}
Loadbar.prototype.update=function(x){
if (this.versionNum >= 13){
this.w.prog.value = x;
}
}
Loadbar.prototype.label=function(x){
if (this.versionNum >= 13){
this.w.tracker.text = x;
}
}
if (app.documents.length > 0)
{
var doc = app.activeDocument;
var sel = doc.selection;
var defaultValue = .05;
var isStrokeSelected = false;
if (sel.length == 1)
{
var seed = (sel[0].width + sel[0].height) /2;
if (seed != 0 || seed != null)
{
defaultValue = seed;
}
}
var OK = 1;
var by = "none";// flag for what method to walk objects selection/doc
var tolerance = .005;
var DISP_COLOR = new RGBColor();
DISP_COLOR.red = 0;
DISP_COLOR.green = 100;
DISP_COLOR.blue = 0;
var myVersion = Math.floor(version.