• 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. How to get Length of PATH

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 15973
  • 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

How to get Length of PATH

ZULUUU
ZULUUU over 16 years ago

I want to find out the length of a net in Layout.

For ex: if i have straight path, with 2 co-ordinates bigin and end points x=((a b) (a c)), by using car and cadr i got it.

But if the path is having bending the co-ordinate points are more, how can we make use of car and cadr to get the legth.

Or is their any other solution to find out the length of path?

anybody help me i am new to this!!!

 

 Sathisha

  • Cancel
  • skillUser
    skillUser over 16 years ago

     Hi Sathisha,

    I am pasting some code I wrote a while ago that should answer this question for you and help you.

    If you are working with ROD path objects then you can find the length of the path by summing the segments in a similar fashion so I have added a second example for that case.

    I couldn't work out how to attach a file (if it is even possible) so I have pasted the code below.

    Best regards,

    Lawrence.

     

     /* CCSgetPathLength.il

    Group        Custom IC, Cadence Design Systems
    Language    SKILL
    Revision No.    1.2
    Date Created    Jan 09, 2003
    Last Modified    
    Tested in    IC446, IC50
    Lint score    100 (best is 100)
    Description:

    A short procedure to use the currently selected path object and
    sum the length of each of the segments and print the result in
    the CIW.

    If the user has infix turned on and nothing was selected already
    then the current mouse location is used to select an object -
    this assumes that the procedure is run when a bindkey is pressed.

    ***************************************************

    SCCS Info: @(#) CCSgetPathLength.il 02/05/03.13:32:29 1.2

    ********************************************************************
    * 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


    /* CCSgetRodPathLength.il

    Group        Custom IC, Cadence Design Systems
    Language    SKILL
    Revision No.    1.0
    Date Created    Oct 16, 2008
    Last Modified   
    Tested in    IC5141
    Lint score    100 (best is 100)
    Description:

    A function to sum all of the segment lengths of a rod path object.

    Usage:
        ;; obtain a rod object, either by storing the id from a
        ;; created object, or through functions such as rodGetObj,
        ;; rodNameShape or rodGetNamedShapes

        cv = geGetEditCellView()
        => db:207378476

        rodPath = rodGetObj("path0" cv )
        => rodObj:0xcdca024

        CCSgetRodPathLength(rodPath)
        => 6.6

        mapcar('CCSgetRodPathLength rodGetNamedShapes(cv))
        => (8.6 5.6 12.3 5.8 6.6)

    NOTE: If the rod object passed to CCSgetRodPathLength is a rectangle
    or polygon object then the function calculates the perimeter of the
    shape.

    ***************************************************


    ***********************************************************************
    * DISCLAIMER: This code is provided for Cadence customers to use      *
    * with Cadence tools 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 OR IMPLIED WARRANTIES OF             *
    * MERCHANTABILITY, FITNESS FOR A PARTICULAR USE OR NON-INFRINGEMENT.  *
    * © 2008 Cadence Design Systems, Inc. All rights reserved.            *
    ***********************************************************************

    */

    /********************************************************************
    *                                                                   *
    *                  CCSgetRodPathLength( g_rodId )                   *
    *                                                                   *
    * A function to sum all of the segment lengths of a rod path object *
    *                                                                   *
    ********************************************************************/
    procedure(CCSgetRodPathLength(rodId)
      let( (lengths)
        ;; check that the argument is a valid rod object
        when(rodIsObj(rodId)
          ;; obtain a list of lengthX handle names for this path
          ;; where X is an integer
          lengths = setof(handle rodId~>systemHandleNames
        rexMatchp("length[0-9]" handle))
          ;; foreach handle, obtain the handle data (the length)
          ;; and return as a list to apply the "plus" function to.
          ;; The return value of this, and therefore the procedure,
          ;; is the sum of the individual segment lengths
          apply('plus foreach(mapcar length lengths
        rodGetHandle(rodId length))
          ); apply
        ); when
      ); let
    ); procedure CCSgetRodPathLength
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ZULUUU
    ZULUUU over 16 years ago

    Thankyou very much Lawrence, it's working fine.

    This is very much helpful for me.

    thankyou once again

    sathisha 

    • 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