forked from ebecheto/Skill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbBox_lpp_check.il
85 lines (70 loc) · 2.72 KB
/
bBox_lpp_check.il
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
;copyleft ebecheto
ineed('pointInbBox)
defun(bBox_lpp_check (@optional (lpp '("METAL1" "pin")) (bBox css()~>bBox) (cv css()~>cellView) (debug nil))
let((flag objs checks egal verb)
unless(cv cv=css()~>cellView)
unless(lpp lpp='("METAL1" "pin"))
;unless(bBox '((-13.685 -4.005) (-13.455 -3.29)))
; setof(s cv~>shapes s~>objType=="rect")~>bBox
objs=setof(s cv~>shapes s~>objType=="rect")
when(verb printf("[SETOF OBJ BEGIN] : %L %L [SETOF OBJ END]\n" objs~>lpp objs~>bBox))
checks=foreach(mapcar fig objs
egal=and(fig~>lpp==lpp pointInbBox(fig~>bBox bBox))
when(egal flag=t) egal
)
if(debug checks flag)
)
)
;; ;; USAGE :
;; foreach(mapcar inst geGetWindowCellView()~>instances
;; bBox_lpp_check(inst~>lpp inst~>bBox geGetWindowCellView()))
;; defun(bBox_lpp_checks (@optional (lpp '("METAL1" "pin")) (bBox css()~>bBox) (cv css()~>cellView) (debug nil))
;; let((flag objs checks egal)
;; unless(cv css()~>cellView)
;; unless(lpp lpp='("METAL1" "pin"))
;; unless(bBox '((-13.685 -4.005) (-13.455 -3.29)))
;; objs=setof(s cv~>shapes s~>objType=="rect")
;; foreach(mapcar fig objs printf("%L\n" list(fig~>lpp lpp fig~>bBox bBox fig~>bBox==bBox pointInbBox(fig~>bBox bBox))))
;; ))
;; rounding issue ??
;; TODO : if centerBox is include in the bounding box => pass
;; bBox='((-6.325 -4.41) (-6.115 -2.15))
;; point=centerBox(bBox)
;; ;=> (-6.22 -3.28)
;; ineed('pointInbBox)
;; fig~>bBox;=> ((2.315 -4.005) (2.545 -3.29))
;; centerBox(fig~>bBox);=> (2.43 -3.6475)
;; pointInbBox(centerBox(fig~>bBox) bBox)
; ineed('flatten)
;; defun(bBox_lpp_check2 (@optional (lpp '("METAL1" "pin")) (bBox css()~>bBox) (cv css()~>cellView))
;; let((objs)
;; unless(bBox '((-13.685 -4.005) (-13.455 -3.29)))
;; ;; bBox;=> ((-13.685 -4.005) (-13.455 -3.29))
;; ;; lpp;=> ("METAL1" "pin")
;; ;; lpp== '("METAL1" "pin");=> t
;; ;; lpp== '("METAL2" "pin");=> nil
;; ;;cv~>conns~>term~>pins~>figs~>??
;; ;;fig=caaar(cv~>conns~>term~>pins~>figs);=> db:0x2e6ce6a0
;; ;;objs=flatten(cv~>conns~>term~>pins~>figs)
;; setof(s cv~>shapes s~>objType=="rect")~>bBox
;; objs=setof(s cv~>shapes s~>objType=="rect")
;; ;; obj=car(objs)
;; ;; obj~>lpp
;; ;; obj~>bBox
;; car(remove(nil foreach(mapcan fig objs
;; ; fig~>bBox;=> ((2.315 -4.005) (2.545 -3.29))
;; ; fig~>lpp;=> ("METAL1" "pin")
;; list(and(fig~>lpp==lpp fig~>bBox==bBox))))
;; )))
;; ;select rectangle pin in layout and try
;; unless(bBox_lpp_check() printf("no pins here. OK?!"))
;; cv~>conns~>term~>??
;; cv~>conns~>term~>name
;; cv~>conns~>term~>pins~>fig~>??
;; setof(s cv~>shapes s~>objType=="rect")~>bBox
;; (setq bBox css()~>bBox)
;; foreach(mapcar bb objs~>bBox bb=='((-13.685 -4.005) (-13.455 -3.29)))
;; foreach(mapcar bb objs~>lpp bb==lpp)
;; lpp='("METAL1" "pin")
;; bBox='((-6.325 -4.41) (-6.115 -2.15)))
;; bBox_lpp_checks(lpp bBox)