| |
hiSetBindKey("layout" "<Key>5" "LineAndVia()")
procedure(findx()
prog((obj obj1)
obj = geGetSortedSelectByLine()
obj1 = geGetSortedSelectByLine()
return(list(obj obj1)) ;已修改
)
)
procedure(conline(list1 list2 dir)
let((s1 s2 w1 w2 a b c d s1b s1e s2b s2e tt tt2 area) ;已修改,删掉了dir
x = length(list1)
while(x>0
s1 = car(nth(x-1 list1))
s2 = car(nth(x-1 list2))
w1 = s1~>width/2
w2 = s1~>width/2
a = caar(nth(0 list1)~>beginPt)
b = caar(nth(x-1 list1)~>beginPt)
c = cadar(nth(0 list2)~>beginPt)
d = cadar(nth(x-1 list2)~>beginPt)
cond(
((b-a)*(d-c)>0 tt = 1)
((b-a)*(d-c)<0 tt = 0)
)
s1b = s1~>beginPt s1e = s1~>endPt
s2b = s1~>beginPt s2e = s1~>endPt
cond(
(dir == "7"
when(cadr(s1b) - cadr(s1e) < 0
dbSetPathSegPoints(s1 s1e s1b)
)
when(car(s2b) - car(s2e) < 0
dbSetPathSegPoints(s2 s2e s2b)
)
s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) + w2)
s2~>beginPt = list(car(s1~>beginPt) + w1 cadr(s2~>beginPt))
area = list(
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
)
tt = abs(tt-1)
CreatVia(area tt2)
)
(dir == "F"
when(cadr(s1b) - cadr(s1e) < 0
dbSetPathSegPoints(s1 s1e s1b)
)
when(car(s2b) - car(s2e) > 0
dbSetPathSegPoints(s2 s2e s2b)
)
s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) + w2)
s2~>beginPt = list(car(s1~>beginPt) - w1 cadr(s2~>beginPt))
area = list(
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
)
tt2 = abs(tt-1)
CreatVia(area tt2)
)
(dir == "J"
when(cadr(s1b) - cadr(s1e) > 0
dbSetPathSegPoints(s1 s1e s1b)
)
when(car(s2b) - car(s2e) < 0
dbSetPathSegPoints(s2 s2e s2b)
)
s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) - w2)
s2~>beginPt = list(car(s1~>beginPt) + w1 cadr(s2~>beginPt))
area = list(
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
)
CreatVia(area tt)
)
(dir == "L"
when(cadr(s1b) - cadr(s1e) > 0
dbSetPathSegPoints(s1 s1e s1b)
)
when(car(s2b) - car(s2e)
dbSetPathSegPoints(s2 s2e s2b)
)
s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) - w2) ;已修改
s2~>beginPt = list(car(s1~>beginPt) - w1 cadr(s2~>beginPt))
area = list(
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
)
CreatVia(area tt)
)
)
x = x - 1
)
)
) ;这里加了一个括号
procedure(CreatVia(listin t1)
let((techFile constraintGroupId myViaOptions) ;已修改,删掉了t1
cond(
(t1 == 0 t2 = "centerRight")
(t1 == 1 t2 = "centerLeft")
)
techFile = techGetTechFile(geGetEditRep())
constraintGroupId = cstFindConstraintGroupIn(techFile "virtuosoDefaultSetup") ;已修改,函数名为cstFindConstraintGroupIn
myViaOptions = viaGetViaOptions(constraintGroupId)
myViaOptions~>automatic~>viaAlignment = t2
myViaOptions~>automatic~>minNuMCUts = 2
myViaOptions~>createInRoute = nil
myViaOptions~>automatic~>preventDRCWithNeighbors = nil
myViaOptions~>automatic~>cutBBoxOrientation = "horizontal"
viaGenerateViasInArea(deGetCellView() listin myViaOptions)
)
)
procedure(LineAndVia()
let((selid sel1 sel2 sel1lx sel1ly sel1rx sel1ry sel2lx sel2ly sel2rx sel2ry dir)
selid = findx()
sel1 = car(selid)
sel2 = cadr(selid)
if(length(sel1) != length(sel2)
then
printf("chong xin xuan ze !")
else
when(caar(car(sel1)~>beginPt) != caar(car(sel1)~>endPt)
sel1 = cadr(selid)
sel2 = car(selid)
)
sel1lx = caar(car(car(sel1)~>bBox)) sel1ly = cadar(car(car(sel1)~>bBox))
sel1rx = caadr(car(car(sel1)~>bBox)) sel1ry = cadadr(car(car(sel1)~>bBox))
sel2lx = caar(car(car(sel2)~>bBox)) sel2ly = cadar(car(car(sel2)~>bBox))
sel2rx = caadr(car(car(sel2)~>bBox)) sel2ry = cadadr(car(car(sel2)~>bBox))
cond(
((sel2rx + sel2lx)/2 < sel1lx && sel2ly > (sel1ry + sel1ly)/2
dir = "7"
conline(sel1 sel2 dir)
)
((sel2rx + sel2lx)/2 > sel1rx && sel2ly > (sel1ry + sel1ly)/2
dir = "F"
conline(sel1 sel2 dir)
)
((sel2rx + sel2lx)/2 < sel1lx && sel2ry < (sel1ry + sel1ly)/2
dir = "J"
conline(sel1 sel2 dir)
)
((sel2rx + sel2lx)/2 > sel1rx && sel2ry < (sel1ry + sel1ly)/2
dir = "L"
conline(sel1 sel2 dir)
)
)
)
)
)
/2