自定义面板求助
(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)
)
)
)
)
以前有人发过这段代码。但没有详细说明怎么用。请问如果要加载lsp fas arx等文件应该修改那里?怎么改?希望高手们帮忙解惑。
没人顶吗?先顶一个,等楼下解决 ap加载lsp fas arx。
(list "画 梁" "circle") ;(list按钮标签运行的命令)
画 梁改成画圆。呵呵
(list "你的插件名称" "插件命令") ;(list按钮标签运行的命令) qazxswk 发表于 2022-2-7 19:19
(list "你的插件名称" "插件命令") ;(list按钮标签运行的命令)
插件命令我的怎么不行 世井 发表于 2022-2-12 08:24
插件命令我的怎么不行
你要把你的插件跟这个面板文件同时加载。 qazxswk 发表于 2022-2-12 12:00
你要把你的插件跟这个面板文件同时加载。
(defun c:TT ()
(mai_make_panel
(list
(list "一"
(list "111" "TTT") ;(list按钮标签运行的命令)
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
) ;_ 结束list
(list "二"
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
(list "" "")
) ;_ 结束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)
) ) ));;;;;
(defun c:ttt (/ p1 )(setq P1 (getpoint "\n请指定点写入:"))(command "._text" P1 "6" "0")(princ))
已经加载了还是不行 (list "111" "TTT") ;(list按钮标签运行的命令)
大写TTT换成小写试试 qazxswk 发表于 2022-2-12 12:52
(list "111" "TTT") ;(list按钮标签运行的命令)
大写TTT换成小写试试
大小写都试过了不行 世井 发表于 2022-2-12 13:53
大小写都试过了不行
我试了一下你前面发的源代码,在浩辰CAD2022上是可以运行的。
页:
[1]
2