找回密码
 注册
关于网站域名变更的通知
查看: 1072|回复: 7
打印 上一主题 下一主题

【求解答】帮忙看一段代码

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2016-4-27 22:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 defir 于 2016-4-28 14:00 编辑

看了几个代码想到一个给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.      )
复制代码

keepout.zip

941 Bytes, 阅读权限: 30, 下载次数: 8, 下载积分: 贡献 -30 , 威望 -10

skill源码

该用户从未签到

2#
发表于 2016-4-28 14:02 | 只看该作者
一种改法,将axlSelect改为axlSingleSelectPoint,另外在done cancel回调函数中将菜单清除axlUIPopupSet(nil), 另外axlSelect函数已经是多选操作,不需要调用两次。

  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.                 axlSingleSelectPoint();change
  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.                 axlSingleSelectPoint();change
  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.                                 axlUIPopupSet(nil);change
  49.                 axlUIWPrint(nil "- Done -")
  50.           )
  51. defun(Create_Keepout_Cancel ()
  52.                 notdone = nil
  53.                 axlCancelEnterFun()
  54.                                 axlUIPopupSet(nil);change
  55.                 axlUIWPrint(nil "- Cancel -")
  56.      )
复制代码



点评

感谢版主的解答。 之前也用的是的axlSingleSelectPoint,但是发现邮件菜单出不来。现在改了还是这个问题。 [attachimg]112125[/attachimg][attachimg]112126[/attachimg]  详情 回复 发表于 2016-4-28 19:14

该用户从未签到

3#
 楼主| 发表于 2016-4-28 19:14 | 只看该作者
deargds 发表于 2016-4-28 14:02
一种改法,将axlSelect改为axlSingleSelectPoint,另外在done cancel回调函数中将菜单清除axlUIPopupSet(nil ...

感谢版主的解答。
之前也用的是的axlSingleSelectPoint,但是发现邮件菜单出不来。现在改了还是这个问题。

点评

把axlUIPopupSet(mypopup)放到while里面就行了  详情 回复 发表于 2016-4-29 08:56

该用户从未签到

4#
发表于 2016-4-29 08:56 | 只看该作者
本帖最后由 deargds 于 2016-4-29 09:56 编辑
defir 发表于 2016-4-28 19:14
感谢版主的解答。
之前也用的是的axlSingleSelectPoint,但是发现邮件菜单出不来。现在改了还是这个问题 ...

把axlUIPopupSet(mypopup)放到while里面就行了


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


点评

感谢解答!昨晚把这个程序改好了,目前发现的BUG已经修复。感谢版主的支持!  详情 回复 发表于 2016-4-29 12:08

该用户从未签到

5#
 楼主| 发表于 2016-4-29 12:08 | 只看该作者
deargds 发表于 2016-4-29 08:56
把axlUIPopupSet(mypopup)放到while里面就行了

感谢解答!昨晚把这个程序改好了,目前发现的BUG已经修复。感谢版主的支持!

该用户从未签到

7#
发表于 2018-5-23 10:05 | 只看该作者
缺少是好帖子

该用户从未签到

8#
发表于 2018-10-17 13:49 | 只看该作者
发现,避让变大了后,在设置小直径就可以了,也就是说避让变大不能变小
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-6-9 16:53 , Processed in 0.109375 second(s), 33 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

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