• 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. Skill code for calculating length of a path with bends

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 144
  • Views 17533
  • 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

Skill code for calculating length of a path with bends

Zebib
Zebib over 15 years ago

 I am trying to calculate the length of a given path with many bends using a skill code.

Thanks 

  • Cancel
Parents
  • skillUser
    skillUser over 15 years ago

     Hi Zebib,

    There is an existing Solution 11422112 that may help with what you are asking.

    Alternatively, here is another (more simplistic) SKILL example that I wrote:

    
    ********************************************************************
    * DISCLAIMER: The following code is provided for Cadence customers *
    * to use at their own risk. The code may require modification to *
    * satisfy the requirements of any user. The code and any *
    * modifications to the code may not be compatible with current or *
    * future versions of Cadence products. *
    * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING *
    * WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES *
    * OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. *
    ********************************************************************
    */
    /***************************************************************
    * *
    * CCSgetPathLength() *
    * Uses the selected object, if no object is selected then the *
    * current mouse pointer location is used (if infix is on). If *
    * the object is a path then iterate over the points and sum *
    * the length of each segment (works for 45 degree segments). *
    * Prints the summed length of the selected path in the CIW. *
    * *
    ***************************************************************/
    procedure(CCSgetPathLength(@optional (obj car(geGetSelectedSet())) silent )
    let((prevpt x y (length 0.0))
    ;; if no object is selected, and infix is turned on, then
    ;; use the current mouse location to select the object.
    ;; This is for use with a bindkey, i.e. it is set to run
    ;; this procedure when a key is pressed.
    unless(obj
    when(hiGetCIWindow()->infix
    geSelectPoint(nil enterPoint())
    obj = car(geGetSelectedSet())
    )
    )
    ;; when the selected object is a path object, iterate
    ;; over the list of points and sum the length. This
    ;; assumes orthogonal or 45 degree segments only.
    when(obj~>objType == "path"
    foreach(pt obj~>points
    ;; operate on pairs of points, if no previous point
    ;; then set it to be the same as the first and use
    ;; it in the next iteration.
    if(!prevpt then
    ;; initialise prevpt to be the first point
    prevpt=pt
    else
    ;; for simplicity keep the calculation the same
    ;; regardless of which direction the segment is
    ;; oriented. One of x or y will be 0 unless the
    ;; path segment is not horizontal or vertical.
    x=abs(car(pt) - car(prevpt))
    y=abs(cadr(pt)-cadr(prevpt))
    length = length + sqrt(expt(x 2) + expt(y 2))
    prevpt=pt
    )
    );; foreach
    ;; print the summed length to the CIW, length will
    ;; have a value as it was initialised as 0.0
    unless(silent
    printf("Path length: %5.2f\n" length)
    )
    ;; return the length calculated
    length
    );; when selected object is a path
    );; let
    );; procedure CCSgetPathLength

    The above code only calculates the length of a path object type (i.e. OA 'pathSegs' are not considered) and does not consider any layer change or overlaps (or non flush end-types) , but hopefully it is helpfulto you.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • skillUser
    skillUser over 15 years ago

     Hi Zebib,

    There is an existing Solution 11422112 that may help with what you are asking.

    Alternatively, here is another (more simplistic) SKILL example that I wrote:

    
    ********************************************************************
    * DISCLAIMER: The following code is provided for Cadence customers *
    * to use at their own risk. The code may require modification to *
    * satisfy the requirements of any user. The code and any *
    * modifications to the code may not be compatible with current or *
    * future versions of Cadence products. *
    * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING *
    * WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES *
    * OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. *
    ********************************************************************
    */
    /***************************************************************
    * *
    * CCSgetPathLength() *
    * Uses the selected object, if no object is selected then the *
    * current mouse pointer location is used (if infix is on). If *
    * the object is a path then iterate over the points and sum *
    * the length of each segment (works for 45 degree segments). *
    * Prints the summed length of the selected path in the CIW. *
    * *
    ***************************************************************/
    procedure(CCSgetPathLength(@optional (obj car(geGetSelectedSet())) silent )
    let((prevpt x y (length 0.0))
    ;; if no object is selected, and infix is turned on, then
    ;; use the current mouse location to select the object.
    ;; This is for use with a bindkey, i.e. it is set to run
    ;; this procedure when a key is pressed.
    unless(obj
    when(hiGetCIWindow()->infix
    geSelectPoint(nil enterPoint())
    obj = car(geGetSelectedSet())
    )
    )
    ;; when the selected object is a path object, iterate
    ;; over the list of points and sum the length. This
    ;; assumes orthogonal or 45 degree segments only.
    when(obj~>objType == "path"
    foreach(pt obj~>points
    ;; operate on pairs of points, if no previous point
    ;; then set it to be the same as the first and use
    ;; it in the next iteration.
    if(!prevpt then
    ;; initialise prevpt to be the first point
    prevpt=pt
    else
    ;; for simplicity keep the calculation the same
    ;; regardless of which direction the segment is
    ;; oriented. One of x or y will be 0 unless the
    ;; path segment is not horizontal or vertical.
    x=abs(car(pt) - car(prevpt))
    y=abs(cadr(pt)-cadr(prevpt))
    length = length + sqrt(expt(x 2) + expt(y 2))
    prevpt=pt
    )
    );; foreach
    ;; print the summed length to the CIW, length will
    ;; have a value as it was initialised as 0.0
    unless(silent
    printf("Path length: %5.2f\n" length)
    )
    ;; return the length calculated
    length
    );; when selected object is a path
    );; let
    );; procedure CCSgetPathLength

    The above code only calculates the length of a path object type (i.e. OA 'pathSegs' are not considered) and does not consider any layer change or overlaps (or non flush end-types) , but hopefully it is helpfulto you.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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