Illustrator Scripting :: How To Move / Translate / Reposition The Group
Jul 10, 2013
I have a document with a single layer and a single group (GroupItem) in that layer.
Unfortunately, I didn't create the .ai file, so I don't know exactly what is in the group; however, there appears to be a bunch of complex clipping masks and gradient effects, etc. deeply nested within it.
I've successfully scripted a few tasks like resizing the group with no ill effect... in other words, this works as expected:
app.activeDocument.activeLayer.pathItems[0].resize(50,50);
However, as soon as I try to move/translate/reposition the group, all the effects/masks seem to go wonky, I've tried all of the below with no success (200 is just arbitrary as a test):
app.activeDocument.activeLayer.pathItems[0].left = 200;
app.activeDocument.activeLayer.pathItems[0].translate(200,0);
I have no problem moving the group around on the document with my mouse... all the effects/masks are still nice and clean, so I'm confused as to why I can't do the same thing via JavaScript.
View 3 Replies
ADVERTISEMENT
Apr 29, 2011
What would be the best strategy on the usage of data set to translate our product packaging. It's quite complex as we have several languages on the same packaging. Moreover, we have different text sources that would require to be translated in different sets of languages.
I have already looked into the data set and I tried to get familiar with it. How to create the data set and how to name the different variables knowing that there are different source texts for a particular region (region means a set of languages) and other texts for another region... The idea is to export this into one XML file with well identified elements that can be split with a tool, sent for translation according to their region then merged back into one single file to be imported back into illustrator
Region 1:
en-US
text 1
text 2
fr-FR
text 1
text 2
de-DE
etc...
Region 2:
en-US
text 3
text 4
ru-RU
text 3
text 4
Region 3:
etc..
It seems that the formatting such as bold, italic and so on is not exported into the data set which is quite embarrassing.
View 9 Replies
View Related
Nov 5, 2012
I want to get similar transforms with rotate and translate as I get it with the Transfommation Effect on multiple copies. But somehow the rotation of the Filter puts a different transform than doing it with rotation in js. With js the copies get rotated around a center, that is on the same level for all objects. With the filter the translations seem to have an different origin/direction. I dont get the logic how to get the same output with js.
View 5 Replies
View Related
Jul 25, 2013
I'm trying to resize a opacity mask by doing
transMaskItem.resize(
10, //scaleX,
10, //scaleY,
true, //[,changePositions]
true, //[,changeFillPatterns]
true, //[,changeFillGradients]
true, //[,changeStrokePattern]
0.1, //[,changeLineWidths]
)
This resizes the item, but it does not resize the item inside it. I tried similar command with the translation command
transMaskItem.translate(
100, //([deltaX]
100. //[,deltaY]
True, //[,transformObjects]
True, //[,transformFillPatterns]
True, //[,transformFillGradients]
True, //[,transformStrokePatterns])
and similar thing happened. The item gets moved, but the object inside it doesn't.
How do I resize or translate an opacity mask along with the items inside it?
View 5 Replies
View Related
May 27, 2013
When i call the method selectObjectsOnActiveArtboard on an artboard, is there a way to easily group all items in the selection? Like in the menu found under "right click > group"
View 4 Replies
View Related
Apr 5, 2012
I have a layer that contains two clipping groups (groups with a clip mask and other art). When I call layer.groupItems it returns an empty array. When I call layer.layers it returns the two clipping groups. I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?
View 8 Replies
View Related
Sep 3, 2012
In vbs, I import a illustrator file with this way
Set importedGroup = appRef.ActiveDocument.GroupItems.CreateFromFile(dest)
after i duplicate them
Set dupItem = importedGroup.Duplicate(newGroup, aiPlaceAfter)
but i don't know how to "ungroup" or "unmask" the importedGroup?
I have looking to use clipped but it seems to not working.
View 6 Replies
View Related
Feb 17, 2012
How to select objects by their group names?
I'm working with imported graphics, and the objects appear in the AI layer hierarchy grouped and named according to their object types in the native program (see the attached image). The problem lies with the annotation objects: they are made of different parts for which different graphic styles are needed; however, they all come in one layer and are difficult to access for global operations. I need to do different things with the different object types (delete the POINT's, move the LINE's and LWPOLYLINE's to different layers, etc...). The option of selecting objects individually is ok for small data sets, but you can imagine this becomes untenable in a hurry.
Two possible solutions I've considered:
(1) change the output parameters in the source program such that the objects come into illustrator with different graphics allowing them to be accessed through the "Select same ..." tools; it would work, but is problematic for the source program
(2) print the annotation graphics with their desired graphic appearance to pdf rather than importing the source file directly in AI, then open in AI to render the remaining graphics; again, this works but introduces inefficiency in the process. Also, the print process tends to explode closed paths requiring more inefficient path tinkering in AI.
I would like to tell AI to select all objects named "POINT" or "LINE" etc... but have found nothing in the documentation or forums on whether this is possible.
View 1 Replies
View Related
May 1, 2012
All the graphics in my document is selected. I want to deselect groups and leave standalone items selected. How can i make JavaScript recognize a group?
View 2 Replies
View Related
Aug 14, 2013
I have a group that I want centered on the artboard.
View 9 Replies
View Related
May 8, 2013
<ai cs5><javascript>
I creat 5 pathitem in the K_layer, i want to group them.
code:
var myDoc = app.activeDocument;
var K_layer = myDoc.layers.add();
var k01 = K_layer.pathItems.add(); k01.name='01';[code].....
View 3 Replies
View Related
Sep 11, 2012
I think I might be doing this wrong, I am trying to get contents of a specific textFrame within first group on layer called "page numbers"
It seems to work, but is a bit sketchy, the documentation indicates textFrame is all the text frames in a document, and that textFrameItem should be the specific one within collections of groups etc, maybe I am misunderstanding. this is what I am using:
var existingPageNumbers = app.activeDocument.layers.getByName('page numbers').groupItems[0].textFrames[0].contents;
is this correct approach...?
View 1 Replies
View Related
Jul 30, 2013
I'm having trouble getting a script together where I can ungroup all groups in a document, then put everything under a single group. Everyhting I'm working with has a single layer, but for some of the arts I'm importing have groups within groups ect. To run certain actions I've made properly after I need eveything to be in one, single group.
I searched for an answer and found this (wirtten by Carlos Canto)
function ungroup(whereToUngroup, group) // where to ungroup? layer, document, other group?
{
for (i=group.pageItems.length-1; i>=0; i--)
group.pageItems[i].move(whereToUngroup, ElementPlacement.PLACEATBEGINNING);
}
But I'm having trouble getting it to work.
View 5 Replies
View Related
Feb 18, 2013
I'm trying to create a script via javascript for Illustrator.
My problem is : I have a AI file with multiple layers, i want to create one artboard per layer, in order to export a multipage PDF ( each page contain 1 layer ).
The layers represents the differents type of print ( vernish, color, hot gold, pressure ... ) and/or color type ( Pantone, CMYK, cut, kisscut ... ). My client want a PDF for see each type of print or color type per page.
I'm trying 2 ways :
1st solution : Create new artboards, and duplicate ( or move ) layers content on the new artboad, but the function move/duplicate don't work to move content on another artboard.
2nd solution : Create new document with the same number of layers as artboard and duplicate layer to the new artboard on the new document.
View 6 Replies
View Related
Dec 19, 2012
I am working on a script to standardize layers and I need to move all the pageItems from a layer called "PART_NUMBER" to a layer named "STATIC".
following code at the arrow...
I am using "test" to troubleshoot the move.
standardizeLayerNames() // This function verifies that the Layer names conform to the standard Layer names.
function standardizeLayerNames() {
var myDoc7=app.activeDocument
var myLayerCount7 = myDoc7.layers.length
[Code] ........
View 4 Replies
View Related
May 5, 2011
I´d like to know how to move/displace multiple objects (in this case bricks) like it is done in this animation (at approx. 0:15 sec) [URL].I tried to reconstruct the effect using bigger bricks and tangent constraints, which worked kinda ok but I had to constrain every single brick manually which was rather time consuming and definitely not the approach they must have had used. Is there a way to achieve similar effect (pref. without scripting)?
View 4 Replies
View Related
Jun 21, 2013
All I am trying to do is move an anchor from one location to another using vbscript. I have searched everywhere and scoured the scripting references but I have not been able to figure this out as of yet.
I am able to select anchor points without an issue....moving those points seems to be a problem.
View 5 Replies
View Related
Nov 12, 2013
I have a script that measures the repeat interval and gap between print impressions printed using a print cylinder (for the production team to know which print cylinders to use, and what to expect once it prints, when looking at the proof sheet). Basically it just measures the distance from the beginning of one print impression to the beginning of the next (these are printed with a cylinder, so every time the cylinder rotates a new print impression happens) as well as the distance in between prints. That part works great.
In order to get these meaurements, Illustrator is measuring the distance from a zero point on the artboard to the left side of a marker I made called "repeat", and it is assigned a variable called rawRepeat. What I'd like to do is have the script take that rawRepeat value and use it to move a copy of the print impression to the right by exactly that variable amount and paste it beneath the marker called "repeat". I have been doing this part manually, but haven't been able to figure out how to get illustrator to do this for me.
Here's the script I am using:
var myDocument = app.activeDocument;
var selectedObject = myDocument.selection;
var activeLayer = app.activeDocument.activeLayer;
var layerName = activeLayer.name;
activeLayer.name = "plate";
[Code] .....
View 11 Replies
View Related
Oct 10, 2013
I am trying to grab specific spot colors and move them to separate layers for our cutting software. In this case I am trying to grab "perimeter cut" and move it to a layer called "tc 1" I get the following error when I try to run the script.
#target Illustrator
var idoc = app.activeDocument;
var ipath = idoc.pathItems;
if (ipath.typename == "SpotColor") {
if (ipath.spot.name == "perimeter cut") {
ipath.move(tc 1, ElementPlacement.PLACEATBEGINNING).
}
}
View 5 Replies
View Related
Oct 23, 2013
Basically, I have an open AI document and would like to duplicate its artboard and then move it to a new position(X axis, 50pixels away from the original). Doesn't seem too hard, but I can't figure it out. This is for CS5.
var docRef = app.activeDocument;
var abSrc = docRef.artboards[0];
var abSrcX = abSrc.artboardRect[0];
[Code]...
Taking that into account if I add (1224 + 144) to abSrcX and abSrxW it creates another artboard 2" away from the previous at 17" x 11". If I want to run it again, I just to add (1224 + 144) to abSrcX and abSrxW again. Now to figure out how to do this dynamically on the fly.
View 5 Replies
View Related
May 17, 2013
I have a piece of art on "Layer 1" that i need to shrink and duplicate to "Layer 2". The two layers are always named the same. I'm working in CS5.
View 6 Replies
View Related
Aug 17, 2012
I'm trying to nudge the anchor points on an object randomly (to get an informal look). (I know some Effects do this already.)
Maintaining corner points is no problem - you just set the direction handles to the same coordinates as their anchor.
But I can't nudge a smooth point in the way I want to, which is to move the anchor but maintain the direction handles in exactly the same relation to their anchor as they had before. That is to say, they should remain smooth points.
My script calculates the difference between 'before' and 'after' positions of the anchor, and applies that difference to the direction handles… but in practice the smooth points are converted to corners, because the direction handles don't maintain their relation with the anchor.
var docRef = activeDocument;
var objects = activeDocument.selection.length;
var cShift = prompt("Point shift (pt)",5);
// loop through all objects
for(var count=0;count<objects;count++)
[Code] .....
View 2 Replies
View Related
Jul 25, 2013
I'm trying to write a script that renames a layer, and group within the layer, then an object within the layer (but not a part of the group) and have it run in a loop.
Here's what I've got so far, the group rename doesn't work.
#target Illustrator
var doc = app.activeDocument;
idLayers(doc)//IRename layers
idGroups(doc)//Rename groups
function idLayers(doc){
[code]....
I haven't put in anthing to rename the single object yet since I cant even get the group rename to work. I suspect that the group re-name section isn't working because I'm either using bad syntax or an invalid command.
View 3 Replies
View Related
Jan 17, 2014
I was hoping to create a JS script to move objects away from common center based upon their current position. I was thinking to use a single selected path item as the center based on its position x/y and width/height. Using this reference point the script would then move away all other path items from this center point based on a desired amount and with uniform increments given their current location from this center. I was thinking cos and sin would be my friend in this case, however they seem to have become my foe instead. ;-)
Does this sound doable? What am I missing, doing wrong, misinterpreting? Below is a non-working attempt, I can't seem to sort things out, perhaps I was close and missed it or maybe I am super way off and its more complex than I thought. However at this point I am confused across my various failed attempts this only being one of them.
// Example failed code, nonworking concept
var docID = app.activeDocument;
var s0 = docID.selection[0];
pID = docID.pathItems;
var xn, yn;
var stepNum = 20;
[Code]....
View 13 Replies
View Related
Sep 25, 2012
i can't accurately reposition lines at 1000% zoom. even in preview mode. I tried it in cs5 and it works fine. installed an update in cs6 but still the same.
View 2 Replies
View Related
Nov 6, 2012
Is this a bug? Why can't I reposition the grid lines from the top left corner?
Things are looking wacky. [URL]....
View 2 Replies
View Related
Aug 24, 2012
I'd like to scale, rotate, and/or reposition a pattern-filled Live Paint cell, without cuting the cell from the Live Paint object. Can I do that? I routinely do this in normal objects, using the "~" key trick, but this only seems to work globally, on a Live Paint object (scales all pattern fills, not just one cell).
I'm still using CS5, but am interested to know if it can be done in CS6 as well.
View 1 Replies
View Related
Jun 25, 2012
i am creating a logo for a friend. I have an image that I drew, made transparent and then 3d. I want to save it as a pdf or jpg or png and when I try it, it eliminates the transparency effect.
Below is what it looks like when saved in PDF and any other format.
View 1 Replies
View Related
Jan 22, 2013
I want to translate some English words into Hindi in Illustrator. But almost everytime I do so, the spelling changes to an incorrect one in Hindi. I would like to know how to avoid this. I use google translate first to translater the word, then copy and past the word into Illustrator. I then change the font to Devanagiri Sangam MN so the Hindi characters are displayed instead of the ascii code when pasted.
View 6 Replies
View Related
Aug 21, 2013
How do I resize, rotate and reposition a logo within a Photoshop object using Warp and/or Vanishing Point? This may be a Photoshop question.
View 1 Replies
View Related
Feb 4, 2012
In the map module, I put a selection of pictures on a location, but I didn't find the way to drag the group to adjust the location.
This can be done with an individual picture : see screen cap below.
But it cannot be done with a group.
I tried several usual modifier key (alt, shift...) but all I can do with a group is navigating through the map.
Plus when the thumbnails of the groupe are displayed, one cannot cycle back from the first picture to the last one. See screen cap below :
View 2 Replies
View Related