How to align items (groupItem) with clipping masks?


i have script aligns groupitemtobealigned on 1 layer referencegroupitem on layer, far good. problem comes when groupitemtobealigned consists of items have clipping masks, using

 

 groupitemtobealigned.position = referencegroupitem.position;  

 

doesn't work, it's taking position of everything, what's best method align what's visible ? tried using:

 

 var vbounds = referencegroupitem.visiblebounds; x1 = vbounds[0]; y1 = vbounds[1]; x2 = vbounds[2]; y2 = vbounds[3]; groupitemtobealigned.position = [x1, y1];  

 

produces same results unfortunately.

hello 212dfcascas

 

man, make sure object "clipped" if "true", use coordinates of "pageitems[0]" of him, this:

 

select 2 objects before perform script:

 

 if(app.selection[0].clipped){     var referencegroupitem = app.activedocument.selection[0].pageitems[0];     }else{         var referencegroupitem = app.activedocument.selection[0];         };   if(app.selection[1].clipped){     var groupitemtobealigned = app.activedocument.selection[1].pageitems[0];     }else{         var groupitemtobealigned = app.activedocument.selection[1];         };      var groupitemtobealigned = app.activedocument.selection[1]; var vbounds = referencegroupitem.visiblebounds;   x1 = vbounds[0];   y1 = vbounds[1];   x2 = vbounds[2];   y2 = vbounds[3];   groupitemtobealigned.position = [x1, y1]; 

 

to more informations see post: re: clipping path dimensions

 

i hope helped you.

enjoy



More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!