Copy link to clipboard
Copied
hello!
I have a question as in the subject, is it possible to create a script that will be able to distinguish two objects, or groups of objects, if one is turned 180 degrees relative to the other?
In the case of objects different from each other there is no problem, it checks its dimension and when they are different the script knows that they are different objects, but I have a problem in the case when the objects are the same size, but are turned 180 degrees, their size is the same.
Does anyone know how to do this? I even tried to ask openAI, it seemed to write something but in none of the cases was the script able to distinguish this
matrix does not work
sorry for my English, it is basic
please help
Copy link to clipboard
Copied
Bonjour,
Le Tag nommé BBAccumRotation, si rotation il y a donne l'angle de rotation.
Si pas de rotation, ce Tag n'existe pas, si il existe sa valeur indique 0°.
Pour 180°
Tag: (BBAccumRotation , 180.000019847843)
Remarque importante:
Pour que ce script fonctionne, il ne faut pas que l'objet sélectionné ai subit une rotation par script sauf si le script a mis à jour la valeur de ce Tag (Qui est chose rare).
// Find tags of selected art item, show names and values in separate document
// tags.js de elleere
// 05 02 2018
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
if ( doc.selection.length > 0 ) {
sel = selection;
for ( i = 0; i < sel.length; i++ ) {
selectedArt = sel[i];
type = selectedArt.typename;
tagList = selectedArt.tags;
if (tagList.length == 0) {
alert( type+"\rThe selected art has no tags" );
}
else { // Create a document and add a line of text per tag
reportDocument = app.documents.add();
top_offset = 400;
newItem = reportDocument.textFrames.add();
newItem.contents = type+"\r";
newItem.position = [100, top_offset];
for ( k = 0; k < tagList.length; k++ ) {
tagText = tagList[k].value* 180 / Math.PI;
newItem.contents += "Tag: (" + tagList[k].name +
" , " + tagText + ")\r";
}
}
}
}
else { alert( "No art items selected." ); }
}
René
Copy link to clipboard
Copied
I didn't know about tags, good method, but unfortunately it won't be useful for me. I work on files saved outside of Illustrator, so objects unfortunately don't have tags saved.
Copy link to clipboard
Copied
Hi @Majonezowy, it would be good if you can post some demo document with an example of an easy comparison, a "middle difficulty" comparison and "the hardest conceivable" comparison.
I think that the hardest conceivable comparison might be simply a 180° rotated, embedded, raster item that has no BBAccumRotation tag.
That case might actually be challenging.
- Mark
Copy link to clipboard
Copied
I once created a script to insert registration marks into objects. In registration marks each object is numbered. this script is able to distinguish whether an element is the same or not based on its size. When an element is the same but is turned 90 degrees, its size is different (X swapped with Y), so the script knows that these are different elements. I want it to be the same when the object is turned 180 degrees (the script must distinguish these elements not by their size because after turning 180 the size is the same)
Copy link to clipboard
Copied
Bonjour @Majonezowy
Quel est le type de cet objet?
Vous voulez un script spécifique à cet objet?
C'est vous qui les mettez en place dans Illustrator ou cela est déja fait à l'origine?
S'il s'agit d'un groupe:
1 la balise n'est pas créée automatiquement après rotation.
2 il faut se baser sur la position de l'un des éléments du groupe par rapport à la position du groupe [top,left]
René
Copy link to clipboard
Copied
Hi @renél80416020
I need a script not specifically for this object/group of objects. Such groups are very different/have different content.
At first I thought that the script would have to analyze the position of some objects or given points of an object in the group, then compare them to the rest, this is beyond my knowledge and capabilities, besides I do not know if it is not beyond the capabilities of the computer's resources when there are more such objects
I am attaching a screen with sample graphics and layout.
This is a file from the "client". My task is to assign a number to the whole (three digits at the registration mark) and numbering of each object/group of objects. In case the objects are the same, the numbers should also be the same, but when they are turned 180 degrees, they are not the same elements anymore.
Practically 100% of cases are groups. If they are not, I do it manually so that they are.
Copy link to clipboard
Copied
Hi @Majonezowy unfortunately sharing png files does not help us much—can you post a pdf (saved with Illustrator editability)?
If the objects are groups of vector shapes then the task is likely quite easy for a script to determine, by analyzing the group's contents and positions of the contents. For example, a script would easily know that a triangle was different to the same triangle that was 180° rotated, if that is what you want.
- Mark
Copy link to clipboard
Copied
hi @m1b
I am attaching a pdf
EDIT. I added a second example
Copy link to clipboard
Copied
Thank you. We are getting closer! Please make it clear which groups we are comparing and also what the correct answer is for each comparison.
- Mark
Copy link to clipboard
Copied
@m1b I AM SENDING A PDF WITH A MARKING OF WHICH PAGE IS GOOD FOR ME AND WHICH IS BAD
(SORRY FOR MY ENGLISH and caps lock)
As I wrote earlier, I simply want my script for inserting registration marks to be able to recognize when a given group of objects is rotated 180 degrees relative to another one of the same dimension/size and give it a different number even if the original design was saved outside Illustrator and does not have any metadata.