本帖最后由 vitalgg 于 2024-5-17 11:55 编辑
- (defun blk-in-loop (blkref / res)
- "块嵌套表"
- (setq res nil)
- (if (eq "INSERT" (entity:getdxf blkref 0))
- (progn
- (setq res (cons blkref res))
- (if (setq subblks (vl-remove-if-not
- '(lambda(x)(eq "INSERT" (entity:getdxf x 0)))
- (block:ent-list (entity:getdxf blkref 2))))
- (setq res (cons (mapcar 'blk-in-loop subblks) res)))))
- (reverse res))
- (defun blkbase-in-loop (lst-blkloop para1 / res subblks tmp-para)
- "基点坐标嵌套表,para1为基点,旋转角,缩放比例,默认为((0 0) 0 1)"
- (if (null para1)
- (setq para1 '((0 0 0) 0 1.0)))
- (setq res nil)
- (if (eq "INSERT" (entity:getdxf (car lst-blkloop) 0))
- (progn
- (setq res (cons
- (list
- (block:bcs2wcs
- (entity:getdxf (car lst-blkloop) 10)
- (entity:getdxf
- (tblobjname "block" (entity:getdxf (car lst-blkloop) 2))
- 10)
- (car para1)
- (cadr para1)
- (caddr para1)
- )
- (+ (cadr para1)
- (entity:getdxf (car lst-blkloop) 50))
-
- (* (entity:getdxf (car lst-blkloop) 41)
- (caddr para1))
- )
- res))
- (entity:putdxf
- (entity:make-circle (caar res) 2)
- 62 1)
- (if (setq subblks (cadr lst-blkloop))
- (progn
- (setq tmp-para (car res))
- (setq res (cons (mapcar '(lambda(x)
- (blkbase-in-loop
- x
- tmp-para))
- subblks)
- res))))))
- (reverse res))
- (setq blkref(car(entsel)))
- (blkbase-in-loop(blk-in-loop blkref)nil)
以上代码由 @lisp函数库 提供支持! https://atlisp.cn/functionlib.html
请先运行以下代码,再执行上面的代码。
- (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))))
|