Quantcast
Channel: Cadence Technology Forums
Viewing all articles
Browse latest Browse all 63300

Forum Post: RE: Sort function to sort the paths selected using the bbox or beginpt or end pt

$
0
0
Hi Nirmal, The question really falls down to how would you determine the order? If you have a list of objects, you can use the sort() function with the second argument being a function to compare two objects to determine whether one is less than the other - what "less than" means when comparing two bounding boxes is rather open to interpretation since you have four numbers that come into the equation. Assuming that you have a list of pathSegs (rather than paths), then something like this would work (I made this sort based on the beginPt, first point in a point list or lowerLeft of the bounding box): procedure(CCFcompareBeginPt(a b) let((aPt bPt) aPt=a~>beginPt || car(a~>points) || lowerLeft(a~>bBox) bPt=b~>beginPt || car(b~>points) || lowerLeft(b~>bBox) ; check that either x is less, or if x equal, y is less cond( (!aPt || !bPt nil) ; check we have a point first (xCoord(aPt)<xCoord(bPt) t) (xCoord(aPt)==xCoord(bPt) && yCoord(aPt)<yCoord(bPt) t) (t nil) ) ) ) Then you can use (say the objects were selected): sortedObjs=sort(geGetSelSet() 'CCFcompareBeginPt) Andrew

Viewing all articles
Browse latest Browse all 63300


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