【求助】麻烦罗老师和大家指点
看了几个代码想到一个给PIN和VIA添加KEEPOUT的方式。但是运行右键done操作不能结束命令,会继续执行完while后才能结束,也就是要done三次才能真正结束。
求帮忙改进代码,谢谢!
axlCmdRegister("Create_Keepout" 'Create_Keepout ?cmdType "interactive" ?doneCmd 'Create_Keepout_done ?cancelCmd 'Create_Keepout_Cancel)
defun(Create_Keepout ()
let((mypopup clinedbid polydbid dia)
axlUIWPrint(nil "Create_Keepout V0.8")
axlUIWPrint(nil "Written by df")
notdone = t
mypopup = axlUIPopupDefine(nil
(list (list "Done" 'Create_Keepout_done)
(list "Cancel" 'Create_Keepout_Cancel)))
axlUIPopupSet(mypopup)
dia=atoi(axlUIPrompt("Enter Diameter" "50")) ;用弹窗的方式获取自定义的直径
while(notdone
FirstPin = nil
SecondPin = nil
axlClearSelSet()
axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
axlUIWPrint(nil "Please Select First.....")
axlSelect()
FirstPin = car(axlGetSelSet())
axlClearSelSet()
axlHighlightObject(FirstPin)
axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
axlUIWPrint(nil "Please Select Second.....")
axlSelect()
SecondPin = car(axlGetSelSet())
axlClearSelSet()
axlHighlightObject(SecondPin)
if(FirstPin != nil && SecondPin != nil then
clinedbid=caar(axlDBCreateLine(list(FirstPin->xy SecondPin->xy),dia,"Etch/top"));Create Cline on the top.
polydbid=axlPolyFromDB(clinedbid ?endCapType 'ROUND);Poly
axlDeleteObject(clinedbid)
df_shape=axlDBCreateShape(car(polydbid) t "Route Keepout/all" nil)
axlDBAddProp(car(df_shape),list("ROUTES_ALLOWED"))
axlDBAddProp(car(df_shape),list("VIAS_ALLOWED"))
else
axlUIWPrint(nil "Please Select via or pin....")
);end if
axlDehighlightObject(FirstPin)
axlDehighlightObject(SecondPin)
);end while
));end defun
defun(Create_Keepout_done ()
notdone = nil
axlFinishEnterFun()
axlUIWPrint(nil "- Done -")
)
defun(Create_Keepout_Cancel ()
notdone = nil
axlCancelEnterFun()
axlUIWPrint(nil "- Cancel -")
)
axlCmdRegister("Create_Keepout" 'Create_Keepout ?cmdType "interactive" ?doneCmd 'Create_Keepout_done ?cancelCmd 'Create_Keepout_Cancel)
defun(Create_Keepout ()
let((mypopup clinedbid polydbid dia)
axlUIWPrint(nil "Create_Keepout V0.8")
axlUIWPrint(nil "Written by df")
notdone = t
mypopup = axlUIPopupDefine(nil
(list (list "Done" 'Create_Keepout_done)
(list "Cancel" 'Create_Keepout_Cancel)))
axlUIPopupSet(mypopup)
dia=atoi(axlUIPrompt("Enter Diameter" "50")) ;用弹窗的方式获取自定义的直径
while(notdone
FirstPin = nil
SecondPin = nil
axlClearSelSet()
axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
axlUIWPrint(nil "Please Select First.....")
;axlSelect()
axlSingleSelectPoint()
FirstPin = car(axlGetSelSet())
axlClearSelSet()
axlHighlightObject(FirstPin)
when(notdone && FirstPin
axlSetFindFilter(?enabled list("noall" "VIAS" "pins") ?onButtons list("noall" "VIAS" "pins"))
axlUIWPrint(nil "Please Select Second.....")
;axlSelect()
axlSingleSelectPoint()
SecondPin = car(axlGetSelSet())
axlClearSelSet()
axlHighlightObject(SecondPin)
if(FirstPin != nil && SecondPin != nil then
clinedbid=caar(axlDBCreateLine(list(FirstPin->xy SecondPin->xy),dia,"Etch/top"));Create Cline on the top.
polydbid=axlPolyFromDB(clinedbid ?endCapType 'ROUND);Poly
axlDeleteObject(clinedbid)
df_shape=axlDBCreateShape(car(polydbid) t "Route Keepout/all" nil)
axlDBAddProp(car(df_shape),list("ROUTES_ALLOWED"))
axlDBAddProp(car(df_shape),list("VIAS_ALLOWED"))
else
axlUIWPrint(nil "Please Select via or pin....")
);end if
axlDehighlightObject(FirstPin)
axlDehighlightObject(SecondPin)
);end while
));end defun
)
defun(Create_Keepout_done ()
notdone = nil
axlFinishEnterFun()
axlUIWPrint(nil "- Done -")
)
defun(Create_Keepout_Cancel ()
notdone = nil
axlCancelEnterFun()
axlUIWPrint(nil "- Cancel -")
)
原因:
done之后程序一直停在axlSelect等待选择,需要选择两次。所以。。。。。 vivienluo 发表于 2016-4-28 17:07
原因:
done之后程序一直停在axlSelect等待选择,需要选择两次。所以。。。。。
罗老师这个改法很棒!感谢! defir 发表于 2016-4-28 19:37
罗老师这个改法很棒!感谢!
做好之后分享一下哦:lol vivienluo 发表于 2016-4-28 21:50
做好之后分享一下哦
会的,你改过之后基本可以用了。
后面继续学习,加入更多功能,来论坛和大家分享。 赞一个,希望能多分享些代码给我们这些菜鸟学习一下 赞一个,希望能多分享些代码给我们这些菜鸟学习一下 学习到了,感谢罗老师的分享 了解一下,谢谢分享。
页:
[1]