0% found this document useful (0 votes)
106 views2 pages

Skill PDF TR Shape Are A

TrShapeArea is a procedure that calculates the area of different shapes, including polygons, rectangles, and paths. It takes an object as input and uses a case statement to determine the object type. For polygons, it calculates the area using coordinates and summing triangular areas. For rectangles, it uses the bounding box coordinates and multiplication. For paths, it calls another procedure TrPathLength to determine path length, and then multiplies by the path width. The procedure returns the calculated area.

Uploaded by

abhishka105
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views2 pages

Skill PDF TR Shape Are A

TrShapeArea is a procedure that calculates the area of different shapes, including polygons, rectangles, and paths. It takes an object as input and uses a case statement to determine the object type. For polygons, it calculates the area using coordinates and summing triangular areas. For rectangles, it uses the bounding box coordinates and multiplication. For paths, it calls another procedure TrPathLength to determine path length, and then multiplies by the path width. The procedure returns the calculated area.

Uploaded by

abhishka105
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TrShapeArea.il /* Function Name Title Author Date Revision SW Release Prerequisites Synopsis Users guide Description gon or path.

*/ procedure( TrShapeArea( @optional ( obj car( geGetSelSet() ) ) ) prog(( newobj sum crd lastPt firstPt crdList area corners ll ur dx dy shape ) case( obj~>objType ( "polygon" crdList = obj~>points sum = 0 firstPt = lastPt = car(crdList) crdList = cdr(crdList) foreach(crd crdList sum = sum + ((xCoord(crd) - xCoord(lastPt)) * (yCoord(crd) + yCoord(lastPt))) lastPt = crd ) ; foreach sum = sum + ((xCoord(firstPt) - xCoord(lastPt)) * (yCoord(firstPt) + yCoord(lastPt))) area = 0.5 * abs(sum) ; polygon area ) ( "rect" corners = obj~>bBox ll = lowerLeft(corners) ur = upperRight(corners) dx = xCoord(ll) - xCoord(ur) dy = yCoord(ll) - yCoord(ur) area = abs( dx * dy ) ; rectangle area ) ( "path" width = obj~>width plength = TrPathLength( obj ) area = width*plength ; path area ) ( nil printf("object is not a polygon, rectangle or path") return( nil ) ; not a valid shape object ) ) ; case return( area ) ; return value => shape area ) ; prog ) ; procedure TrShapeArea : : : : : : : : : :

Page 1 TrShapeArea area measurment for rectangles, polygons and paths Cadence Design Systems, Inc. 05/09/05 1.0 5.1.41 None TrShapeArea( db_object ) => x_area None TrShapeArea( db_object ) returns the area of a rectangle, poly

TrShapeArea.il

Page 2

procedure( TrPathLength( obj ) let( ( dx dy crd1 crd2 crdlist len total ) crdlist = obj~>points crd1 = car( crdlist ) crdlist = cdr( crdlist ) total = 0.0 while( crdlist crd2 = car( crdlist ) dx = car( crd2 ) - car( crd1 ) dy = cadr( crd2 ) - cadr( crd1 ) len = sqrt( dx**2 + dy**2 ) total = total + len crdlist = cdr( crdlist ) crd1 = crd2 ) ; while total ; return value => path length

) ; let ) ; TrPathLength hiSetBindKey( "Layout" "<Key>F8" "println(TrShapeArea())" )

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy