sbwdx 发表于 2019-11-12 12:11:44

taoyi0727 发表于 2019-11-12 12:11
"}"
":text{key=\"str\";label=\"加字加字加字\";}"
":row{"


谢谢老师,搞定啦

sbwdx 发表于 2019-12-30 13:40:27

taoyi0727 发表于 2019-11-12 12:11
"}"
":text{key=\"str\";label=\"加字加字加字\";}"
":row{"

老师,我问哈,这个地方的字离上面太近了紧凑的很,能调远一点吗?
(defun Dcl-ButtonM (titl buttons flag / a b c)
   (defun strsplist (str / i)
   (if (setq i (vl-string-search " " str))
       (list (substr str 1 i)
                                 (vl-string-trim " " (substr str (+ 2 i)))
       )
               )
   )
   (defun makedcl (str_lst / fileID dclHandle)
   (setq
                         dclfile (vl-filename-mktemp nil nil ".dcl")
                         fileID(open dclfile "w")
   )
   (cond
                         ((= (type str_lst) 'str)
                                 (write-line str_lst fileID)
                         )
                         ((= (type str_lst) 'list)
                                 (foreach n str_lst (write-line n fileID))
                         )
               )
               (close fileID)
               (setq dclHandle (load_dialog dclfile))
         )
         (setq
               b (if flag
                                 ":column{label = \""
                                 ":row{label = \""
                         )
               c (if flag
                                 ":row{label = \""
                                 ":column{label = \""
                         )
               d '("ESC")
               a (strcat (vl-string-translate
                                                               "$~"
                                                               "AB"
                                                               (vl-filename-base (vl-filename-mktemp))
                                                         )
                                 ":dialog{label=\""
                                 titl
                                 "\";\n"
                                 b
                                 "\";\n"
                         )
   )
   (foreach x buttons
   (if (listp x)
       (progn
         (setq a (strcat a c (car x) "\";\n"))
         (foreach y (last x)
         (setq
                                                 b (strsplist y)
                                                 a (if b
                                                               (strcat a
                                                                         ":button {key =\""
                                                                         (car b)
                                                                         "\";label=\""
                                                                         (last b)
                                                                         "\";}\n"
                                                               )
                                                               (strcat a "spacer_0;\n")
                                                         )
                                                 d (if (/= (car b) nil)
                                                               (cons (car b) d)
                                                               d
                                                         )
         )
         )
         (setq a (strcat a "}\n"))
       )
       (setq a (strcat a "spacer_0;\n"))
   )
   )
         (setq
               d    (cdr (REVERSE d))
               a    (strcat a
                                          "}"
                                          ":text{key=\"str\";label=\"加字加字加字\";}"
                                          ":row{"
                                          ":spacer { width = 120; } "
                                          ":button{key = \"HLP\";label = \"帮助\";}\n"
                                          ":button{key=\"ESC\";label=\"取消\";is_cancel = true;}}}"
                                  )
               dcl(makedcl a)
               lst1 '()
               i    1
   )
   (foreach key d
   (setq
                         tx   (strcat "(action_tile \""
                                                key
                                                "\"\"(done_dialog "
                                                (itoa i)
                                                ")\")"
                                          )
                         lst1 (cons tx lst1)
                         i    (1+ i)
   )
   )
   (new_dialog (substr a 1 8) dcl)
   (action_tile "ESC" "(done_dialog 0)")
   (action_tile "HLP" "(alert\"通用了,还郁闷?\")")
   (eval (read (strcat "(progn" (apply 'strcat lst1) ")")))
   (setq ctl (start_dialog))
   (UNLOAD_DIALOG dcl)
   (vl-file-delete dclfile)
         (if (/= ctl 0)
   (eval (read (strcat "(c:" (nth (- ctl 1) d) ")")))
   )
)
(defun c:tt4 (/ lst)
   (setq      lst '(
                         ("绘图功能"
                                 ("DDD 水平垂直标注∣DDD ""ZX 两点中点∣ZX"    "FFF 两点等分∣FFF " "SZ 按色选择∣SZ""WW 镜像优化∣WW ""HK 填充开关∣HK ""CV 阵列复制∣CV ""C0 图层颜色随层∣C0" "Q 置为当前图层∣Q ""FF 所选对象最前置∣FF ""BB 所选对象最后置∣BB "" 改颜色∣1-255" )
                         )
                         ("绘图功能"
                                 ("GG 超级解组∣GG ""XX 超级炸块∣XX ""ZG 修改字高∣ZG ""DV 标注对齐∣DV " "DE 标注修剪∣DE " "DBB 设为当前标注∣DBB ""HD 指定填充原点∣HD ""EQ 标注值改均分∣EQ " "RS 标注值改实际尺寸∣RS ""YS 当前图层颜色查询∣YS ""DA 改选择对象线型为DASH,比例为1∣DA ""00 对象图层为0,颜色/线性随块,比例为1∣00 ")                              
                        )
                         ("辅助功能"                              
                              ("HH 水平构造线∣HH " "VV 竖直构造线∣VV ""OO 双向偏移∣OO ""BN 快速做块∣BN " "BBI 块改基点∣BBI ""RB 图块改名∣RB ""HF 绘制焊缝∣HF ""HG 填充捕捉∣HG ""OS    捕捉还原∣OS ""CL 中心线(布局使用)∣CL ""QQQ 将对象放置0层∣QQQ""DEF 将对象放置不可打印层∣DEF")                              
                        )
                         ("布局功能"                              
                              ("SV 锁定视口∣SV " "FV 解锁视口∣FV ""VVS 视口比例∣VVS ""SSV 匹配视图∣SSV " "VQ 对齐视图∣VQ ""` 模布切换∣` ""EE 图层隔离∣EE      ""EEE 图层隔离解除∣EEE""TC 节点剖面填充(需安装源泉)∣TC ""DJ (布局视口)当前图层视口冻结∣DJ ""JD (布局视口)当前图层视口解冻∣JD ""VPI (布局视口)其他视口图层冻结∣VPI ")
                         )
                                 
                )
   )      
(Dcl-ButtonM "【XX工具】V2014.1.21" lst nil)
         (princ)
)



taoyi0727 发表于 2019-12-30 14:00:20


改下这里就可以了

sbwdx 发表于 2019-12-30 14:20:50

taoyi0727 发表于 2019-12-30 14:00
改下这里就可以了

(defun Dcl-ButtonM (titl buttons flag / a b c)
   (defun strsplist (str / i)
   (if (setq i (vl-string-search " " str))
       (list (substr str 1 i)
                                 (vl-string-trim " " (substr str (+ 2 i)))
       )
               )
   )
   (defun makedcl (str_lst / fileID dclHandle)
   (setq
                         dclfile (vl-filename-mktemp nil nil ".dcl")
                         fileID(open dclfile "w")
   )
   (cond
                         ((= (type str_lst) 'str)
                                 (write-line str_lst fileID)
                         )
                         ((= (type str_lst) 'list)
                                 (foreach n str_lst (write-line n fileID))
                         )
               )
               (close fileID)
               (setq dclHandle (load_dialog dclfile))
         )
         (setq
               b (if flag
                                 ":column{label = \""
                                 (strcat
                                 "spacer{ wide=1; fixed_width=true;} \n"
                                 "spacer{ wide=1; fixed_width=true;} \n"
                                 ":row{label = \""
                                 )
                  )
               c (if flag
                                 ":row{label = \""
                                 ":column{label = \""
                         )
               d '("ESC")
               a (strcat (vl-string-translate
                                                               "$~"
                                                               "AB"
                                                               (vl-filename-base (vl-filename-mktemp))
                                                         )
                                 ":dialog{label=\""
                                 titl
                                 "\";\n"
                                 b
                                 "\";\n"
                         )
   )
   (foreach x buttons
   (if (listp x)
       (progn
         (setq a (strcat a c (car x) "\";\n"))
         (foreach y (last x)
         (setq
                                                 b (strsplist y)
                                                 a (if b
                                                               (strcat a
                                                                         ":button {key =\""
                                                                         (car b)
                                                                         "\";label=\""
                                                                         (last b)
                                                                         "\";}\n"
                                                               )
                                                               (strcat a "spacer_0;\n")
                                                         )
                                                 d (if (/= (car b) nil)
                                                               (cons (car b) d)
                                                               d
                                                         )
         )
         )
         (setq a (strcat a "}\n"))
       )
       (setq a (strcat a "spacer_0;\n"))
   )
   )
         (setq
               d    (cdr (REVERSE d))
               a    (strcat a
                                          "}"
                                          ":text{key=\"str\";label=\"加字加字加字\";}"
                                          ":row{"
                                          ":spacer { width = 120; } "
                                          ":button{key = \"HLP\";label = \"帮助\";}\n"
                                          ":button{key=\"ESC\";label=\"取消\";is_cancel = true;}}}"
                                  )
               dcl(makedcl a)
               lst1 '()
               i    1
   )
   (foreach key d
   (setq
                         tx   (strcat "(action_tile \""
                                                key
                                                "\"\"(done_dialog "
                                                (itoa i)
                                                ")\")"
                                          )
                         lst1 (cons tx lst1)
                         i    (1+ i)
   )
   )
   (new_dialog (substr a 1 8) dcl)
   (action_tile "ESC" "(done_dialog 0)")
   (action_tile "HLP" "(alert\"通用了,还郁闷?\")")
   (eval (read (strcat "(progn" (apply 'strcat lst1) ")")))
   (setq ctl (start_dialog))
   (UNLOAD_DIALOG dcl)
   (vl-file-delete dclfile)
         (if (/= ctl 0)
   (eval (read (strcat "(c:" (nth (- ctl 1) d) ")")))
   )
)
(defun c:tt4 (/ lst)
   (setq      lst '(
                         ("绘图功能"
                                 ("DDD 水平垂直标注∣DDD ""ZX 两点中点∣ZX"    "FFF 两点等分∣FFF " "SZ 按色选择∣SZ""WW 镜像优化∣WW ""HK 填充开关∣HK ""CV 阵列复制∣CV ""C0 图层颜色随层∣C0" "Q 置为当前图层∣Q ""FF 所选对象最前置∣FF ""BB 所选对象最后置∣BB "" 改颜色∣1-255" )
                         )
                         ("绘图功能"
                                 ("GG 超级解组∣GG ""XX 超级炸块∣XX ""ZG 修改字高∣ZG ""DV 标注对齐∣DV " "DE 标注修剪∣DE " "DBB 设为当前标注∣DBB ""HD 指定填充原点∣HD ""EQ 标注值改均分∣EQ " "RS 标注值改实际尺寸∣RS ""YS 当前图层颜色查询∣YS ""DA 改选择对象线型为DASH,比例为1∣DA ""00 对象图层为0,颜色/线性随块,比例为1∣00 ")                              
                        )
                         ("辅助功能"                              
                              ("HH 水平构造线∣HH " "VV 竖直构造线∣VV ""OO 双向偏移∣OO ""BN 快速做块∣BN " "BBI 块改基点∣BBI ""RB 图块改名∣RB ""HF 绘制焊缝∣HF ""HG 填充捕捉∣HG ""OS    捕捉还原∣OS ""CL 中心线(布局使用)∣CL ""QQQ 将对象放置0层∣QQQ""DEF 将对象放置不可打印层∣DEF")                              
                        )
                         ("布局功能"                              
                              ("SV 锁定视口∣SV " "FV 解锁视口∣FV ""VVS 视口比例∣VVS ""SSV 匹配视图∣SSV " "VQ 对齐视图∣VQ ""` 模布切换∣` ""EE 图层隔离∣EE      ""EEE 图层隔离解除∣EEE""TC 节点剖面填充(需安装源泉)∣TC ""DJ (布局视口)当前图层视口冻结∣DJ ""JD (布局视口)当前图层视口解冻∣JD ""VPI (布局视口)其他视口图层冻结∣VPI ")
                         )
                                 
                )
   )      
(Dcl-ButtonM "【XX工具】V2014.1.21" lst nil)
         (princ)
)

加了为啥显示不对呢,老师

sbwdx 发表于 2019-12-30 14:23:37

sbwdx 发表于 2019-12-30 14:20
(defun Dcl-ButtonM (titl buttons flag / a b c)
   (defun strsplist (str / i)
   (if (setq i (v ...

好了,我知道了。我少了:号,搞定了,谢谢老师

yyz123121 发表于 2020-9-29 18:20:08

taoyi0727 发表于 2019-11-12 12:11
"}"
":text{key=\"str\";label=\"加字加字加字\";}"
":row{"


你好,请教一下,怎么在这个面板下边的帮助按钮旁边增加一个按钮,点击这个按钮就打开指定位置的其它vlx文件?
我加入下边这句之后,可以用快捷命令启动指定的程序,但是点击按钮没反应,按钮那个地方应该怎么写?
(defun c:***() (if (null c:***) (load "D:/***.VLX"))(c:***));加载其它程序

这个地方应该怎么写,才能让点击按钮也能够启动指定的程序?
   ":button{key = \"c:***\";label = \"批量打印\";}\n"

另一个问题,我加载了一个外部程序之后,加载第二个的话,
提示说“出现硬错误 ***
已达内部堆栈限制 (模拟)”

最后我想在左下角增加时间,应该怎么写,能说一下吗。
谢谢了
页: 1 [2]
查看完整版本: 明经上的一个面板修改