找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

巢课
电巢直播8月计划
查看: 329|回复: 6
打印 上一主题 下一主题

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

[复制链接]

5

主题

109

帖子

1925

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
1925
跳转到指定楼层
1#
发表于 2016-4-27 22:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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.      )
复制代码

本帖子中包含更多资源

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

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏3 支持!支持! 反对!反对!

117

主题

2352

帖子

1万

积分

EDA365特邀版主

Rank: 6Rank: 6

积分
13799

最佳敬业奖

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
谁画出这天地 又画下我和你

5

主题

109

帖子

1925

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

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

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

本帖子中包含更多资源

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

x

点评

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

117

主题

2352

帖子

1万

积分

EDA365特邀版主

Rank: 6Rank: 6

积分
13799

最佳敬业奖

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

主题

109

帖子

1925

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

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

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

10

主题

379

帖子

4169

积分

五级会员(50)

Rank: 5

积分
4169
6#
发表于 2016-11-15 03:21 | 只看该作者
學習一下~~

29

主题

2646

帖子

2805

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
2805
7#
发表于 2018-5-23 10:05 | 只看该作者
缺少是好帖子
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

巢课

技术风云榜

关于我们|手机版|EDA365 ( 粤ICP备18020198号 )

GMT+8, 2024-9-20 00:33 , Processed in 0.123164 second(s), 41 queries , Gzip On.

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

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

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