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

Finding bounds of nested clipping paths...

$
0
0

This topic has been touched on before, muppet & sonic have pointed me in the right direction, but I'm stuck right now....

 

Seeing as how "saveMultipleArtboards = false" is broken in CS4, and scripting any kind of epsSave results in the artboard size being the bounding box, I am trying to see if I can find out if the "visible to the eye" bounds of artwork exceed the artboard size.

 

I can easily find non-clipped objects hanging outside the artboard by comparing the document's visible bounds to the artboard size.

Likewise the "visible to the eye" bounds of clipped objects :

 

var docRef = app.activeDocument;

docRef.rulerOrigin = [0,0];

 

////Get size of artboard
var myDocsizeArray = [0,0,docRef.width,docRef.height]

 

////Check for items on page
if(docRef.pageItems.length != 0){

 

/////Find out if top item is clipping mask
if(docRef.pageItems[0].typename == "GroupItem"){
if(docRef.pageItems[0].pathItems[0].clipping == true){

 

////Compare its bounds to doc bounds
var myClipArray = docRef.pageItems[0].pathItems[0].visibleBounds
if((myClipArray[1] >  myDocsizeArray[3]) || (myClipArray[2] >  myDocsizeArray[2]) || (myClipArray[0] < 0) || (myClipArray[3] < 0)){
alert("Outside of artboard")
}        
}
}
}

 

However, this doesn't work if clipping paths are part of a nested groups. Is there a way to see if a clipping path's parent group is within bounds, or parent's parent group etc. is within bounds. I need to find the topmost clipping path that trumps all the others in any nested group.

 

Is that what recursive functions are for? ,,,,,,,,,,,

 

Something that can keep looking in a loop within itself?  Very instrospective!

 

thx


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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