EDOBE XDOM TPC Informations techniques Page 59

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 68
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 58
CHAPTER 6: Scripting with VBScript Creating paths and shapes 59
Using x-y coordinates limits the path to straight segments. To created a curved path, you must create
PathPoint objects. Your path can comprise a combination of page coordinates and PathPoint objects.
Specifying a series of x-y coordinates
To specify a path using page-coordinate pairs, use the SetEntirePath() method of the PathItems
object. The following script specifies three pairs of x-y coordinates, to create a path with three points:
Set appRef = CreateObject ("Illustrator.Application")
Set firstPath = appRef.ActiveDocument.PathItems.Add
firstPath.Stroked = True
firstPath.SetEntirePath(Array(Array(220, 475),Array(375, 300),Array(200, 300)))
Using path point objects
To create a PathPoint object, you must define three values for the point:
X A fixed anchor point, which is the point on the path.
X A pair of direction points—left direction and right direction—which allow you to control the
path segments curve.
You define each property as an array of page coordinates in the format
(Array (x,y)).
X If all three properties of a PathPoint object have the same coordinates, and the properties of the next
PathPoint in the line are equal to each other, you create a straight-line segment.
X If two or more properties in a PathPoint object hold different values, the segment connected to the
point is curved.
To create a path or add points to an existing path using
PathPoint objects, create a PathItem object, then
add the path points as child objects in the
PathItem:
Set appRef = CreateObject ("Illustrator.Application")
Set firstPath = appRef.ActiveDocument.PathItems.Add
firstPath.Stroked = true
Set newPoint = firstPath.PathPoints.Add
'Using identical coordinates creates a straight segment
newPoint.Anchor = Array(75, 300)
newPoint.LeftDirection = Array(75, 300)
newPoint.RightDirection = Array(75, 300)
Set newPoint2 = firstPath.PathPoints.Add
newPoint2.Anchor = Array(175, 250)
newPoint2.LeftDirection = Array(175, 250)
newPoint2.RightDirection = Array(175, 250)
Set newPoint3 = firstPath.PathPoints.Add
'Using different coordinates creates a curve
newPoint3.Anchor = Array(275, 290)
newPoint3.LeftDirection = Array(135, 150)
newPoint3.RightDirection = Array(155, 150)
Vue de la page 58
1 2 ... 54 55 56 57 58 59 60 61 62 63 64 ... 67 68

Commentaires sur ces manuels

Pas de commentaire