Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Reflect whole objects

$
0
0

Hi.

 

I need to recreate this as a script:

 

- Select all

- Object > Transform > Reflect

 

I have tried this:

 

if( app.documents.length >0){

 

    // here's the "flip horizontal" magic:

    var totalMatrix = app.getScaleMatrix(-100,100);

 

    // apply the transformation to all art in the document

    var doc = app.activeDocument;

    for( i =0; i < doc.pageItems.length; i++){

        doc.pageItems[i].transform( totalMatrix );

    }

}

 

But it reflects every object in its position, not the whole selection.

So i tried to add all objects to a group, and aply transformation to a group:

 

 

var totalMatrix = app.getScaleMatrix(-100,100);

newGroup = app.activeDocument.groupItems.add();

 

for ( a = 0; a < app.activeDocument.pageItems.length; a++ )

{

          app.activeDocument.pageItems[a].moveToBeginning(newGroup);

}

 

newGroup.transform(totalMatrix);

 

Now all objects are reflecteds as a group, but for some reason, compound paths are lost. All paths appear as a normal paths. (I loose the holes inside pahts)

 

¿How can I solve this?

 

I am using old CS3. ThankYou.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>