dcl小面板
本帖最后由 296715530 于 2019-12-20 14:42 编辑函数什么的大部分看不懂,刚玩DCL两天,弄了个小面板瞎玩,太复杂的就不会了
;; dcl格式代码示意
(defun c:tt () ; tt(CAD小秘书)
(defun main-pro () (princ))
(xyp-initSet '(k1 k2 k3) '("1" "0" "0"))
(setq Dlst '(("" "方式" ":boxed_radio_row{")
("k1" "常用" "radio")
("k2" "专用" "radio")
("k3" "其他" "radio")
"}"
("" "常用" ":boxed_row{")
":column{"
("bu1" "按钮1" "button" "(c:abc1)")
("bu2" "按钮2" "button" "(c:abc2)")
("bu3" "按钮3" "button" "(c:abc3)")
("bu4" "按钮4" "button" "(c:abc4)")
"}"
":column{"
("bu5" "按钮5" "button" "(c:abc5)")
("bu6" "按钮6" "button" "(c:abc6)")
("bu7" "按钮7" "button" "(c:abc7)")
("bu8" "按钮8" "button" "(c:abc8)")
"}"
"}"
)
)
(if (= (xyp-Dcl-Init Dlst "【CAD小秘书】" t) 1)
(main-pro)
)
(princ)
)
;主程序(常用)
(vl-load-com)
(defun c:qq (/ fname fn x dclid lin)
(setq fname (vl-filename-mktemp nil nil ".dcl" ))
(setq fn (open fname "w" ))
(foreach x '(
"agtckz : dialog{"
"label=\"CAD小秘书by296715530\";"
":radio_column {"
":row {"
":radio_button {key = \"9\" ;label =\"常用\" ;value = "1";width=10;mnemonic = "q";}"
":radio_button {key = \"10\" ;label =\"专用\" ;width=10;}"
":radio_button {key = \"11\" ;label =\"其他\" ;width=10;}"
" }"
" }"
" :row{"
" :boxed_column{"
" label=\"常用\";"
" :row{"
" :button{key=\"1\";label=\"按钮1\";width=10;mnemonic ="o";}"
" :button{key=\"2\";label=\"按钮2\";width=10;}"
" }"
" :row{"
" :button{key=\"3\";label=\"按钮3\";width=10;}"
" :button{key=\"4\";label=\"按钮4\";width=10;}"
" }"
" :row{"
" :button{key=\"5\";label=\"按钮5\";width=10;}"
" :button{key=\"6\";label=\"按钮6\";width=10;}"
" }"
" :row{"
" :button{key=\"7\";label=\"按钮7\";width=10;}"
" :button{key=\"8\";label=\"按钮8\";width=10;}"
" }"
" }"
" }"
"cancel_button;"
"}"
);end ;endlist
(princ x fn)
(write-line "" fn)
);end foreach
(close fn)
(setq fn (open fname "r" ))
(setq dclid (load_dialog fname))
(while (or (eq (substr (setq lin (vl-string-right-trim "\" fn)" (vl-string-left-trim "(write-line \"" (read-line fn)))) 1 2) "//" ) (eq (substr lin 1 (vl-string-search " " lin)) "" ) (not (eq (substr lin (+ (vl-string-search " " lin) 1) 9) " : dialog" ))))
(new_dialog (substr lin 1 (vl-string-search " " lin)) dclid)
(action_tile "1" "(done_dialog 1)" )
(action_tile "2" "(done_dialog 2)" )
(action_tile "3" "(done_dialog 3)" )
(action_tile "4" "(done_dialog 4)" )
(action_tile "5" "(done_dialog 5)" )
(action_tile "6" "(done_dialog 6)" )
(action_tile "7" "(done_dialog 7)" )
(action_tile "8" "(done_dialog 8)" )
(action_tile "9" "(done_dialog 9)" )
(action_tile "10" "(done_dialog 10)" )
(action_tile "11" "(done_dialog 11)" )
(action_tile "cancel" "(done_dialog 0)" )
(setq re (start_dialog))
(cond
((= re 1) (GL:1))
((= re 2) (GL:2))
((= re 3) (GL:3))
((= re 4) (GL:4))
((= re 5) (GL:5))
((= re 6) (GL:6))
((= re 7) (GL:7))
((= re 8) (GL:8))
((= re 9) (c:qq))
((= re 10) (c:yx_zy))
((= re 11) (c:yx_qt))
);end cond
(unload_dialog dclid)
(close fn)
(vl-file-delete fname)
(princ)
)
;主程序(专用)
(vl-load-com)
(defun c:yx_zy (/ fname fn x dclid lin)
(setq fname (vl-filename-mktemp nil nil ".dcl" ))
(setq fn (open fname "w" ))
(foreach x '(
"agtckz : dialog{"
"label=\"CAD小秘书by296715530\";"
":row {"
":radio_button {key = \"9\" ;label =\"常用\" ;width=10;}"
":radio_button {key = \"10\" ;label =\"专用\" ;value = "1";width=10;}"
":radio_button {key = \"11\" ;label =\"其他\" ;width=10;}"
" }"
" :row{"
" :boxed_column{"
" label=\"专用\";"
" :row{"
" :button{key=\"14\";label=\"按钮9\";width=10;}"
" :button{key=\"15\";label=\"按钮10\";width=10;}"
" }"
" :row{"
" :button{key=\"16\";label=\"按钮11\";width=10;}"
" :button{key=\"17\";label=\"按钮12\";width=10;}"
" }"
" :row{"
" :button{key=\"18\";label=\"按钮13\";width=10;}"
" :button{key=\"19\";label=\"按钮14\";width=10;}"
" }"
" :row{"
" :button{key=\"20\";label=\"按钮15\";width=10;}"
" :button{key=\"21\";label=\"按钮16\";width=10;}"
" }"
" }"
" }"
"cancel_button;"
"}"
);end ;endlist
(princ x fn)
(write-line "" fn)
);end foreach
(close fn)
(setq fn (open fname "r" ))
(setq dclid (load_dialog fname))
(while (or (eq (substr (setq lin (vl-string-right-trim "\" fn)" (vl-string-left-trim "(write-line \"" (read-line fn)))) 1 2) "//" ) (eq (substr lin 1 (vl-string-search " " lin)) "" ) (not (eq (substr lin (+ (vl-string-search " " lin) 1) 9) " : dialog" ))))
(new_dialog (substr lin 1 (vl-string-search " " lin)) dclid)
(action_tile "14" "(done_dialog 14)" )
(action_tile "15" "(done_dialog 15)" )
(action_tile "16" "(done_dialog 16)" )
(action_tile "17" "(done_dialog 17)" )
(action_tile "18" "(done_dialog 18)" )
(action_tile "19" "(done_dialog 19)" )
(action_tile "20" "(done_dialog 20)" )
(action_tile "21" "(done_dialog 21)" )
(action_tile "9" "(done_dialog 9)" )
(action_tile "10" "(done_dialog 10)" )
(action_tile "11" "(done_dialog 11)" )
(action_tile "cancel" "(done_dialog 0)" )
(setq re (start_dialog))
(cond
((= re 14) (GL:14))
((= re 15) (GL:15))
((= re 16) (GL:16))
((= re 17) (GL:17))
((= re 18) (GL:18))
((= re 19) (GL:19))
((= re 20) (GL:20))
((= re 21) (GL:21))
((= re 9) (c:qq))
((= re 10) (c:yx_zy))
((= re 11) (c:yx_qt))
);end cond
(unload_dialog dclid)
(close fn)
(vl-file-delete fname)
(princ)
)
(defun c:yx_qt () (alert "这一天天的好无聊啊!!!" )(princ))
代码我不会写,比着葫芦画瓢还是可以的,东拼西凑弄着玩啦, 这个面板,就是论坛里面那个谁,发过的。。。。什么大数据面板。
可以拿过来直接DIY自己的工具箱的。。 296715530 发表于 2019-12-20 14:18
;主程序(常用)
(vl-load-com)
(defun c:qq (/ fname fn x dclid lin)
楼主您好,请问下怎么固定每个按钮的长度呢? 再见熊猫衣服 发表于 2019-12-20 15:36
这个面板,就是论坛里面那个谁,发过的。。。。什么大数据面板。
可以拿过来直接DIY自己的工具箱的。。
他那个我加载了没反应 qssq 发表于 2019-12-20 15:52
楼主您好,请问下怎么固定每个按钮的长度呢?
;width=10;这个好像是改宽度的,具体的我也不太懂,你可以试试改改,dcl是我弄的,其他函数是论坛找的,我也不懂关联,挨着葫芦画瓢呗 xyp1964 发表于 2019-12-20 21:19
;; dcl格式代码示意
函数有多少行 296715530 发表于 2019-12-20 21:28
函数有多少行
大约有5k行,可以轻松处理一般的dcl面板。