Using A Matrix In An Applescript Script; Using A Matrix In A Visual Basic Script - Adobe 26001360 - Illustrator CS - PC Manual

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

Advertisement

57
Matrices are the basis of how Illustrator internally performs a user's request to scale, rotate or
move an object. Using the command set available to create, concatenate, and apply matrices,
you can transform objects in documents with programmatic precision and control. By
concatenating a series of rotation, translation and scaling matrices together and applying the
resulting matrix, you can perform a large series of geometric transformations in record speed.
The following examples demonstrate how to combine multiple modifications in a single matrix
and then apply the matrix to every object in a document.
Refer to the Illustrator Plug-in Software Development Kit Function Reference for more
information on working with transformation matrices.

Using a matrix in an AppleScript script

(* This script gets the identity matrix, combines it with a
rotation matrix and a scale matrix and then applies the
resulting matrix to all page items. *)
tell application "Adobe Illustrator CS"
set transformationmatrix to get identity matrix
set transformationmatrix to concatenate rotation matrix ¬
transformationmatrix angle 45.0
set transformationmatrix to concatenate scale matrix ¬
transformationmatrix horizontal scale 60
transform every page item of document 1 using transformationmatrix
end tell

Using a matrix in a Visual Basic script

'This example shows how to apply 2 transformations to all art in
'a document using the matrix command. This is more efficient than
'performing these transformations one at a time
Private Sub ApplyMatrix_Click()
Dim appRef As New Illustrator.Application
Dim moveMatrix As Illustrator.Matrix
Dim totalMatrix As Illustrator.Matrix
'Move art half an inch to the right and 1.5 inch up on the page
Set moveMatrix = appRef.GetTranslationMatrix(72# * 0.5,
'Add a rotation to the translation. We rotate 10 degrees counter clockwise
Set totalMatrix = appRef.ConcatenateRotationMatrix(moveMatrix,
'Apply the transformation to all art in the document
Dim frontDocument As Illustrator.Document
Dim artItem As Illustrator.PageItem
12 Aug 03
Scripting Illustrator
72# * 1.5)
10)

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents