f4800 发表于 2020-11-1 16:07:15

CAd中对于 一个单行文字 如何把他拆分为多个单行文字

本帖最后由 f4800 于 2020-11-1 16:08 编辑

现在遇到个问题CAD 中,    H=243.13 Wz=13.00 Wy=13.00 是一个单行文字。
现在如何拆分开, 成为H=243.13一个单行文字、 Wz=13.00一个单行文字、 Wy=13.00一个单行文字 ,并删除中间的空格 ?

如何用程序实现   多谢了。。





yjtdkj 发表于 2020-11-2 12:43:18

;|==============================================;;
;;;字符串分隔成字符串表(支持中文)-------------------------yjtdkj2020.02.04
;;; 函数: (yj-str2lst 字符串 分割符串)
;;===============================================;;
|;
(defun yj-str2lst (str divs / stri strn strlst)
;;;Integrated函数:判断字串str的前i个(从1开始计,与substr相同)字符是否完整。
;;;完整则返回T,否则返回nil。
(defun yj-Integrated (str i / lst)
    (setq lst (vl-string->list (substr str 1 i))
    lst (vl-remove-if '(lambda (x) (< x 128)) lst)
    )
    (= 0 (rem (length lst) 2))
)
;;;=============================
    (setq strn nil
    strlst nil
    )
    (while (and str (/= "" str))
      (if (yj-Integrated str 1)
(setq stri (substr str 1 1))
(setq stri (substr str 1 2))
      )
      (if (vl-string-search stri divs)
(if strn
    (setqstrlst (cons strn strlst)
    strn   nil
    )
)
(setq strn (if strn
         (strcat strn stri)
         stri
       )
)
      )
      (if (yj-Integrated str 1)
(setq str (substr str 2))
(setq str (substr str 3))
      )
    )
    (ifstrn
      (setq strlst (cons strn strlst)
      strn   nil
      )
    )
    (ifstrlst
      (reverse strlst)
      nil
    )
)
用这个函数,参数里面加空格就行了

f4800 发表于 2020-11-2 12:56:22

yjtdkj 发表于 2020-11-2 12:43
用这个函数,参数里面加空格就行了

:handshake

多谢多谢!!!!!

f4800 发表于 2020-11-2 14:32:17

这个函数怎么做成lsp加载到CAD里运行?

yjtdkj 发表于 2020-11-2 17:55:12

f4800 发表于 2020-11-2 14:32
这个函数怎么做成lsp加载到CAD里运行?

这个要找本书从头开始学了,先入门。推荐吴永进的书

f4800 发表于 2020-11-4 06:47:28

已解决。。。多谢各位大师

f4800 发表于 2020-11-5 17:27:33


已解决。。。多谢各位大师

2809605473 发表于 2022-6-9 21:55:25

楼主,可以分享一下源码插件吗?
页: [1]
查看完整版本: CAd中对于 一个单行文字 如何把他拆分为多个单行文字