;File : move_label_to_pin_center.il
;Author : ZouJunlin
;Date : 2017/05/21
;Description: move labels to the center of rectangle pins
;step 1 : split object to label & textDisplay list and rectangle pin list
;step 2 : foreach label, select the relative pin
;step 3 : move label to the center of rectangle pin and attach to it
procedure(move_label_to_pin_center()
let((objSet label_list pin_list targetPin x y)
;step 1 : split object to label & textDisplay list and rectangle pin list
bjSet = geGetSelectedSet()
label_list = setof(x objSet x->objType == "label" || x->objType == "textDisplay")
pin_list = setof(x objSet x->objType == "rect")
;step 2 : foreach label, select the relative pin
foreach(x label_list
if(x->objType == "label" then targetPin = car(setof(y pin_list y->pin->term->name == x->theLabel)));end if
if(x->objType == "textDisplay" then targetPin = x->parent);end if
;step 3 : move label to the center of rectangle pin and attach to it
x->xy = centerBox(targetPin->bBox)
leAttachFig(x targetPin)
);end foreach
);end let
);end procedure
hiSetBindKey("Layout" "Ctrl<Key>v" "move_label_to_pin_center()")