• 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. Old Skill Code for finding area of polygon/rectangle is...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 2699
  • 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

Old Skill Code for finding area of polygon/rectangle is not working

94d33m
94d33m over 4 years ago

It says " *Error* abArea: too few arguments (1 expected, 0 given) - nil " in the log. I had selected the rectangle then pressed the bindkey with the abArea function.

This is where I got the skill code from ( Code by Andrew Beckett ):

https://community.cadence.com/cadence_technology_forums/f/custom-ic-design/21797/area-calculation-from-layout-in-cadence-6-1-4/1341614#1341614

/***************************************************************
*                                                              *
*                       (abArea object)                        *
*                                                              *
*               Calculate the area of an object.               *
*      Currently only works with polygons and rectangles.      *
*                                                              *
***************************************************************/

(procedure (abArea object)
  (let (sum crd lastPt firstPt crdList area corners ll ur dx dy objType)
        (setq objType (dbGetq object objType))
        (if (equal objType "polygon") 
            (progn
             (setq crdList (dbGetq object points))
             (setq sum 0)
             (setq firstPt (setq lastPt (car crdList)))
             (setq crdList (cdr crdList))
             (foreach crd crdList
                      (setq dx (difference (xCoord crd) (xCoord lastPt)))
                      (setq sum (plus sum (times dx (plus (yCoord crd) (yCoord lastPt)))))
                      (setq lastPt crd))
             (setq sum (plus sum
                             (times (difference (xCoord firstPt) (xCoord lastPt))
                                    (plus (yCoord firstPt) (yCoord lastPt)))))
             (setq area (times 0.5 (abs sum))))
            (when (equal objType "rect") 
                  (setq corners (dbGetq object bBox))
                  (setq ll (car corners))
                  (setq ur (cadr corners))
                  (setq dx (difference (xCoord ll) (xCoord ur)))
                  (setq dy (difference (yCoord ll) (yCoord ur)))
                  (setq area (abs (times dx dy))))
            )
       area))
  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    The issue is not with the code, but how you're using it. You probably need to have your bindkey be something like:

    println(abArea(car(geGetSelSet())))

    It will then print the area of the first selected object in the CIW.

    The function itself is simply a function to return the area of a given database object (assuming that object is a rectangle or a polygon). There's nothing in the code as provided to use the selected object. or display the result somewhere - you'd have to do that yourself.

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • 94d33m
    94d33m over 4 years ago in reply to Andrew Beckett

    Thanks Andrew! Works great! I have 3 questions:

    1) What is the unit of the area that shows in window?

    2) Possible to embed the println inside the skill code itself? At which line?

    3) Where do I start learning about skill codes( from beginning), are there any resources available?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to 94d33m
    1. It's in micron2.
    2. I really don't like general purpose functions which can be used by other programs which simply need the answer also printing out stuff - because then you might get a flood of unwanted information. You could simply insert a line with println(area) just before the very last line area)), but better would be to create yourself a new additional function:
      procedure(abAreaOfObject(@optional (object car(geGetSelSet())))
        println(abArea(object))
      )
      Then you can just call abAreaOfObject() and it will print the area of the selected object.
    3. There's the SKILL Language User Guide in the documentation (which can find by running cdnshelp or using the Help menu in Virtuoso, or looking at <ICinstDir>/doc/sklanguser/sklanguser.pdf), but also on Cadence Online Support you can go to Learning->Online Courses and then search for "SKILL Language". These are free online training courses, and there's both the SKILL Language Programming course and a shorter SKILL Language Programming introduction (the latter is really just the first part of the full class).
    • Cancel
    • Vote Up +1 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