hzzhf的个人空间 https://blog.eetop.cn/1776678 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

20211207

已有 812 次阅读| 2021-12-7 15:43 |个人分类:skill|系统分类:其他

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



点赞

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 1

    关注
  • 1

    粉丝
  • 1

    好友
  • 3

    获赞
  • 3

    评论
  • 12

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-7-2 07:36 , Processed in 0.073990 second(s), 15 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部