Home > Community > Forums > Custom IC SKILL > How to get Length of PATH

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to get Length of PATH  

Last post Fri, Nov 14 2008 1:13 AM by ZULUUU. 2 replies.
Started by ZULUUU 13 Nov 2008 07:59 PM. Topic has 2 replies and 1805 views
Page 1 of 1 (3 items)
Sort Posts:
  • Thu, Nov 13 2008 7:59 PM

    • ZULUUU
    • Not Ranked
    • Joined on Wed, Nov 12 2008
    • Posts 2
    • Points 25
    How to get Length of PATH Reply

    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

    • Post Points: 20
  • Thu, Nov 13 2008 9:48 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,598
    • Points 16,075
    Re: How to get Length of PATH Reply

     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
     

    • Post Points: 20
  • Fri, Nov 14 2008 1:13 AM

    • ZULUUU
    • Not Ranked
    • Joined on Wed, Nov 12 2008
    • Posts 2
    • Points 25
    Re: How to get Length of PATH Reply

    Thankyou very much Lawrence, it's working fine.

    This is very much helpful for me.

    thankyou once again

    sathisha 

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by ZULUUU at 13 Nov 2008 07:59 PM. Topic has 2 replies.