疯球
发表于 2019-6-1 12:58:03
请高手给个指示
疯球
发表于 2019-6-2 07:08:32
1
疯球
发表于 2019-6-3 06:48:37
zixuan203344 发表于 2019-6-2 09:34
(defun c:tt4 ();;;;
(vl-load-com)
(setq @dclfiledame (vl-filename-mktemp nil nil ".dcl"))
“千呼万唤始出来”终于有大侠出手了,心里面激动万分,试了一下,很强大,唯一的遗憾就是不能点选后立即出来前后缀,需要点完后确定才出来,不过这样已经很好了!!
zixuan203344
发表于 2019-6-3 13:39:41
疯球 发表于 2019-6-3 06:48
“千呼万唤始出来”终于有大侠出手了,心里面激动万分,试了一下,很强大,唯一的遗憾就是不能点选后立即 ...
这行(setq ss (ssget (list (cons 0 "TEXT"))))
改成
(setq ss (ssget ":S" (list (cons 0 "TEXT"))))
你自己改
疯球
发表于 2019-6-3 15:34:58
zixuan203344 发表于 2019-6-3 13:39
这行(setq ss (ssget (list (cons 0 "TEXT"))))
改成
(setq ss (ssget ":S" (list (cons 0 "TEXT"))))
...
我真的很感激你的帮助,功能已经能用了,只是改了那句代码后,点选一个后,他会自动改,但命令也结束了,不能连续点!
zixuan203344
发表于 2019-6-4 00:36:22
本帖最后由 zixuan203344 于 2019-6-4 00:38 编辑
(defun c:tt4 (/ ent k loop2 obj return# ss str1)
;;;;
(vl-load-com)
(setq @dclfiledame (vl-filename-mktemp nil nil ".dcl"))
(setq @dclfiled (open @dclfiledame "w"))
(write-line "dzmjjsbdc:dialog {" @dclfiled)
(write-line " label = \"文本加前后缀\" ;" @dclfiled)
(write-line " :row {" @dclfiled)
(write-line " :edit_box {" @dclfiled)
(write-line
" key = \"textaddstring1\" ;"
@dclfiled
)
(write-line " label = \"前缀\" ;" @dclfiled)
(write-line " width = 30;" @dclfiled)
(write-line " }" @dclfiled)
(write-line " :edit_box {" @dclfiled)
(write-line
" key = \"textaddstring2\" ;"
@dclfiled
)
(write-line " label = \"后缀\" ;" @dclfiled)
(write-line " width = 30;" @dclfiled)
(write-line " }" @dclfiled)
(write-line " }" @dclfiled)
(write-line " ok_cancel;" @dclfiled)
(write-line "}" @dclfiled)
(close @dclfiled)
;;以下根据情况处理
(setq @dclid (load_dialog @dclfiledame))
(new_dialog "dzmjjsbdc" @dclid)
;;设置控件默认值
(if (and (/= textaddstring1_1 "") (/= textaddstring1_1 nil))
(set_tile "textaddstring1" textaddstring1_1)
)
(if (and (/= textaddstring2_1 "") (/= textaddstring2_1 nil))
(set_tile "textaddstring2" textaddstring2_1)
)
(action_tile "accept" "(get_dzmjjsbdc_main)(done_dialog 1)")
;;;确定
(setq return# (start_dialog))
(cond
((= return# 1)
(setq loop2 t)
(while loop2
(princ "\n 选择文本<退出>")
(setq ss (vl-catch-all-apply 'ssget (list ":S" '((0 . "TEXT")))))
(if (vl-catch-all-error-p ss)
(progn
(princ (strcat "**VL-CATCH-ALL-ERROR-P提示有错:** "
(vl-catch-all-error-message ss)
)
)
(setq loop2 nil)
(princ)
)
(progn
(if ss
(repeat (setq k (sslength ss))
(setq ent (ssname ss (setq k (1- k))))
(setq obj (vlax-ename->vla-object ent))
(setq str1 (vla-get-textstring obj))
(vla-put-textstring
obj
(strcat textaddstring1_1 str1 textaddstring2_1)
)
)
)
)
)
)
)
)
(unload_dialog @dclid)
(vl-file-delete @dclfiledame)
(princ)
)
;;;;;获得对话框值
(defun get_dzmjjsbdc_main ()
(setq textaddstring1_1 (get_tile "textaddstring1"))
(setq textaddstring2_1 (get_tile "textaddstring2"))
)
疯球
发表于 2019-6-4 07:37:14
疯球 发表于 2019-6-1 07:23
请各路大神给个指示吧
由衷感谢“zixuan203344”的帮助,希望用此代码的人对“zixuan203344”表示感谢!!
潇湘飞雨
发表于 2019-6-8 20:17:53
zixuan203344 发表于 2019-6-4 00:36
(defun c:tt4 (/ ent k loop2 obj return# ss str1)
;;;;
(vl-load-com)
(princ "\n 选择文本<退出>")
(setq ss (vl-catch-all-apply 'ssget (list ":S" '((0 . "TEXT,MTEXT,DIMENSION")))))
(if (vl-catch-all-error-p ss)
请教,添加了标注,可是不支持 能否赐教?
yangchao2005090
发表于 2020-6-12 14:17:47
zixuan203344 发表于 2019-6-4 00:36
(defun c:tt4 (/ ent k loop2 obj return# ss str1)
;;;;
(vl-load-com)
您好,选择对象完毕后无法退出,可否帮忙在改一下
选择对象: *取消*
**VL-CATCH-ALL-ERROR-P提示有错:** 函数被取消
yangchao2005090
发表于 2020-6-27 22:21:36
zixuan203344 发表于 2019-6-4 00:36
(defun c:tt4 (/ ent k loop2 obj return# ss str1)
;;;;
(vl-load-com)
您好,方便增加一下删除前后缀功能吗