Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 7346|回复: 7

[原创] 【求助】麻烦罗老师和大家指点

[复制链接]
发表于 2016-4-28 14:06:39 | 显示全部楼层 |阅读模式
看了几个代码想到一个给PIN和VIA添加KEEPOUT的方式。
但是运行右键done操作不能结束命令,会继续执行完while后才能结束,也就是要done三次才能真正结束。
求帮忙改进代码,谢谢!


  1. axlCmdRegister("Create_Keepout" 'Create_Keepout ?cmdType "interactive" ?doneCmd 'Create_Keepout_done ?cancelCmd 'Create_Keepout_Cancel)
  2. defun(Create_Keepout ()
  3.       
  4.       let((mypopup clinedbid polydbid dia)
  5.       axlUIWPrint(nil "Create_Keepout V0.8")
  6.       axlUIWPrint(nil "Written by df")
  7.           notdone = t
  8.           
  9.     mypopup = axlUIPopupDefine(nil
  10.                            (list (list "Done" 'Create_Keepout_done)
  11.                                 (list "Cancel" 'Create_Keepout_Cancel)))
  12.     axlUIPopupSet(mypopup)
  13.         dia=atoi(axlUIPrompt("Enter Diameter" "50")) ;用弹窗的方式获取自定义的直径
  14.         while(notdone
  15.         FirstPin = nil
  16.         SecondPin = nil
  17.         axlClearSelSet()
  18.         axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
  19.         axlUIWPrint(nil "Please Select First.....")
  20.                 axlSelect()
  21.         FirstPin = car(axlGetSelSet())
  22.         axlClearSelSet()
  23.         axlHighlightObject(FirstPin)
  24.         axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
  25.         axlUIWPrint(nil "Please Select Second.....")
  26.                 axlSelect()
  27.         SecondPin = car(axlGetSelSet())
  28.         axlClearSelSet()
  29.         axlHighlightObject(SecondPin)
  30.                  if(FirstPin != nil && SecondPin != nil then
  31.                    clinedbid=caar(axlDBCreateLine(list(FirstPin->xy SecondPin->xy),dia,"Etch/top"));Create Cline on the top.
  32.                    polydbid=axlPolyFromDB(clinedbid ?endCapType 'ROUND);Poly
  33.            axlDeleteObject(clinedbid)
  34.                    df_shape=axlDBCreateShape(car(polydbid) t "Route Keepout/all" nil)
  35.                    axlDBAddProp(car(df_shape),  list("ROUTES_ALLOWED"))
  36.                    axlDBAddProp(car(df_shape),  list("VIAS_ALLOWED"))
  37.                    else
  38.                    axlUIWPrint(nil "Please Select via or pin....")
  39.                     );end if
  40.                         axlDehighlightObject(FirstPin)
  41.             axlDehighlightObject(SecondPin)
  42.                         );end while
  43.         ));end defun
  44.        
  45. defun(Create_Keepout_done ()
  46.                 notdone = nil
  47.                 axlFinishEnterFun()
  48.                 axlUIWPrint(nil "- Done -")
  49.           )
  50. defun(Create_Keepout_Cancel ()
  51.                 notdone = nil
  52.                 axlCancelEnterFun()
  53.                 axlUIWPrint(nil "- Cancel -")
  54.      )
复制代码



发表于 2016-4-28 17:07:30 | 显示全部楼层

  1. axlCmdRegister("Create_Keepout" 'Create_Keepout ?cmdType "interactive" ?doneCmd 'Create_Keepout_done ?cancelCmd 'Create_Keepout_Cancel)
  2. defun(Create_Keepout ()
  3.       
  4.       let((mypopup clinedbid polydbid dia)
  5.       axlUIWPrint(nil "Create_Keepout V0.8")
  6.       axlUIWPrint(nil "Written by df")
  7.           notdone = t
  8.          
  9.     mypopup = axlUIPopupDefine(nil
  10.                 (list (list "Done" 'Create_Keepout_done)
  11.                                 (list "Cancel" 'Create_Keepout_Cancel)))
  12.             axlUIPopupSet(mypopup)
  13.         dia=atoi(axlUIPrompt("Enter Diameter" "50")) ;用弹窗的方式获取自定义的直径
  14.         while(notdone
  15.         FirstPin = nil
  16.         SecondPin = nil
  17.         axlClearSelSet()
  18.         axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
  19.         axlUIWPrint(nil "Please Select First.....")
  20.         ;axlSelect()
  21.         axlSingleSelectPoint()
  22.         FirstPin = car(axlGetSelSet())
  23.         axlClearSelSet()
  24.         axlHighlightObject(FirstPin)
  25.         when(notdone && FirstPin
  26.         axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
  27.         axlUIWPrint(nil "Please Select Second.....")
  28.         ;axlSelect()
  29.         axlSingleSelectPoint()
  30.         SecondPin = car(axlGetSelSet())
  31.         axlClearSelSet()
  32.         axlHighlightObject(SecondPin)
  33.                  if(FirstPin != nil && SecondPin != nil then
  34.                    clinedbid=caar(axlDBCreateLine(list(FirstPin->xy SecondPin->xy),dia,"Etch/top"));Create Cline on the top.
  35.                    polydbid=axlPolyFromDB(clinedbid ?endCapType 'ROUND);Poly
  36.            axlDeleteObject(clinedbid)
  37.                    df_shape=axlDBCreateShape(car(polydbid) t "Route Keepout/all" nil)
  38.                    axlDBAddProp(car(df_shape),  list("ROUTES_ALLOWED"))
  39.                    axlDBAddProp(car(df_shape),  list("VIAS_ALLOWED"))
  40.                    else
  41.                    axlUIWPrint(nil "Please Select via or pin....")
  42.                     );end if
  43.                         axlDehighlightObject(FirstPin)
  44.             axlDehighlightObject(SecondPin)
  45.                         );end while
  46.         ));end defun
  47.         )
  48.         
  49. defun(Create_Keepout_done ()
  50.                 notdone = nil
  51.                 axlFinishEnterFun()
  52.                 axlUIWPrint(nil "- Done -")
  53.           )
  54. defun(Create_Keepout_Cancel ()
  55.                 notdone = nil
  56.                 axlCancelEnterFun()
  57.                 axlUIWPrint(nil "- Cancel -")
  58.      )
复制代码



原因:
done之后程序一直停在axlSelect等待选择,需要选择两次。所以。。。。。
 楼主| 发表于 2016-4-28 19:37:58 | 显示全部楼层
vivienluo 发表于 2016-4-28 17:07
原因:
done之后程序一直停在axlSelect等待选择,需要选择两次。所以。。。。。

罗老师这个改法很棒!感谢!
发表于 2016-4-28 21:50:17 | 显示全部楼层
defir 发表于 2016-4-28 19:37
罗老师这个改法很棒!感谢!

做好之后分享一下哦
 楼主| 发表于 2016-4-28 22:09:39 | 显示全部楼层
vivienluo 发表于 2016-4-28 21:50
做好之后分享一下哦

会的,你改过之后基本可以用了。
后面继续学习,加入更多功能,来论坛和大家分享。
发表于 2016-9-11 20:51:21 | 显示全部楼层
赞一个,希望能多分享些代码给我们这些菜鸟学习一下
发表于 2017-2-3 15:58:07 | 显示全部楼层
赞一个,希望能多分享些代码给我们这些菜鸟学习一下
发表于 2022-2-13 12:31:30 | 显示全部楼层
学习到了,感谢罗老师的分享
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|网站地图|Cadence Skill 论坛 ( 蜀ICP备13024417号 )

GMT+8, 2024-4-20 10:48 , Processed in 0.226377 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表