Copy link to clipboard
Copied
Hello!
I'm trying to figure out how to add points on a path/line that lies at 2 inches from the center in the X axis... and then again @ -2 on the X axis.
I'm new to scripting for illustrator so I came here to ask for some help! I would like to program this in JavaScript, but VisualBasic works fine! I know both languages.
The reason for this is I do a certain type of artwork that requires me to cut the artwork @ 2 inches from the center in the X axis, and delete the points greater than 2 inches, and then again for the points less than -2 inches from the center.
I do at least 40 of these a day, I'm looking to speed up my process! I attached an image to show what I mean.
I could alternatively cut in the y axis @ 2 inches, then delete the paths and points greater than 2 inches!
oooohhhh, ok so you have a script already?
if I understod correctly, you need to split the artwork at the center so it goes on a front button uniform.
ok, if you need to split it, you can cut it with a vertical line also, it doesn't have to use a rectangle (I got it now why you wanted to extend the rectangle to the end of the artwork), draw a line in the center of the document (document.width/2) and divide.
Copy link to clipboard
Copied
it is possible with Illustrators JS, but a lot of work because you have to calculate the beziers by yourself. VB? idontknow.
have a look at scriptographer.com (JS.scripting-plugin) which gives you easy access to beziers and also pathfinder-functions.
Copy link to clipboard
Copied
adding points via scripting might be too difficult, at least for me, I would approach it differently. Manually is not difficult at all, but as you said, doing many of them could be time consuming.
manually, based on you sample art
1. draw a 4"x4" square and move it in place
2. while still selected, go to Object, Path, Divide Objects Below
3. that's it...delete objects to the right and left of your target.
now, the interesting part, I assume you know where to cut (3" to the right in your example)
you could script the following:
1. get the position of the target object
2. draw you cutting square
3. position it
if you do VB, make an action to Divide Objects Below
4. play the action
5. delete objects
P.S. just out of curiosity, how do you do it right now manually?.
Copy link to clipboard
Copied
Okay. So the simplest way to do this is to create a rectangle @ 2 inches and continue to the end of the artboard. My question is how do extend the points of the rectangle to the end?
I was thinking I can either somehow check the artboard height, then set the rectangles points to what it returns? In the case of height, it would be every point. In the case of width in the positive 2 inch, I would need to set only the right two points to the edge. Then do it again for left...
Short question, how do I find/return the extents of the artboard? Again, I'm new to illustrator scripting.
*edit** I found Artboard( [bounds
Copy link to clipboard
Copied
?? I got lost, I don't know what you mean. Are you trying to script something else? or do it manually?
Copy link to clipboard
Copied
Yeah. Adding the points on a path is harder than I thought, it's too complex imo.
Basically what I do now is take the artwork make a copy of the layer and paste in front. Take the top layer and add cut a line @ -2 inches from center then delete the points that are less than -2 inches. Then for the bottom layer I cut a line @ 2 inches from center then delete lines that are greater than 2 inches.
This is for Baseball/Softball uniform Tackle Twill, so It has to be split.
For my script the easiest way to do it is to draw a rectangle at a designated area and divide then delete unnecessary points. Sorry if I'm confusing!
Copy link to clipboard
Copied
oooohhhh, ok so you have a script already?
if I understod correctly, you need to split the artwork at the center so it goes on a front button uniform.
ok, if you need to split it, you can cut it with a vertical line also, it doesn't have to use a rectangle (I got it now why you wanted to extend the rectangle to the end of the artwork), draw a line in the center of the document (document.width/2) and divide.
Copy link to clipboard
Copied
Cool. It's working pretty much now! didn't even think about a line.
Thanks!
Copy link to clipboard
Copied
you're welcome