CAD标注统计插件求修改
(defun c:bzcdqh()(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (progn
(princ "\n请选取标注:")
(setq ssa (ssget '((0 . "DIMENSION") )))
)
(progn
(setq cdz 0)
(setq i 0)
(setq n (sslength ssa))
(repeat n
(setq dxf (entget (ssname ssa i)))
(setq cdz (+ cdz (cdr (assoc 42 dxf))))
(setq i (1+ i))
)
(alert (strcat "共选取了" (itoa n) "个标注,总长度=" (rtos cdz 2 3)))
(princ (strcat "\n共选取了" (itoa n) "个标注,总长度=" (rtos cdz 2 3)))
)
)
(setvar "cmdecho" cmd)
(princ)
)
麻烦高手帮忙修改一下,当获取“文字替代”的数据为空时,再获取“测量单位”数据,然后再求和。
https://iknow-pic.cdn.bcebos.com/b219ebc4b74543a96c3c31560c178a82b9011401 谢谢分享!!!!! ---------------------------------------------------------------
(repeat n
(setq dxf (entget (ssname ssa i)))
(setq cdz (+ cdz (cdr (assoc 42 dxf))))
(setq i (1+ i))
)
---------------------------------------------------------------
(repeat n
(setq dxf (entget (ssname ssa i)))
(if (cdr (assoc 1 dxf))
(setq cdzi (cdr (assoc 42 dxf)))
(setq cdzi (cdr (assoc 1 dxf)))
)
(setq cdz (+ cdz cdzi))
(setq i (1+ i))
) 数据是字符串格式,还要处理的
修改只是提取字符串,
自己试试吧 -----------------------------------------------------------
(if (cdr (assoc 1 dxf))
(setq cdzi (cdr (assoc 1 dxf)))
(setq cdzi (cdr (assoc 42 dxf)))
)
-----------------------------------------------------------
不好意识,这块写反了,修正一下
页:
[1]