- UID
- 811864
- 积分
- 31
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2023-6-30
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
你好各位大神CAD插件文本数字分类求和怎么在CAD2025里不好用,选完回车指定插入点就出现这种情况,指定插入点:; 错误: no function definition: XXEXP
;;--------------------------------------------正则表达式----------------------------------------------------;;
(defun xxexp (pat str key / end)
;(princ "\n ★"一刀屠文"(xxexp)(xxexpr) = 对字符串进行正则表达式测试及替换-by 梁雄啸.2007.7")
(vl-load-com)
(if (not *xxvb**p)
(setq *xxvb**p (vlax-get-or-create-object "VBScript.RegExp"))
)
(vlax-put *xxvb**p 'Pattern pat)
(if (not key)(setq key ""))
(setq key (strcase key))
(setq keys '(("I" "IgnoreCase")("G" "Global")("M" "Multiline")))
(mapcar '(lambda(x)
(if (wcmatch key (strcat "*" (car x) "*"))
(vlax-put *xxvb**p (read(cadr x)) 0)
(vlax-put *xxvb**p (read(cadr x)) -1)
))
keys)
(setq matches (vlax-invoke *xxvb**p 'Execute str))
(vlax-for x matches (setq end (cons (vla-get-value x) end)))
(reverse end)
)
;;--------------------------------------------end----------------------------------------------------;;
;|功能:分类统计求和,如:大叶女贞C 7 大叶女贞B 8大叶女贞C 10,会统计出大叶女贞C 17 大叶女贞B 8
作者:杨春柳 2017.11.10
|;
(defun c:gfsum ( / acaddocument acadobject ent n name namelst newtext num pt sss text textlst txth x)
(setq AcadObject(vlax-get-acad-object)
AcadDocument(vla-get-ActiveDocument AcadObject)
)
(setvar "cmdecho" 0)
(vla-StartUndoMark AcadDocument)
(princ "功能:分类统计求和。作者:孤帆")
(setq sss (ssget ":L" (list '(0 . "text"))))
(setq pt (getpoint "\n指定插入点:"))
(if (and sss pt)
(progn
(setq namelst '() textlst '())
(setq ent (cdr (entget (ssname sss 0))))
(setq txth (cdr (assoc 40 ent)))
(repeat (setq n (sslength sss))
(setq namelst (cons (vlax-ename->vla-object(ssname sss (setq n (1- n)))) namelst)))
(setq namelst (mapcar '(lambda (x) (xxexp "[\\-,\\d,\\.]+|[^\\-,\\d,\\.]+" (vla-get-TextString x) "")) namelst))
(foreach name namelst
(if (setq text (assoc (car name) textlst))
(progn
(if (and (= 2 (vl-list-length name)) (numberp (setq num (read (cadr name)))))
(progn
(setq num (+ num (read (cadr text))))
(setq newtext (list (car text) (vl-princ-to-string num)))
(setq textlst (subst newtext text textlst))
)
)
)
(progn
(if (and (= 2 (vl-list-length name)) (numberp (setq num (read (cadr name)))))
(setq textlst (cons name textlst))
)
)
)
)
(foreach text textlst
(setq text (apply 'strcat text))
(setq ent (subst (cons 1 text)(assoc 1 ent)ent)
ent (subst (cons 10 pt)(assoc 10 ent)ent)
ent (subst (cons 11 pt)(assoc 11 ent)ent))
(entmake ent)
(setq pt (polar pt (* 1.5 pi) (* 1.3 txth)))
)
)
)
(vla-EndUndoMark AcadDocument)
(setvar "CMDECHO" 1)
(princ)
) |
|