| ||
hiSetBindKey("Layout" "Ctrl<Btn3Down>" "xiubian()")
procedure(xiubian()
winid=hiGetCurrentWindow()
hiSetCurrentWindow(winid)
cv=geGetEditCellView()
a=envGetVal( "graphic" "dimmingOn" )
/*store the value of original dimmingOn value to "a"*/
VerOrHor()
Sequencing(object_Heng object_Shu)
boolOverlap(object_Heng object_Shu)
y1Shu=cadr(car(pointsShu))
y2Shu=cadr(cadr(pointsShu))
yMaxShu=max(y1Shu y2Shu)
yMinShu=min(y1Shu y2Shu)
x1Heng=car(car(pointsHeng))
x2Heng=car(cadr(pointsHeng))
xMaxHeng=max(x1Heng x2Heng)
xMinHeng=min(x1Heng x2Heng)
xShu=car(car(pointsShu))
yHeng=cadr(car(pointsHeng))
z=hiGetPoint(winid)
x=car(z)
y=cadr(z)
cond(
(car(z)>caadr(OverlapArea)&&cadr(z)>cadadr(OverlapArea)
cutRight(OverlapArea)
cutTop(OverlapArea)
);case1 the first quadrant
(car(z)<caar(OverlapArea)&&cadr(z)>cadadr(OverlapArea)
cutLeft(OverlapArea)
cutTop(OverlapArea)
);case2 the second quadrant
(car(z)<caar(OverlapArea)&&cadr(z)<cadar(OverlapArea)
cutLeft(OverlapArea)
cutButtom(OverlapArea)
);case3 the Third quadrant
(car(z)>caadr(OverlapArea)&&cadr(z)<cadar(OverlapArea)
cutRight(OverlapArea)
cutButtom(OverlapArea)
);case4 the Fourth quadrant
(car(z)<caadr(OverlapArea)&&cadr(z)>cadadr(OverlapArea)&&car(z)>caar(OverlapArea)
cutTop(OverlapArea)
);case5 cutTop
(car(z)<caadr(OverlapArea)&&cadr(z)<cadar(OverlapArea)&&car(z)>caar(OverlapArea)
cutButtom(OverlapArea)
);case6 Buttom
(car(z)<caar(OverlapArea)&&cadr(z)>cadar(OverlapArea)&&cadr(z)<cadadr(OverlapArea)
cutLeft(OverlapArea)
);case7 cutleft
(car(z)>caadr(OverlapArea)&&cadr(z)>cadar(OverlapArea)&&cadr(z)<cadadr(OverlapArea)
cutRight(OverlapArea)
);case8 cutright
);cond
printf("%L\n" z)
);procedure
procedure(VerOrHor()
/*analyse which is vertical,which is horizontal*/
object_List=geGetSelSet()
objectA=car(object_List)
widthA=objectA~>width
layerA=objectA~>layerName
pointsA1=objectA~>beginPt
pointsA2=objectA~>endPt
pointsA=list(pointsA1 pointsA2)
objectB=cadr(object_List)
widthB=objectB~>width
layerB=objectB~>layerName
pointsB1=objectB~>beginPt
pointsB2=objectB~>endPt
pointsB=list(pointsB1 pointsB2)
if(caar(pointsA)==caadr(pointsA) then
pointsShu=pointsA
widthShu=widthA
object_Shu=objectA
pointsHeng=pointsB
widthHeng=widthB
object_Heng=objectB
printf("heng is B(%s) ,shu is A(%s)\n" layerB layerA)
else
pointsShu=pointsB
widthShu=widthB
object_Shu=objectB
pointsHeng=pointsA
widthHeng=widthA
object_Heng=objectA
printf("heng is A(%s) ,shu is B(%s)\n" layerA layerB)
);if
/***********************************************/
);procedure
procedure(boolOverlap(object_Heng object_Shu)
bBoxHeng=object_Heng~>bBox
bBoxShu=object_Shu~>bBox
if(caar(bBoxShu)>=caar(bBoxHeng)&&caadr(bBoxShu)<=caadr(bBoxHeng)
then bool1=1
else bool1=0
);if
if(cadadr(bBoxHeng)<=cadadr(bBoxShu)&&cadar(bBoxHeng)>=cadar(bBoxShu)
then bool2=1
else bool2=0
);if
if(bool1==1&&bool2==1
then bool0=1
printf("There is exist overlap area\n")
else bool0=0
printf("There is no overlap area\n")
);if
OverlapArea=list(list(caar(bBoxShu) cadar(bBoxHeng)) list(caadr(bBoxShu) cadadr(bBoxHeng)))
printf("OverlapArea is %L" OverlapArea)
);procedure
procedure(cutLeft(OverlapArea)
center=caar(OverlapArea)
leftBePt=list(center yHeng)
leftEndPt=list(xMaxHeng yHeng)
object_Heng~>beginPt=leftBePt
object_Heng~>endPt=leftEndPt
);procedure
procedure(cutRight(OverlapArea)
center=caadr(OverlapArea)
leftBePt=list(xMinHeng yHeng)
leftEndPt=list(center yHeng)
object_Heng~>beginPt=leftBePt
object_Heng~>endPt=leftEndPt
);procedure
procedure(cutTop(OverlapArea)
center=cadadr(OverlapArea)
leftBePt=list(xShu yMinShu)
leftEndPt=list(xShu center)
object_Shu~>beginPt=leftBePt
object_Shu~>endPt=leftEndPt
);procedure
procedure(cutButtom(OverlapArea)
center=cadar(OverlapArea)
leftBePt=list(xShu center)
leftEndPt=list(xShu yMaxShu)
object_Shu~>beginPt=leftBePt
object_Shu~>endPt=leftEndPt
);procedure
procedure(Sequencing(object_Heng object_Shu)
xShu=car(car(pointsShu))
yHeng=cadr(car(pointsHeng))
hengBeginPt=car(object_Heng~>beginPt)
hengEndPt=car(object_Heng~>endPt)
shuBeginPt=car(cdr(object_Shu~>beginPt))
shuEndPt=car(cdr(object_Shu~>endPt))
cenHeng=int((hengBeginPt+hengEndPt)/2)
cenShu=int((shuBeginPt+shuEndPt)/2)
object_Heng~>endPt=list(cenHeng yHeng)
object_Shu~>endPt=list(xShu cenHeng)
if(hengBeginPt>hengEndPt
then cenHeng=hengEndPt
hengEndPt=hengBeginPt
hengBeginPt=cenHeng
else nil
);if
if(shuBeginPt>shuEndPt
then cenShu=shuEndPt
shuEndPt=shuBeginPt
shuBeginPt=cenShu
else nil
);if
object_Heng~>beginPt=list(hengBeginPt yHeng)
object_Heng~>endPt=list(hengEndPt yHeng)
object_Shu~>beginPt=list(xShu shuBeginPt)
object_Shu~>endPt=list(xShu shuEndPt)
);procedure make the beginPt<EndPt