TA的每日心情 | 慵懒 2025-8-25 15:23 |
---|
签到天数: 85 天 [LV.6]常住居民II
|
仅供参考- axlCmdRegister("csa" 'dbCheckSymbolArea)
, _, S$ u+ I' o7 W: ? - % ?0 J. y, T7 |/ @0 e
- ;; How to use
$ g# C" p2 C! Z* u$ P. O - ;; skill load "test_calc.il"
- d! D5 b4 x. i9 d - ;; csa
# q& \. N" X: a/ i2 F
( Z; ?$ ~4 Q* F0 S7 ]) K- procedure( dbCheckSymbolArea()( A* S' N; e$ U) O
- let( (plcbnd area (sumPlc 0) shapeOutline sumOutline), F% e( D& B, L2 `, C
- 6 Q% F) {1 D* v
- ;;calc area of placebound of top symbols8 H. b/ c' M, a4 H' |& P1 D; ~
- foreach(i axlDBGetDesign()->components# a" ~" w; s) N+ J1 {
- when(i->symbol && i->symbol->layer == "TOP"
$ h- D. i8 o5 L" p4 m - ;;get shape of placebound$ c" V( a+ P& b* u
- plcbnd = car(setof(x i->symbol->children (x->objType == "shape" && index(x->layer "PACKAGE GEOMETRY/PLACE_BOUND_"))))7 _$ ^. T2 G/ ^2 ], w, A7 n
- when(plcbnd
5 ~: ]( @6 g: ]: K9 [ - ;;change to poly' J& X' {3 K- E3 y, P9 [
- area = car(axlPolyFromDB(plcbnd ?layer plcbnd->layer))->area
2 g) e- i0 }1 f; A( ^' m - ;;add6 I& f' m, K2 a8 g/ j8 m
- sumPlc = sumPlc + area1 L% w: M, }5 \8 r: |/ V
- )& n+ ]) k7 Z# _: {$ ?7 _! A8 H$ b0 g/ B
- )2 z3 W& k: x8 v: s
- )
Z: | b* S6 Z) g - / \8 e9 s0 x0 b, |$ @6 K5 v
- ;;calc area of outline+ Y: u5 z8 u0 V
- shapeOutline = axlDBGetShapes("BOARD GEOMETRY/OUTLINE") || axlDBGetShapes("BOARD GEOMETRY/DESIGN_OUTLINE")
! v( D; {, t8 e; V6 r5 x z2 I - sumOutline = car(axlPolyFromDB(car(shapeOutline) ?layer shapeOutline->layer))->area
/ f$ e5 x/ z& I: t- A4 p" m: i2 ]' \ - 2 l$ b' i) r2 e. G9 C4 {
- ;;calc percentage
8 ]* L) v+ l, I3 t5 ] - result = sumPlc * 100.0 / sumOutline 9 N' \% ~6 g! h5 h# T
- printf("Placebound Area = %.2f\nOutline Area = %.2f\nPercentage = %.2f%%\n" sumPlc sumOutline result)1 f; S7 j! ]7 i0 w, a
- axlUIConfirm(sprintf(nil "Placebound Area = %.2f\nOutline Area = %.2f\nPercentage = %.2f%%\n" sumPlc sumOutline result))! ~: {" D' N) S2 ?6 R" s
- ))
复制代码 1 [) ?& j& }3 X) Z6 R T
. R& H- [% ]; x4 D* J1 ~ |
|