本帖最后由 xyp1964 于 2023-11-11 11:12 编辑
- (defun c:tt ()
- (defun xyp-dxf(code e)(cdr(assoc code(entget e))))
- (defun xyp-Ss2List(ss)(vl-remove-if-not'(lambda(x)(equal(type x)'ENAME))(mapcar'cadr(ssnamex ss))))
- (princ "\n请选择尺寸标注组<退出>: ")
- (if (setq ss (ssget '((0 . "DIM*"))))
- (progn
- (setq lst (xyp-Ss2List ss)
- lst (mapcar '(lambda (x) (if (/= (setq a (xyp-DXF 1 x)) "")(distof a)(xyp-DXF 42 x)))lst)
- lst (vl-sort lst '>)
- l1 (car lst)
- l2(apply '+ (cdr lst))
- )
- (princ "\n总尺寸 = ")(princ l1)
- (princ "\n分项尺寸总和 = ")(princ l2)
- (if (equal l1 l2 1e-3)
- (princ "\n总尺寸与分项尺寸总和一致")
- (princ "\n总尺寸与分项尺寸总和不一致")
- )
- )
- )
- (princ)
- )
|