Skill PDF TR Shape Are A
Skill PDF TR Shape Are A
*/ 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