Home > Community > Forums > Custom IC SKILL > Finding the area of a rectilinear layout block

## Email

Recipients email * (separate multiple addresses with commas)

Message *

 Send yourself a copy

## Subscribe

Intro copy of the newsletter section here, some intro copy of the newsletter. Instruction of how to subscribe to this newsletter.

First Name *

Last Name *

Email *

Company / Institution *

 Send Yourself A Copy

# Finding the area of a rectilinear layout block

Last post Sun, Feb 5 2012 9:26 PM by Sri Charan B. 7 replies.
 Started by Sri Charan B 01 Feb 2012 09:52 AM. Topic has 7 replies and 2901 views
• #### Wed, Feb 1 2012 9:52 AM

• Sri Charan B
• Joined on Wed, Feb 1 2012
• Posts 14
• Points 220
Finding the area of a rectilinear layout block
 Hi, I am new to this forum and i have started my career as a layout designer recently. Iam trying to develop a skill code which gives me the area of a block irrespective of the pdk or technology used. By using the "bBox" command i am able to get half of my work done. But the problem i am facing is if any space inside the block is left empty even that area is also counted. So i want to eliminate the unused space and get the area of space which is used. Can please someone help me with this and guide me to correct procedure if my approach is wrong. Thanks in advance for help Sri Charan
• Post Points: 20
• #### Thu, Feb 2 2012 4:37 AM

• lawlag02
• Joined on Mon, Jan 24 2011
• Posts 16
• Points 275
Re: Finding the area of a rectilinear layout block
 Hi Sri,Google the topic "Area of Polygon" or "shoelace formula", it will point you to the right direction. In theory, Any shape in a cartesian plane, given the coordinates of all vertices, The area can be calculated.regards, lrlsk
• Post Points: 20
• #### Thu, Feb 2 2012 4:50 AM

Re: Finding the area of a rectilinear layout block
 This function can be used to find the area of a polygon or rectangle. Not sure if that's exactly what is wanted here though:```/*************************************************************** * * * (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))```
• Post Points: 20
• #### Fri, Feb 3 2012 5:05 AM

• Sri Charan B
• Joined on Wed, Feb 1 2012
• Posts 14
• Points 220
Re: Finding the area of a rectilinear layout block
 Thank you guys.Andrew this code is working in the manner i wanted to. I tried a lot with all the possible ways i knew to convert the obtained values into microns but i can't get it. Is there a possiblity to convert the values to microns? Thanks in advance for any help Sri Charan
• Post Points: 20
• #### Fri, Feb 3 2012 5:39 AM

Re: Finding the area of a rectilinear layout block
 I assume you don't really mean microns, given that area can't be in microns. You either mean square microns or maybe square metres? Assuming that your user units in the layout are in microns (which would usually be the case) - the coordinate display in the tool should read out 1um as 1 - then the result of abArea will be in square microns. If you want it in square metres, you'd just multiply the result by 1e-12.Regards,Andrew.
• Post Points: 20
• #### Fri, Feb 3 2012 8:50 AM

• Sri Charan B
• Joined on Wed, Feb 1 2012
• Posts 14
• Points 220
Re: Finding the area of a rectilinear layout block
 Yes you are correct. I was talking about the area in square microns. That will be a choice of getting the area but can we directly get the output without this multiplication at the end after getting the result. Thank you for your help Sri Charan
• Post Points: 20
• #### Fri, Feb 3 2012 10:26 AM

Re: Finding the area of a rectilinear layout block
 As I said, unless something is unusual, the user units in your layout would typically be in microns (that's certainly the default, and I've not come across many people changing that default), and hence the area returned by abArea will be in square microns, and so would not need any multiplication.Even if you wanted it in some other units, what's so difficult about doing the multiplication? It's a programming language after all - all you would need to do is:procedure(abAreaInSquareMetres(obj)  abArea(obj)*1e-12)and then use abAreaInSquareMetres instead. Or change the abArea code to include the multiplication.I don't understand why that's a problem for you?Andrew.
• Post Points: 20
• #### Sun, Feb 5 2012 9:26 PM

• Sri Charan B
• Joined on Wed, Feb 1 2012