Object Containment: Document Vs. Layer - Adobe 26001360 - Illustrator CS - PC Manual

Scripting guide
Hide thumbs Also See for 26001360 - Illustrator CS - PC:
Table of Contents

Advertisement

48
Dim rectPath As Illustrator.PathItem
Dim starPath As Illustrator.PathItem
Set pathItemsRef = appRef.ActiveDocument.ActiveLayer.PathItems
Set rectPath = pathItemsRef.Rectangle(50, 70, 100, 200)
Set starPath = pathItemsRef.Star(40, 70, 200, 110, 5, False)
Dim pathSelection(1) As Variant
Set pathSelection(0) = rectPath
Set pathSelection(1) = starPath
appRef.Selection = pathSelection
End Sub

Object containment: document vs. layer

In Illustrator, all artwork objects are contained in layers, groups or compound paths that are
themselves contained in a document. The index of an object in a layer or group indicates the
object's position in the stacking order of the layer or group. This means that page item 1 of
layer 1, or Layers(1).PageItems(1) in Visual Basic, is the frontmost object in a
document, while page item 2 of layer 1, or Layers(1).PageItems(2) in Visual Basic,
lies directly behind in the stacking order.
Note that if you delete all the layers in a document, the document is left with the default empty
layer called Layer 1.
When you refer to an object in your document, you can reference it directly as part of the
document or by its complete containment hierarchy, including layers and any group or
compound path if valid. When you refer to objects contained by the document directly, you
can access the entire flattened contents of the document, without regard to the containment
of objects within layers, groups, or compound paths. All objects, whether or not they are
contained in groups or compound paths, are returned as individual objects contained by the
document. The following scripts demonstrate how to reference an object as part of a
document.
In AppleScript:
-- Get reference for first page item of document 1
tell application "Adobe Illustrator CS"
set pageItemRef to page item 1 of document 1
end tell
12 Aug 03
Scripting Illustrator

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents