-
Notifications
You must be signed in to change notification settings - Fork 6
Pathfinder
fabiantheblind edited this page Oct 6, 2012
·
1 revision
This example shows you how to use the pathfinder options.
main();
function main () {
/*
These functions build a basic setup
this is for better reuse
*/
var build_setup_result = build_setup();
/*
separate the result of the setup function into
single variables. for better handling
*/
var doc = build_setup_result[0]; // This is a doc
var page = build_setup_result[1]; // This is a page
var polygon1 = build_setup_result[2]; // this is our poly1
var polygon2 = build_setup_result[3]; // this is our poly2
page.duplicate(); // duplicate the first page several times
page.duplicate();
page.duplicate();
page.duplicate();
// polygon1.addPath(polygon2); //these are the results of the setup
// these are the duplicated pages
doc.pages.item(1).polygons.item(0).addPath( doc.pages.item(1).polygons.item(1));
doc.pages.item(2).polygons.item(0).subtractPath( doc.pages.item(2).polygons.item(1));
doc.pages.item(3).polygons.item(0).intersectPath( doc.pages.item(3).polygons.item(1));
doc.pages.item(4).polygons.item(0).excludeOverlapPath( doc.pages.item(4).polygons.item(1));
}; // end of function main
function build_setup(){
// create a doc with a size of 200 w and h
var doc = app.documents.add({
documentPreferences:{
pageWidth : 200,
pageHeight: 200,
facingPages: false,
}
});
var page = doc.pages.item(0); // get the page
/*
create a textframe with a content and the
textframe option set to
Center
*/
var tf1 = doc.pages.item(0).textFrames.add({
geometricBounds:[25,25,175,175],
contents: "X",
textFramePreferences:{
verticalJustification: VerticalJustification.CENTER_ALIGN
}
});
var firstPar = tf1.paragraphs.item(0); // get the first paragraph
// set some properties
firstPar.properties = {
pointSize: 500,
justification : Justification.CENTER_ALIGN,
hyphenation : false
};
/*
create a textframe with a content and the
textframe option set to
Center
*/
var tf2 = doc.pages.item(0).textFrames.add({
geometricBounds:[25,25,175,175],
contents: "O",
textFramePreferences:{
verticalJustification: VerticalJustification.CENTER_ALIGN
}
});
var firstPar = tf2.paragraphs.item(0); // get the first paragraph
// set some properties
firstPar.properties = {
pointSize: 500,
justification : Justification.CENTER_ALIGN,
hyphenation : false
};
var poly1 = tf1.createOutlines(true); // make a polygon from the text
var poly2 = tf2.createOutlines(true); // make a polygon from the text
return [doc, page, poly1[0], poly2[0]];
}; // end of setup
This wiki is maintained by:
fabiantheblind
Collaborators:
- How To Install And Run Scripts
- References And Links
- Tools
- First Session
- Comments
- Extended JavaScript Guide
- Variables And Operations
- Conditionals
- Arrays
- Output And Interaction
- Objects
- Classes
- Loops
- Functions
- Recursive Functions
- The ID Scripting DOM
- ExtendScript
- Inspect Properties
- app
- Documents
- Pages And Margins
- Masterspreads
- Layers
- GeometricBounds and Coordinates
- Text
- Line Feeds And Carrige Returns
- Simple Find And Change Grep
- Simple Find And Change Text
- Text Analysis
- Text Analysis ID FC
- Text Find Locations
- InsertionPoints
- Styles
- Objectstyles
- Rectangles Ovals Polygons
- Matrix
- Outlines Groups Alignment
- Graphic Lines
- Spiro
- Colors And Swatches
- HSL Color Wheel
- Pathfinder
- Fonts
- Transformation Matricies
- Duplicate And Transform
- Includes
- Storing Data In A Target Engine
- Create And Read Files
- Read In JSON From File And Eval
- Delay And View
- ScriptUI Resource Strings