Quantcast
Channel: Cadence Technology Forums
Viewing all articles
Browse latest Browse all 63284

Forum Post: RE: updating code to include pathSeg width for formula calculation.

$
0
0
Thank you Andrew, that was pretty straight forward, however further along in my code, I am getting stuck with the area calculation portion. I added in BOLD my new portion of the code that should cover the pathSeg option, however every time I have a pathSeg selected I get the following warning, "Object must be a Wire, polygon or rectangle" which I also highlighted in BOLD , so it seems to not being recognized as intended. I get (nil)/width in my calculations. Appreciate any help in resolving this, it would be great to get this working with wires and I feel I am only a few steps away from getting it up and running. You guys are always so excellent at pinpointing exactly what the issue is. Thanks. Let me know if you need more info, or the complete code to see the whole picture. Its just very long with lots of pieces, so I figured it was easier to break it down by sections. ;Area calculation (for fig calcs) procedure(AGeomArea(@key (figLength nil) (printLine t) (fig nil)) prog((sSet lyr_name sum crd lastPt firstPt crdList area corners ll ur dx dy shape width endShp diax diay diay radx rady pLength) when(!ALayoutWindowCheck(t) return(nil) ) if(fig == nil then sSet = geGetSelSet( hiGetCurrentWindow()) else sSet = fig ) if( sSet == nil then ADialogs( "error" "A single object must be pre-selected" ) return( nil) ) if( car(sSet)~>type != "geomInst" then ADialogs( "error" "Object must be a Wire, polygon or rectangle" ) return( nil) ) shape = car(sSet)~>shape if(figLength && shape != "path" && shape != "pathSeg" && shape != "rectangle" then ADialogs("error" "Object must be a path or rectangle" ) return(nil) ) lyr_name = techGetLayerName( techGetTechFile(geGetEditCellView()) car(sSet)~>layer) case( shape ("polygon" crdList = car(sSet)~>path sum = 0 firstPt = lastPt = car(crdList) crdList = cdr(crdList) foreach(crd crdList sum = sum + ((xCoord(crd) - xCoord(lastPt)) * (yCoord(crd) + yCoord(lastPt))) lastPt = crd ) sum = sum + ((xCoord(firstPt) - xCoord(lastPt)) * (yCoord(firstPt) + yCoord(lastPt))) area = 0.5 * abs(sum) printf("The area for this %s polygon is: %f\n" lyr_name area) ) ("rectangle" corners = car(sSet)~>bBox ll = car(corners) ur = cadr(corners) dx = xCoord(ll) - xCoord(ur) dy = yCoord(ll) - yCoord(ur) fLength = abs(dx) area = abs( dx * dy ) when(printLine printf("The area for this %s rectangle is: %f\n" lyr_name area) printf("Length: %n\n" abs(dx)) printf("Width: %n\n" abs(dy)) ); when when(figLength return(fLength) ) ) ("path" crdList = car(sSet)~>path width = car(sSet)~>width endShp = car(sSet)~>pathShape if(endShp == "bothArrowEnded" || endShp == "singleArrowEnded" then ADialogs("warning" "Path must have square or octagon ends." ) return(nil) );if if(figLength then if(printLine then printf( "The length for this %s path is: %f\n " lyr_name car(APathArea( crdList width endShp ))) ) pLength = car(APathArea( crdList width endShp )) return(pLength) else area = cadr(APathArea( crdList width endShp )) printf( "The area for this %s path is: %f\n" lyr_name area) printf( "The length for this %s path is: %f\n " lyr_name car(APathArea( crdList width endShp ))) ) ) ( "pathSeg" crdList = car(sSet)~>pathSeg width = car(sSet)~>width endShp = car(sSet)~>pathShape if(endShp == "bothArrowEnded" || endShp == "singleArrowEnded" then ADialogs("warning" "Wire must have square or octagon ends." ) return(nil) );if if(figLength then if(printLine then printf( "The length for this %s wire is: %f\n " lyr_name car(APathArea( crdList width endShp ))) ) pLength = car(APathArea( crdList width endShp )) return(pLength) else area = cadr(APathArea( crdList width endShp )) printf( "The area for this %s wire is: %f\n" lyr_name area) printf( "The length for this %s wire is: %f\n " lyr_name car(APathArea( crdList width endShp ))) ) ) ("ellipse" llBox = caar(sSet~>bBox) urBox = cadar(sSet~>bBox) /* Due to the precision of the database and the accuracy of the conic circle generator, we have some discrepancies especially on large figures that will throw out the x and y calculation to be different on the bBox dimensions. */ diax = round(1000*(xCoord(urBox) - xCoord(llBox) + 0.0005)) diay = round(1000*(yCoord(urBox) - yCoord(llBox) + 0.0005)) if(diax == diay then radx = diax/2000.0 area = 3.14159*radx**2 printf("Area of circle is %f.\n" area) else radx = diax/2000.0 rady = diay/2000.0 area = 3.14159*radx*rady printf("Area of ellipse is %f.\n" area) ) ) ("donut" area = 3.14159*(car(sSet)~>outerRadius**2 - car(sSet)~>innerRadius**2) printf("Area of donut is %f.\n" area) ) );case return(area) ); prog ); proc

Viewing all articles
Browse latest Browse all 63284

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>