• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. problem with sorting

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 13680
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with sorting

Aritra
Aritra over 14 years ago

Hi,

   I want to sort some 2 points paths according to their x or y co-ordinates . The input to the procedure will be the database id of the paths and the outputs will also be the database id of the sorted paths. 

  The resulting operation will give me the paths from left to right or top to bottom. I am tring to use sort() function but I am unable to get the currect syntax for using it.

Please help me with it.

  • Cancel
  • Slayer
    Slayer over 14 years ago

    for example to sort by Y-coordinate if u need sort which pass upper the other:

     l_pathList = sort(l_pathList lambda((a b) cadadr(a~>bBox) > cadadr(b~>bBox)));

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • kb how
    kb how over 14 years ago

    I create a simple function to sort paths from left to right, this is only a scratch work, you may need to modify it to suit your request.

    procedure( sortPath( @key (pathIds geGetSelSet()))
     let(()
      sort( pathIds lambda((a b) lessp(leftEdge(a~>bBox) leftEdge(b~>bBox))))
     )
    )

    This will return the selected paths and sort it from left to right. You may try to sort it using the startPt or endPt rather than using bBox.

    -How- 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Aritra
    Aritra over 14 years ago
    Hi,
        I have solved the problem by using the following line: 
    horz_path_list=sort(horz_path_list lambda((a b) yCoord(car(a~>points)) < yCoord(cadr(b~>points))))
        Thanks Slayer, how for the assist.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information