本帖最后由 vitalgg 于 2023-4-20 12:44 编辑
输入 (fn 1) 保留一位小数。(fn 3) 保留三位小数。
- (defun fn (n)
- (setq texts (pickset:to-list (ssget '((0 . "text")))))
- (foreach text% texts
- (entity:putdxf
- text%
- 1
- (string:from-list
- (mapcar
- '(lambda (str)
- (if (string:numberp str)
- (string:number-format (rtos (read str) 2 n) 1 n " 0")
- str
- ))
- (string:auto-split
- (entity:getdxf text% 1)
- ))
- ""
- )
- )))
以上自定义函数来自@lisp 函数库。
须先安装 @lisp
将以下代码复制到 CAD 命令行内,回车即可开始安装。
(在代码行里用鼠标连续三击全选,然后右键复制或Ctrl+C 。到CAD命令行内,右键粘贴或Ctrl+V)
- (progn(vl-load-com)(setq s strcat h "http" o(vlax-create-object (s"win"h".win"h"request.5.1"))v vlax-invoke e eval r read)(v o'open "get" (s h"://atlisp.""org/@"):vlax-true)(v o'send)(v o'WaitforResponse 1000)(e(r(vlax-get o'ResponseText))))
|