求解大神杰作-简单的自定面板函数
不知道这是哪位大神的杰作,想请教学习一下,可不可以运行命令后不关闭面板,就是一直显示面板?如何修改面板的位置?
(defun c:xxx ()
(mai_make_panel
(list
(list "梁"
(list "画 梁" "circle") ;(list按钮标签运行的命令)
(list "单线变梁" "mini_line_to_beam")
(list "筏板梁倒角" "mini_foundation_beam")
(list "修补梁柱" "mini_fix_beam")
(list "修补双线" "mini_fix_dline")
(list "框选修补线" "mini_fix_line")
) ;_ 结束list
(list "柱"
(list " + 型柱" "mini_c_column")
(list " L 型柱" "mini_l_column")
(list " T 型柱" "mini_t_column")
(list " ○ 型柱" "mini_O_column")
(list " □ 型柱" "mini_r_column")
(list "轴线布柱" "mini_axis_column")
(list "填 充 柱" "mini_fill_column")
(list "墙体填充" "mini_fill_wall")
(list "转PKPM GS柱" "mini_pline_to_beam")
(list "多线变柱" "mini_pline_to_column")
) ;_ 结束list
) ;_ 结束list
) ;_ 结束mai_mak_panel
(princ)
)
(defun mai_make_panel ( menulist / n num_nobut num_button nn nnn menuname val_lst add_dclrow tt order_lst in num_image)
(defun add_dclrow ( dstr / ) (if dstr (setq val_lst (cons dstr val_lst))))
(setq menuname (strcat (vl-filename-mktemp) "temp_pannel.dcl"))
(add_dclrow "curbutton:button{width=10;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curimage:image{width=10;height=0.2;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curpanel:dialog{label=\"迷你自定义面板\";alignment=centered;vertical_margin=none;horizontal_margin=none;")
(add_dclrow ":row{")
(setq len (apply 'max (mapcar 'length menulist))
order_lst (apply 'append (mapcar 'cdr menulist))
num_button 0
num_nobut 0
in 0
num_image 0
)
(foreach nn menulist
(setq in 0)
(add_dclrow (strcat " : boxed_column{label=\"" (car nn) "\";vertical_margin=none; horizontal_margin=none;"))
(foreach nnn (cdr nn)
(setq num_button (1+ num_button)
in (1+ in)
num_image (1+ num_image)
tt (car nnn)
tt (if tt tt "")
)
(add_dclrow (strcat ":curbutton{label=\"" tt "\";key=\"but" (itoa num_button) "\";}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";color=18;}"))
(setq in 0)
)
)
)
(repeat (- len (length nn))
(setq num_nobut (1+ num_nobut)
in (1+ in)
num_image (1+ num_image)
)
(add_dclrow (strcat " : curbutton{key=\"butno" (itoa num_nobut) "\";color=-2;}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";}"))
(setq in 0)
)
)
)
(add_dclrow "spacer;}")
)
(add_dclrow "}:button{label=\"关闭\";key=\"cancel\";is_cancel=true;width=10;fixed_width=true;alignment=centered;}}")
(vl-file-delete menuname)
(setq nn (open menuname "w"))
(foreach n (reverse val_lst) (write-line n nn))
(close nn)
(setq nnn (load_dialog menuname))
(if (not (new_dialog "curpanel" nnn)) (exit))
(setq n 0)
(repeat num_nobut (mode_tile (strcat "butno" (itoa num_nobut)) 1) (setq num_nobut (1- num_nobut)))
(foreach nn menulist
(foreach nnn (cdr nn)
(setq n (1+ n)
tt (car nnn)
tt (if tt tt "")
)
(if (= tt "")
(mode_tile (strcat "but" (itoa n)) 1)
(action_tile (strcat "but" (itoa n)) (strcat "\(done_dialog " (itoa n) "\)"))
)
)
)
(setq nn (start_dialog))
(unload_dialog nnn)
(vl-file-delete menuname)
(if (> nn 0)
(progn (setq tt (cadr (nth (1- nn) order_lst)))
(princ "\n")
(if (= (eval (read (strcat "(type c:" tt ")"))) 'SUBR)
(eval (read (strcat "(c:" tt ")")))
(vl-cmdf tt)
)
)
)
)
DCL是模态的,要跟CAD交互需要关闭对话框。
如果需要不关闭对话框交互,则需要采用非模态对话框,DCL应该处理不了。 想要交互不关闭 论坛上有那种侧边栏的面板 就可以做到交互不关闭 一直都在 Bao_lai 发表于 2024-3-18 20:33
DCL是模态的,要跟CAD交互需要关闭对话框。
如果需要不关闭对话框交互,则需要采用非模态对话框,DCL应该 ...
学到了,感谢! love1030312 发表于 2024-3-18 20:44
想要交互不关闭 论坛上有那种侧边栏的面板 就可以做到交互不关闭 一直都在
学到了,感谢! 可以在论坛找下【 opendcl 】,可以实现你想要的效果。 这是迈总的面板。多线程好像阿甘搞了一个,你找他问问。 感谢分享感谢分享感谢分享
页:
[1]