|
本帖最后由 王开鑫55 于 2017-5-30 18:42 编辑
怎样解决command跳出skill?并没有循环,是按钮函数有bug?
/***********定义FORM!*********/
axlCmdRegister("occ" 'actions)
defun( actions ()
Createform()
)
/***********定义FORM!*********/
defun( Createform ()
let(()
formPath = "./orignChange.form"
pform = outfile( formPath "w")
;form 头,可以用f_FormBegin(pform 31 10 "Free Origin" "TOOLWINDOW") f_FormEnd(pform)代替
fprintf(pform "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(pform "FORM\n")
fprintf(pform "FIXED\n")
fprintf(pform "PORT 31 10\n")
fprintf(pform "HEADER \"Move Origin\"\n")
fprintf(pform "TILE\n")
;主体开始
fprintf(pform "TEXT \"move origin\"\n")
fprintf(pform "FLOC 20 0\n")
fprintf(pform "ENDTEXT\n")
fprintf(pform "GROUP \"Origin Manager\"\n")
fprintf(pform "FLOC 2 1\n")
fprintf(pform "FSIZE 28 18\n")
fprintf(pform "ENDGROUP\n")
fprintf(pform "FIELD jumpAnypad\n")
fprintf(pform "FLOC 3 3\n")
fprintf(pform "MENUBUTTON \"AnyPad\" 8 4\n")
fprintf(pform "ENDFIELD\n")
fprintf(pform "TEXT \"Jump To Any Pad.\"\n")
fprintf(pform "FLOC 12 4\n")
fprintf(pform "ENDTEXT\n")
fprintf(pform "GROUP \"Message Field\"\n")
fprintf(pform "FLOC 2 19\n")
fprintf(pform "FSIZE 28 8\n")
fprintf(pform "ENDGROUP\n")
fprintf(pform "TEXT\n")
fprintf(pform "FLOC 4 21\n")
fprintf(pform "INFO msg 28\n")
fprintf(pform "FSIZE 24 7\n")
fprintf(pform "ENDTEXT\n")
fprintf(pform "ENDTILE\n")
fprintf(pform "ENDFORM\n");结束form文件制作
close(pform);关闭输出端口。
newform = axlFormCreate( (gensym) "orignChange.form" `(e inner) `OriginHandle t nil)
axlUIWPerm( newform t )
axlFormDisplay( newform );显示此form
;定义此form各个按钮调用相应的函数
defvar( msg , "Click the key to select the origin location!" );defvar定义全局变量,变量m
axlFormSetField( newform "jumpAnypad" nil)
axlFormSetField( newform "msg" msg);msg 插入部分的
deleteFile(formPath);删除form文件
)
)
/***********触发函数部分!*********/
defun( OriginHandle (newform)
let( ()
case( newform->curField
( "jumpAnypad" jumpAnypad() ); 触发按钮时,command窗口调skill
);end case
);end let
);defun pform_Action
/***********按钮函数*********/
defun( jumpAnypad ()
let( ()
axlClearSelSet()
axlFormSetField( newform "msg" "Please Pick A Pad!")
axlSetFindFilter(?enabled list( "noall" "pins") ?onButtons list( "noall" "pins"));筛选
anyPin = axlGetSelSet(axlSingleSelectPoint())
when( anyPin
orx = xCoord(car(anyPin)->xy)
ory = yCoord(car(anyPin)->xy)
axlDBChangeDesignOrigin(list(minus(orx) minus(ory)))
;anyPin = car(anyPin)
;axlFormSetField( newform "msg" sprintf( nil "The Origin Move to Pin%L!" (anyPin->numbe)))
)
);let
axlClearSelSet()
axlDBRefreshId(nil);debug,避免连续多次出现定位出错的bug!
);end defun jumpAnypad
|
-
skill
|