CHAPTER 4: Scripting with AppleScript Working with the perspective grid 43
set starRef to make new star with properties {center point:{135, 135},
radius:15, inner radius:10, point count:6, reversed:false}
--Draw path in perspective
set newPath to make new path item with properties {entire path:{{anchor:{0, 0}},
{anchor:{60, 0}}, {anchor:{30, 45}}, {anchor:{90, 110}}}}
end tell
end tell
Bring objects into perspective
If an art object is not in perspective, use the bringInPerspective() method to bring it into perspective
and place it on a plane.
This script creates a new document, draws an art object, and brings it into perspective on a three-point
perspective grid:
tell application "Adobe Illustrator"
--Create a new document
set docRef to make new document
tell docRef
--Draw star
set starRef to make new star with properties {center point:{135, 135},
radius:15, inner radius:10, point count:6, reversed:false}
--Select the default three-point perspective preset
select perspective preset perspective preset "[3P-Normal View]"
--Display the perspective grid defined in the document
show perspective grid
--Check if active plane is set to left, otherwise set it to left
if (get perspective active plane) is not leftplane then
set perspective active plane perspective grid plane leftplane
end if
--Bring star to floor plane
bring in perspective starRef position x 100 position y 100 perspective grid plane
floorplane
end tell
end tell
Commentaires sur ces manuels