明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3611|回复: 20

求个加前后缀的源码

[复制链接]
发表于 2019-5-28 21:01:38 | 显示全部楼层 |阅读模式
10明经币
本帖最后由 疯球 于 2019-5-30 06:59 编辑

要求如图,求哪位大神能做一下
附件: 您需要 登录 才可以下载或查看,没有账号?注册

最佳答案

查看完整内容

(defun c:tt4 ();;;; (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) ...
发表于 2019-5-28 21:01:39 | 显示全部楼层
(defun c:tt4 ();;;;
  (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)
                        (prompt "\n 选择文本<退出>")
                        (if (setq ss (ssget (list (cons 0 "TEXT"))))
                                (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-5-28 21:02:21 | 显示全部楼层
与贱人工具箱的前后缀一样,谁能写个代码,谢谢!!
回复

使用道具 举报

发表于 2019-5-29 08:52:36 | 显示全部楼层
本帖最后由 Kye 于 2019-5-29 08:54 编辑

http://bbs.mjtd.com/forum.php?mo ... hlight=%BA%F3%D7%BA
虽然此链接的发帖者 非常不厚道,但可以向ssyfeng大侠讨要啊,要来之后 ,如ssyfeng允许 还把代码贴在这个帖子中比较好


建议明总对设置【此贴仅作者可见】的功能收费,支持论坛的生存
回复

使用道具 举报

 楼主| 发表于 2019-5-29 10:20:55 | 显示全部楼层
帮顶出高手吧
回复

使用道具 举报

发表于 2019-5-29 10:30:39 | 显示全部楼层
;;entget+assoc得到组码1中的文字内容,多行文字可能需要注意下格式
;;strcat增加前后缀
;;subst替换
;;entmod更新资料
;;还有啥???

回复

使用道具 举报

 楼主| 发表于 2019-5-29 19:25:42 | 显示全部楼层
请高手,出手!!
回复

使用道具 举报

 楼主| 发表于 2019-5-30 09:15:02 | 显示全部楼层
继续等!,继续等 !!
回复

使用道具 举报

 楼主| 发表于 2019-5-31 12:22:19 | 显示全部楼层
高手都在睡觉吗
回复

使用道具 举报

 楼主| 发表于 2019-6-1 07:23:47 | 显示全部楼层
请各路大神给个指示吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-4-1 09:33 , Processed in 0.195629 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表