CompoundPathItem
CompoundPathItem
Section titled “CompoundPathItem”app.activeDocument.activeLayer.compoundPathItems[index]
复合路径。这些对象由多个相交的路径组成,导致在组件路径重叠的地方形成透明的内部空间。pathItems
属性提供了访问组成复合路径的路径的途径。
当脚本请求文档中包含的路径时,文档中包含的复合路径或组中的路径将作为单独的路径返回。然而,当脚本请求包含复合路径或组的图层中的路径时,复合路径或组中包含的路径不会返回。
复合路径中的所有路径共享属性值。因此,如果您设置复合路径中任何一个路径的属性值,所有其他组件路径的属性都会更新为新值。
CompoundPathItem.artworkKnockout
Section titled “CompoundPathItem.artworkKnockout”app.activeDocument.activeLayer.compoundPathItems[index].artworkKnockout
此对象是否用于创建挖空效果,如果是,是哪种挖空效果。
CompoundPathItem.blendingMode
Section titled “CompoundPathItem.blendingMode”app.activeDocument.activeLayer.compoundPathItems[index].blendingMode
合成对象时使用的模式。
CompoundPathItem.controlBounds
Section titled “CompoundPathItem.controlBounds”app.activeDocument.activeLayer.compoundPathItems[index].controlBounds
对象的边界,包括描边宽度和控件。
4个数字的数组;只读。
CompoundPathItem.editable
Section titled “CompoundPathItem.editable”app.activeDocument.activeLayer.compoundPathItems[index].editable
如果为 true
,则此项可编辑。
布尔值;只读。
CompoundPathItem.geometricBounds
Section titled “CompoundPathItem.geometricBounds”app.activeDocument.activeLayer.compoundPathItems[index].geometricBounds
对象的边界,不包括描边宽度。
4个数字的数组;只读。
CompoundPathItem.height
Section titled “CompoundPathItem.height”app.activeDocument.activeLayer.compoundPathItems[index].height
复合路径项的高度,不包括描边宽度。
数字(双精度)。
CompoundPathItem.hidden
Section titled “CompoundPathItem.hidden”app.activeDocument.activeLayer.compoundPathItems[index].hidden
如果为 true
,则此复合路径项被隐藏。
布尔值。
CompoundPathItem.isIsolated
Section titled “CompoundPathItem.isIsolated”app.activeDocument.activeLayer.compoundPathItems[index].isIsolated
如果为 true
,则此对象被隔离。
布尔值。
CompoundPathItem.layer
Section titled “CompoundPathItem.layer”app.activeDocument.activeLayer.compoundPathItems[index].layer
此复合路径项所属的图层。
Layer;只读。
CompoundPathItem.left
Section titled “CompoundPathItem.left”app.activeDocument.activeLayer.compoundPathItems[index].left
项的左侧位置(以点为单位,从页面左侧测量)。
数字(双精度)。
CompoundPathItem.locked
Section titled “CompoundPathItem.locked”app.activeDocument.activeLayer.compoundPathItems[index].locked
如果为 true
,则此复合路径项被锁定。
布尔值。
CompoundPathItem.name
Section titled “CompoundPathItem.name”app.activeDocument.activeLayer.compoundPathItems[index].name
此复合路径项的名称。
字符串。
CompoundPathItem.note
Section titled “CompoundPathItem.note”app.activeDocument.activeLayer.compoundPathItems[index].note
分配给此项的注释。
字符串。
CompoundPathItem.opacity
Section titled “CompoundPathItem.opacity”app.activeDocument.activeLayer.compoundPathItems[index].opacity
对象的不透明度。
范围:0.0 到 100.0
数字(双精度)。
CompoundPathItem.parent
Section titled “CompoundPathItem.parent”app.activeDocument.activeLayer.compoundPathItems[index].parent
此对象的父对象。
CompoundPathItem.pathItems
Section titled “CompoundPathItem.pathItems”app.activeDocument.activeLayer.compoundPathItems[index].pathItems
此复合路径中的路径艺术项。
PathItems;只读。
CompoundPathItem.position
Section titled “CompoundPathItem.position”app.activeDocument.activeLayer.compoundPathItems[index].position
compoundPathItem
对象左上角的位置(以点为单位),格式为 [x, y]。不包括描边宽度。
2个数字的数组。
CompoundPathItem.selected
Section titled “CompoundPathItem.selected”app.activeDocument.activeLayer.compoundPathItems[index].selected
如果为 true
,则此复合路径项被选中。
布尔值。
CompoundPathItem.sliced
Section titled “CompoundPathItem.sliced”app.activeDocument.activeLayer.compoundPathItems[index].sliced
如果为 true
,则此项被切片。
默认值:false
布尔值。
CompoundPathItem.tags
Section titled “CompoundPathItem.tags”app.activeDocument.activeLayer.compoundPathItems[index].tags
此对象中包含的标签。
Tags;只读。
CompoundPathItem.top
Section titled “CompoundPathItem.top”app.activeDocument.activeLayer.compoundPathItems[index].top
项的顶部位置(以点为单位,从页面底部测量)。
数字(双精度)。
CompoundPathItem.typename
Section titled “CompoundPathItem.typename”app.activeDocument.activeLayer.compoundPathItems[index].typename
引用对象的类名。
字符串;只读。
CompoundPathItem.uRL
Section titled “CompoundPathItem.uRL”app.activeDocument.activeLayer.compoundPathItems[index].uRL
分配给此复合路径项的 Adobe URL 标签的值。
字符串。
CompoundPathItem.visibilityVariable
Section titled “CompoundPathItem.visibilityVariable”app.activeDocument.activeLayer.compoundPathItems[index].visibilityVariable
绑定到项的可见性变量。
变体。
CompoundPathItem.visibleBounds
Section titled “CompoundPathItem.visibleBounds”app.activeDocument.activeLayer.compoundPathItems[index].visibleBounds
复合路径项的可见边界,包括描边宽度。
4个数字的数组;只读。
CompoundPathItem.width
Section titled “CompoundPathItem.width”app.activeDocument.activeLayer.compoundPathItems[index].width
复合路径项的宽度,不包括描边宽度。
数字(双精度)。
CompoundPathItem.wrapInside
Section titled “CompoundPathItem.wrapInside”app.activeDocument.activeLayer.compoundPathItems[index].wrapInside
如果为 true
,则文本框架对象应在此对象内部换行。
布尔值。
CompoundPathItem.wrapOffset
Section titled “CompoundPathItem.wrapOffset”app.activeDocument.activeLayer.compoundPathItems[index].wrapOffset
围绕此对象换行文本时使用的偏移量。
数字(双精度)。
CompoundPathItem.wrapped
Section titled “CompoundPathItem.wrapped”app.activeDocument.activeLayer.compoundPathItems[index].wrapped
如果为 true
,则围绕此对象换行文本框架对象(文本框架必须位于对象上方)。
布尔值。
CompoundPathItem.zOrderPosition
Section titled “CompoundPathItem.zOrderPosition”app.activeDocument.activeLayer.compoundPathItems[index].zOrderPosition
此艺术项在包含艺术项的组或图层(Parent
)中的堆叠顺序中的位置。
数字(长整型);只读。
CompoundPathItem.duplicate()
Section titled “CompoundPathItem.duplicate()”app.activeDocument.activeLayer.compoundPathItems[index].duplicate([relativeObject][,insertionLocation])
创建所选对象的副本。
参数 | 类型 | 描述 |
---|---|---|
relativeObject | 对象,可选 | 要复制到的对象 |
insertionLocation | ElementPlacement,可选 | 插入元素的位置 |
CompoundPathItem.move()
Section titled “CompoundPathItem.move()”app.activeDocument.activeLayer.compoundPathItems[index].move(relativeObject, insertionLocation)
移动对象。
参数 | 类型 | 描述 |
---|---|---|
relativeObject | 对象 | 要移动元素的对象 |
insertionLocation | ElementPlacement,可选 | 移动元素到的位置 |
无。
CompoundPathItem.remove()
Section titled “CompoundPathItem.remove()”app.activeDocument.activeLayer.compoundPathItems[index].remove()
删除此对象。
无。
CompoundPathItem.resize()
Section titled “CompoundPathItem.resize()”app.activeDocument.activeLayer.compoundPathItems[index].resize( scaleX, scaleY [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,changeLineWidths] [,scaleAbout])
缩放艺术项,其中 scaleX
是水平缩放因子,scaleY
是垂直缩放因子。100.0 = 100%。
参数 | 类型 | 描述 |
---|---|---|
scaleX | 数字(双精度) | 水平缩放因子 |
scaleY | 数字(双精度) | 垂直缩放因子 |
changePositions | 布尔值,可选 | 是否影响艺术对象的位置和方向 |
changeFillPatterns | 布尔值,可选 | 是否变换填充图案 |
changeFillGradients | 布尔值,可选 | 是否变换填充渐变 |
changeStrokePattern | 布尔值,可选 | 是否变换描边图案 |
changeLineWidths | 数字(双精度),可选 | 缩放线宽的量 |
scaleAbout | Transformation,可选 | 用作锚点的点,用于变换 |
无。
CompoundPathItem.rotate()
Section titled “CompoundPathItem.rotate()”app.activeDocument.activeLayer.compoundPathItems[index].rotate( angle [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,rotateAbout])
相对于当前旋转角度旋转艺术项。如果 angle
值为正,则对象逆时针旋转;如果值为负,则顺时针旋转。
参数 | 类型 | 描述 |
---|---|---|
angle | 数字(双精度) | 旋转元素的角度量 |
changePositions | 布尔值,可选 | 是否影响艺术对象的位置和方向 |
changeFillPatterns | 布尔值,可选 | 是否变换填充图案 |
changeFillGradients | 布尔值,可选 | 是否变换填充渐变 |
changeStrokePattern | 布尔值,可选 | 是否变换描边图案 |
rotateAbout | Transformation,可选 | 用作锚点的点,用于变换 |
无。
compoundPathItem.transform()
Section titled “compoundPathItem.transform()”app.activeDocument.activeLayer.compoundPathItems[index].transform( transformationMatrix [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,changeLineWidths] [,transformAbout])
通过应用变换矩阵来变换艺术项。
参数 | 类型 | 描述 |
---|---|---|
transformationMatrix | Matrix | 要应用的变换矩阵 |
changePositions | 布尔值,可选 | 是否改变位置 |
changeFillPatterns | 布尔值,可选 | 是否改变填充图案 |
changeFillGradients | 布尔值,可选 | 是否改变填充渐变 |
changeStrokePattern | 布尔值,可选 | 是否改变描边图案 |
changeLineWidths | 数字(双精度),可选 | 缩放线宽的量 |
transformAbout | Transformation,可选 | 用作锚点的点,用于变换 |
无。
CompoundPathItem.translate()
Section titled “CompoundPathItem.translate()”app.activeDocument.activeLayer.compoundPathItems[index].translate( deltaX [,deltaY] [,transformObjects] [,transformFillPatterns] [,transformFillGradients] [,transformStrokePatterns])
相对于当前位置重新定位艺术项,其中 deltaX
是水平偏移量,deltaY
是垂直偏移量。
参数 | 类型 | 描述 |
---|---|---|
deltaX | 数字(双精度),可选 | 水平偏移量 |
deltaY | 数字(双精度),可选 | 垂直偏移量 |
transformObjects | 布尔值,可选 | 是否变换对象 |
transformFillPatterns | 布尔值,可选 | 是否变换填充图案 |
transformFillGradients | 布尔值,可选 | 是否变换填充渐变 |
transformStrokePatterns | 布尔值,可选 | 是否变换描边图案 |
无。
CompoundPathItem.zOrder()
Section titled “CompoundPathItem.zOrder()”app.activeDocument.activeLayer.compoundPathItems[index].zOrder(zOrderCmd)
在组或图层(父对象)的堆叠顺序中排列艺术项的位置。
参数 | 类型 | 描述 |
---|---|---|
zOrderCmd | ZOrderMethod | 堆叠顺序排列方法 |
无。
选择文档中的路径
Section titled “选择文档中的路径”// 选择所有不属于复合路径的路径if ( app.documents.length > 0 ) { var doc = app.activeDocument; var count = 0; if ( doc.pathItems.length > 0 ) { var thePaths = doc.pathItems; var numPaths = thePaths.length; for ( var i = 0; i < doc.pathItems.length; i++ ) { var pathArt = doc.pathItems[i]; if ( pathArt.parent.typename != "compoundPathItem" ) { pathArt.selected = true; count++; } }}
创建和修改复合路径项
Section titled “创建和修改复合路径项”// 创建一个包含3个路径项的新复合路径项,// 然后设置复合路径中所有项的描边宽度和颜色
if (app.documents.length > 0) { var doc = app.activeDocument; var newCompoundPath = doc.activeLayer.compoundPathItems.add();
// 创建路径项 var newPath = newCompoundPath.pathItems.add(); newPath.setEntirePath(Array(Array(30, 50), Array(30, 100)));
newPath = newCompoundPath.pathItems.add(); newPath.setEntirePath(Array(Array(40, 100), Array(100, 100)));
newPath = newCompoundPath.pathItems.add(); newPath.setEntirePath(Array(Array(100, 110), Array(100, 300)));
// 设置复合路径的描边和宽度属性 newPath.stroked = true; newPath.strokeWidth = 3.5; newPath.strokeColor = app.activeDocument.swatches[3].color;}