本帖最后由 vitalgg 于 2023-1-12 18:54 编辑
- (setq res
- (stat:classify
- (mapcar
- '(lambda(x)
- (cons (car x)
- (atoi
- (cadr x))))
- (list:split
- (string:auto-split
- (string:subst-all "" "+"
- (entity:getdxf (car(entsel)) 1)))
- 2))))
- (setq pt (getpoint "绘制结果"))
- (entity:make-text
- (string:from-list
- (mapcar '(lambda(x)
- (strcat (car x)
- (itoa (cdr x))))
- res)
- "+")
- (setq pt (polar pt (* 1.5 pi) 5))
- 3 0 0.8 0 "LB")
- (entity:make-text
- (string:from-list
- (mapcar '(lambda(x)
- (strcat (car x)
- (itoa (cdr x))))
- res)
- "")
- (setq pt (polar pt (* 1.5 pi) 5))
- 3 0 0.8 0 "LB")
- (foreach txt (mapcar '(lambda(x)
- (strcat (car x)
- (itoa (cdr x))))
- res)
- (entity:make-text
- txt
- (setq pt (polar pt (* 1.5 pi) 5))
- 3 0 0.8 0 "LB"))
- (table:make
- (setq pt (polar pt (* 1.5 pi) 5))
- "统计表"
- '("名称" "数量")
- (append
- (mapcar '(lambda(x)
- (list (car x)(cdr x)))
- res)
- (list
- (list "合计"
- (apply '+ (mapcar 'cdr res))))
- ))
基于 @lisp 函数库,代码中所有含有 : 的均为 @lisp提供的函数。
https://gitee.com/atlisp/atlisp-lib
|