CompoundPathItem
CompoundPathItem
Section titled “CompoundPathItem”app.activeDocument.activeLayer.compoundPathItems[index]
Description
Section titled “Description”A compound path. These objects are composed of multiple intersecting paths, resulting in transparent interior spaces where the component paths overlap. The pathItems property provides access to the paths that make up the compound path.
Paths contained within a compound path or group in a document are returned as individual paths when a script asks for the paths contained in the document. However, paths contained in a compound path or group are not returned when a script asks for the paths in a layer that contains the compound path or group.
All paths within a compound path share property values. Therefore, if you set the value of a property of any one of the paths in the compound path, the properties of all other component paths are updated with the new value.
Properties
Section titled “Properties”CompoundPathItem.artworkKnockout
Section titled “CompoundPathItem.artworkKnockout”app.activeDocument.activeLayer.compoundPathItems[index].artworkKnockout
Description
Section titled “Description”Is this object used to create a knockout, and if so, what kind of knockout.
CompoundPathItem.blendingMode
Section titled “CompoundPathItem.blendingMode”app.activeDocument.activeLayer.compoundPathItems[index].blendingMode
Description
Section titled “Description”The mode used when compositing an object.
CompoundPathItem.controlBounds
Section titled “CompoundPathItem.controlBounds”app.activeDocument.activeLayer.compoundPathItems[index].controlBounds
Description
Section titled “Description”The bounds of the object including stroke width and controls.
Array of 4 numbers; read-only.
CompoundPathItem.editable
Section titled “CompoundPathItem.editable”app.activeDocument.activeLayer.compoundPathItems[index].editable
Description
Section titled “Description”If true
, this item is editable.
Boolean; read-only.
CompoundPathItem.geometricBounds
Section titled “CompoundPathItem.geometricBounds”app.activeDocument.activeLayer.compoundPathItems[index].geometricBounds
Description
Section titled “Description”The bounds of the object excluding stroke width.
Array of 4 numbers; read-only.
CompoundPathItem.height
Section titled “CompoundPathItem.height”app.activeDocument.activeLayer.compoundPathItems[index].height
Description
Section titled “Description”The height of the compound path item excluding stroke width.
Number (double).
CompoundPathItem.hidden
Section titled “CompoundPathItem.hidden”app.activeDocument.activeLayer.compoundPathItems[index].hidden
Description
Section titled “Description”If true
, this compound path item is hidden.
Boolean.
CompoundPathItem.isIsolated
Section titled “CompoundPathItem.isIsolated”app.activeDocument.activeLayer.compoundPathItems[index].isIsolated
Description
Section titled “Description”If true
, this object is isolated.
Boolean.
CompoundPathItem.layer
Section titled “CompoundPathItem.layer”app.activeDocument.activeLayer.compoundPathItems[index].layer
Description
Section titled “Description”The layer to which this compound path item belongs.
Layer; read-only.
CompoundPathItem.left
Section titled “CompoundPathItem.left”app.activeDocument.activeLayer.compoundPathItems[index].left
Description
Section titled “Description”The position of the left side of the item (in points, measured from the left side of the page).
Number (double).
CompoundPathItem.locked
Section titled “CompoundPathItem.locked”app.activeDocument.activeLayer.compoundPathItems[index].locked
Description
Section titled “Description”If true
, this compound path item is locked.
Boolean.
CompoundPathItem.name
Section titled “CompoundPathItem.name”app.activeDocument.activeLayer.compoundPathItems[index].name
Description
Section titled “Description”The name of this compound path item.
String.
CompoundPathItem.note
Section titled “CompoundPathItem.note”app.activeDocument.activeLayer.compoundPathItems[index].note
Description
Section titled “Description”The note assigned to this item.
String.
CompoundPathItem.opacity
Section titled “CompoundPathItem.opacity”app.activeDocument.activeLayer.compoundPathItems[index].opacity
Description
Section titled “Description”The opacity of the object.
Range: 0.0 to 100.0
Number (double).
CompoundPathItem.parent
Section titled “CompoundPathItem.parent”app.activeDocument.activeLayer.compoundPathItems[index].parent
Description
Section titled “Description”The parent of this object.
Layer or GroupItem; read-only.
CompoundPathItem.pathItems
Section titled “CompoundPathItem.pathItems”app.activeDocument.activeLayer.compoundPathItems[index].pathItems
Description
Section titled “Description”The path art items in this compound path.
PathItems; read-only.
CompoundPathItem.position
Section titled “CompoundPathItem.position”app.activeDocument.activeLayer.compoundPathItems[index].position
Description
Section titled “Description”The position (in points) of the top left corner of the compoundPathItem
object in the format [x, y]. Does not include stroke weight.
Array of 2 numbers.
CompoundPathItem.selected
Section titled “CompoundPathItem.selected”app.activeDocument.activeLayer.compoundPathItems[index].selected
Description
Section titled “Description”If true
, this compound path item is selected.
Boolean.
CompoundPathItem.sliced
Section titled “CompoundPathItem.sliced”app.activeDocument.activeLayer.compoundPathItems[index].sliced
Description
Section titled “Description”If true
, the item is sliced.
Default: false
Boolean.
CompoundPathItem.tags
Section titled “CompoundPathItem.tags”app.activeDocument.activeLayer.compoundPathItems[index].tags
Description
Section titled “Description”The tags contained in this object.
Tags; read-only.
CompoundPathItem.top
Section titled “CompoundPathItem.top”app.activeDocument.activeLayer.compoundPathItems[index].top
Description
Section titled “Description”The position of the top of the item (in points, measured from the bottom of the page).
Number (double).
CompoundPathItem.typename
Section titled “CompoundPathItem.typename”app.activeDocument.activeLayer.compoundPathItems[index].typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
CompoundPathItem.uRL
Section titled “CompoundPathItem.uRL”app.activeDocument.activeLayer.compoundPathItems[index].uRL
Description
Section titled “Description”The value of the Adobe URL tag assigned to this compound path item.
String.
CompoundPathItem.visibilityVariable
Section titled “CompoundPathItem.visibilityVariable”app.activeDocument.activeLayer.compoundPathItems[index].visibilityVariable
Description
Section titled “Description”The visibility variable bound to the item.
Variant.
CompoundPathItem.visibleBounds
Section titled “CompoundPathItem.visibleBounds”app.activeDocument.activeLayer.compoundPathItems[index].visibleBounds
Description
Section titled “Description”The visible bounds of the compound path item including stroke width.
Array of 4 numbers; read-only.
CompoundPathItem.width
Section titled “CompoundPathItem.width”app.activeDocument.activeLayer.compoundPathItems[index].width
Description
Section titled “Description”The width of the compound path item excluding stroke width.
Number (double).
CompoundPathItem.wrapInside
Section titled “CompoundPathItem.wrapInside”app.activeDocument.activeLayer.compoundPathItems[index].wrapInside
Description
Section titled “Description”If true
, the text frame object should be wrapped inside this object.
Boolean.
CompoundPathItem.wrapOffset
Section titled “CompoundPathItem.wrapOffset”app.activeDocument.activeLayer.compoundPathItems[index].wrapOffset
Description
Section titled “Description”The offset to use when wrapping text around this object.
Number (double).
CompoundPathItem.wrapped
Section titled “CompoundPathItem.wrapped”app.activeDocument.activeLayer.compoundPathItems[index].wrapped
Description
Section titled “Description”If true
, wrap text frame objects around this object (text frame must be above the object).
Boolean.
CompoundPathItem.zOrderPosition
Section titled “CompoundPathItem.zOrderPosition”app.activeDocument.activeLayer.compoundPathItems[index].zOrderPosition
Description
Section titled “Description”The position of this art item within the stacking order of the group or layer (Parent
) that contains the art item.
Number (long); read-only.
Methods
Section titled “Methods”CompoundPathItem.duplicate()
Section titled “CompoundPathItem.duplicate()”app.activeDocument.activeLayer.compoundPathItems[index].duplicate([relativeObject][,insertionLocation])
Description
Section titled “Description”Creates a duplicate of the selected object.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
relativeObject | Object, optional | Object to duplicate to |
insertionLocation | ElementPlacement, optional | Location to insert element |
Returns
Section titled “Returns”CompoundPathItem.move()
Section titled “CompoundPathItem.move()”app.activeDocument.activeLayer.compoundPathItems[index].move(relativeObject, insertionLocation)
Description
Section titled “Description”Moves the object.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
relativeObject | Object | Object to move element within |
insertionLocation | ElementPlacement, optional | Location to move element to |
Returns
Section titled “Returns”Nothing.
CompoundPathItem.remove()
Section titled “CompoundPathItem.remove()”app.activeDocument.activeLayer.compoundPathItems[index].remove()
Description
Section titled “Description”Deletes this object.
Returns
Section titled “Returns”Nothing.
CompoundPathItem.resize()
Section titled “CompoundPathItem.resize()”app.activeDocument.activeLayer.compoundPathItems[index].resize( scaleX, scaleY [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,changeLineWidths] [,scaleAbout])
Description
Section titled “Description”Scales the art item where scaleX
is the horizontal scaling factor and scaleY
is the vertical scaling factor. 100.0 = 100%.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
scaleX | Number (double) | Horizontal scaling factor |
scaleY | Number (double) | Vertical scaling factor |
changePositions | Boolean, optional | Whether to effect art object positions and orientations |
changeFillPatterns | Boolean, optional | Whether to transform fill patterns |
changeFillGradients | Boolean, optional | Whether to transform fill gradients |
changeStrokePattern | Boolean, optional | Whether to transform stroke patterns |
changeLineWidths | Number (double), optional | The amount to scale line widths |
scaleAbout | Transformation, optional | The point to use as anchor, to transform about |
Returns
Section titled “Returns”Nothing.
CompoundPathItem.rotate()
Section titled “CompoundPathItem.rotate()”app.activeDocument.activeLayer.compoundPathItems[index].rotate( angle [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,rotateAbout])
Description
Section titled “Description”Rotates the art item relative to the current rotation. The object is rotated counter-clockwise if the angle
value is positive, clockwise if the value is negative.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
angle | Number (double) | The angle amount to rotate the element |
changePositions | Boolean, optional | Whether to effect art object positions and orientations |
changeFillPatterns | Boolean, optional | Whether to transform fill patterns |
changeFillGradients | Boolean, optional | Whether to transform fill gradients |
changeStrokePattern | Boolean, optional | Whether to transform stroke patterns |
rotateAbout | Transformation, optional | The point to use as anchor, to transform about |
Returns
Section titled “Returns”Nothing.
compoundPathItem.transform()
Section titled “compoundPathItem.transform()”app.activeDocument.activeLayer.compoundPathItems[index].transform( transformationMatrix [,changePositions] [,changeFillPatterns] [,changeFillGradients] [,changeStrokePattern] [,changeLineWidths] [,transformAbout])
Description
Section titled “Description”Transforms the art item by applying a transformation matrix.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
transformationMatrix | Matrix | Transformation matrix to apply |
changePositions | Boolean, optional | Whether to change Positions |
changeFillPatterns | Boolean, optional | Whether to change Fill Patterns |
changeFillGradients | Boolean, optional | Whether to change Fill Gradients |
changeStrokePattern | Boolean, optional | Whether to change Stroke Pattern |
changeLineWidths | Number (double), optional | The amount to scale line widths |
transformAbout | Transformation, optional | The point to use as anchor, to transform about |
Returns
Section titled “Returns”Nothing.
CompoundPathItem.translate()
Section titled “CompoundPathItem.translate()”app.activeDocument.activeLayer.compoundPathItems[index].translate( deltaX [,deltaY] [,transformObjects] [,transformFillPatterns] [,transformFillGradients] [,transformStrokePatterns])
Description
Section titled “Description”Repositions the art item relative to the current position, where deltaX
is the horizontal offset and deltaY
is the vertical offset.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
deltaX | Number (double), optional | Horizontal offset |
deltaY | Number (double), optional | Vertical offset |
transformObjects | Boolean, optional | Whether to transform Objects |
transformFillPatterns | Boolean, optional | Whether to transform Fill Patterns |
transformFillGradients | Boolean, optional | Whether to transform Fill Gradients |
transformStrokePatterns | Boolean, optional | Whether to transform Stroke Patterns |
Returns
Section titled “Returns”Nothing.
CompoundPathItem.zOrder()
Section titled “CompoundPathItem.zOrder()”app.activeDocument.activeLayer.compoundPathItems[index].zOrder(zOrderCmd)
Description
Section titled “Description”Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
zOrderCmd | ZOrderMethod | Stacking order arrangement method |
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Selecting paths in a document
Section titled “Selecting paths in a document”// Selects all paths not part of a compound pathif ( 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++; } }}
Creating and modifying a compound path item
Section titled “Creating and modifying a compound path item”// Creates a new compound path item containing 3 path// items, then sets the width and the color of the stroke// to all items in the compound path
if (app.documents.length > 0) { var doc = app.activeDocument; var newCompoundPath = doc.activeLayer.compoundPathItems.add();
// Create the path items 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)));
// Set stroke and width properties of the compound path newPath.stroked = true; newPath.strokeWidth = 3.5; newPath.strokeColor = app.activeDocument.swatches[3].color;}