- UID
- 731838
- 积分
- 118
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2014-5-18
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-10-18 20:02:11
|
显示全部楼层
本帖最后由 lliushaojiang 于 2014-10-18 20:13 编辑
简单的将函数和主程序放到一个lsp文件里无法运行
;; 仅设置 radio 组并记录选择的定义
;; _$klst ---- radio 组函数名或 函数名列表
;; _$symL ---- 函数名或函数名列表,默认值
(defun XD::DCL:RadioInit (_$klst _$symL / _sRadioInit)
(defun _sRadioInit (_$kgrp _$def)
(mapcar '(lambda (x)
(if (= x (vl-symbol-value _$def))
(set_tile x "1")
(set_tile x "0")
)
)
_$kgrp
)
)
(if (listp _$symL)
(mapcar '(lambda (x y)
(_sRadioInit x y)
)
(mapcar 'vl-symbol-value _$klst)
_$symL
)
(_sRadioInit (vl-symbol-value _$klst) _$symL)
)
)
;;有回调函数或关联动作的 radio 组定义
;; _$klst ---- radio 组函数名或 函数名列表
;; _$symL ---- 函数名或函数名列表,默认值
;; _$callbackL -- 回调函数或列表,string
(defun XD::Dcl:RadioAction (_$klst _$symL _$callbackL / _gRadioAction)
(defun _gRadioAction (keylst sym _$callback)
(mapcar
'(lambda (x)
(action_tile
x
(strcat
"(if "
(vl-symbol-name sym)
"(set_tile \""
(vl-symbol-name sym)
"\" \"0\"))"
"(setq "
(vl-symbol-name sym)
" $key)"
"(set_tile $key \"1\")"
(if _$callback
(strcat "(" _$callback ")")
""
)
)
)
)
(vl-symbol-value keylst)
)
)
(XD::DCL:RadioInit _$klst _$symL)
(if (listp _$symL)
(while _$klst
(_gRadioAction (car _$klst) (car _$symL) (car _$callbackL))
(setq _$klst (cdr _$klst)
_$symL (cdr _$symL)
_$callbackL (cdr _$callbackL)
)
)
(_gRadioAction _$klst _$symL _$callbackL)
)
)
(defun c:tt (/ strl fn id klst1 klst2)
(defun _changeArrowType (mod)
(if (= mod 1)
(vlax-for x (fy:cset)
(vla-put-ArrowHead1Type x (eval (read key1)))
)
(vlax-for x (fy:cset)
(vla-put-ArrowHead2Type
x
(eval (read (vl-string-left-trim "F" key2)))
)
)
)
(vla-regen (fy:acdoc) acActiveViewport)
)
(or key1 (setq key1 "acArrowDefault"))
(or key2 (setq key2 "FacArrowDefault"))
(fy:begin)
(if (ssget '((0 . "DIM*")))
(progn
(setq strl '("temp:dialog{"
"label = \"Dim Arrow Stype\";"
": row {"
" :boxed_radio_column {"
" :radio_button {label = \"Default\"; key = \"acArrowDefault\";}"
" :radio_button {label = \"Dot\"; key = \"acArrowDot\";}"
" :radio_button {label = \"None\"; key = \"acArrowNone\";}"
" }"
" :boxed_radio_column {"
" :radio_button {label = \"Default\"; key = \"FacArrowDefault\";}"
" :radio_button {label = \"Dot\"; key = \"FacArrowDot\";}"
" :radio_button {label = \"None\"; key = \"FacArrowNone\";}"
" }}"
" ok_cancel;}"
)
klst1 '("acArrowDefault" "acArrowDot" "acArrowNone")
klst2 '("FacArrowDefault" "FacArrowDot" "FacArrowNone")
fn (xd::dcl:make strl)
id (xd::dcl:load fn "temp")
)
(xd::dcl:radioaction
'(klst1 klst2)
'(key1 key2)
'("_changeArrowType 1" "_changeArrowType 2")
)
(xd::dcl:start id fn)
)
)
(fy:end)
(princ)
)
|
-
-
ca.lsp
3.6 KB, 下载次数: 34, 下载积分: D豆 -1 , 活跃度 1
|