Adobe 26001360 Scripting Guide - Page 308
Parent, TypeName, PathItems
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 308 highlights
308 Visual Basic Reference Example 8.1 This example demonstrates how to select all of the paths in a document that are not part of a compound path or a group by testing the type of the Parent property with a TypeName function. Dim appRef As New Illustrator.Application Dim pathArt As Illustrator.PathItem If appRef.Documents.Count > 0 Then If appRef.ActiveDocument.PathItems.Count > 0 Then For Each pathArt In appRef.ActiveDocument.PathItems If (Not TypeName(pathArt.Parent) = "CompoundPathItem") Then _ pathArt.Selected = True Next End If End If Example 8.2 This example demonstrates how to create a new compound path containing three PathItems. The example then modifies the stroke of the paths in the compound path. Note that when you modify the properties of a PathItem inside a compound path you affect all paths contained in the compound path. The example also shows how to access swatches in a document by name. Dim appRef As New Illustrator.Application Dim frontDocument As Illustrator.Document Dim activeLayer As Illustrator.Layer Dim newCompoundPath As Illustrator.CompoundPathItem Dim newPath As Illustrator.PathItem Set frontDocument = appRef.ActiveDocument Set activeLayer = frontDocument.activeLayer Set newCompoundPath = activeLayer.CompoundPathItems.Add 'Create the path items Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(30, 50), Array(30, 100)) Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(40, 100), Array(100, 100)) Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(100, 110), Array(100, 300)) 12 Aug 03