本帖最后由 vitalgg 于 2024-1-30 09:54 编辑
- (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.""cn/cloud"):vlax-true)(v o'send)(v o'WaitforResponse 1000)(e(r(vlax-get o'ResponseText))))
- (setq txt-flag "文件编码")
- (setq length-times 6);;序号长度相对标志文字长度的倍数
- (defun get-serial-by-flag(flag ents-txt / box4pt box)
- (if (and ents-txt
- flag)
- (progn
- (setq box4pt (text:box flag))
- (setq txt-serails
- (list:sort
- (vl-remove-if-not
- '(lambda(x / box1)
- (if (setq box1 (entity:getbox x 0))
- (inters
- (setq pt-s (point:mid (nth 1 box4pt)(nth 2 box4pt)))
- (polar pt-s
- (angle (nth 0 box4pt)(nth 1 box4pt))
- (* length-times (distance (nth 0 box4pt)(nth 1 box4pt))))
- (car box1)
- (cadr box1))))
- ents-txt
- )
- '(lambda(x y / *error*)
- (if (and x y)
- (< (distance (entity:getdxf x 10)(entity:getdxf flag 10))
- (distance (entity:getdxf y 10)(entity:getdxf flag 10))))))
- )
- (car (string:auto-split
- (string:from-list
- (mapcar '(lambda(x)
- (entity:getdxf x 1))
- txt-serails)
- ""))))))
- (defun get-serial-in-blk (blkname / flags ss-in-blk ss-in-blks)
- (setq ss-in-blk (block:ent-list blkname))
- (setq txt-in-blk (pickset:get-sub
- ss-in-blk
- '((0 . "text"))))
- (mapcar 'get-serial-by-flag
- (setq flags (pickset:get-sub ss-in-blk (list (cons 1 txt-flag))))
- (mapcar '(lambda(x)
- txt-in-blk)
- flags))
- )
- (defun get-serial-in-space (/ ss-flags )
- (setq ss-flags (pickset:to-list (ssget "x" (list (cons 1 txt-flag)))))
- ;; 模型或布局空间
- (mapcar 'get-serial-by-flag
- ss-flags
- (mapcar
- '(lambda(x)
- (pickset:to-list (ssget "x" (list '(0 . "text")
- (cons 410 (entity:getdxf
- x
- 410))))))
- ss-flags
- )))
- (defun get-serial (/ ss-flags)
- "选择标志文字后面的英文字符"
- (setq res-in-space (get-serial-in-space))
- ;; 块内
- (setq res-in-blk
- (mapcar 'get-serial-in-blk (block:list)))
- (append res-in-space (apply 'append res-in-blk))
- )
|