本帖最后由 kinger 于 2022-8-5 11:23 编辑
这个自动加边界线程序是网上下载的,很好用,但是它只能生成一个整体的边界线,高手可以优化一下吗,改为可以批量选择图框块,并给每个图框块生成边界线。
- (defun c:bjh (/ ss i l1 l2 ll ur os d)
- (setq os (getvar 'osmode))
- (PRINC "\n自动边界盒 ")(PRINC)
- (setq d (getreal "\n偏距<5>"))
- (if (null d)
- (setq d 5)
- )
- (setq ss (ssget))
- (repeat (setq i (sslength ss))
- (vla-getboundingbox
- (vlax-ename->vla-object (ssname ss (setq i (1- i))))
- 'll
- 'ur
- )
- (setq l1 (cons (vlax-safearray->list ll) l1)
- l2 (cons (vlax-safearray->list ur) l2)
- )
- )
- (mapcar 'set
- (list 'll 'ur)
- (mapcar '(lambda (a b) (apply 'mapcar (cons a b)))
- '(min max)
- (list l1 l2)
- )
- )
- (command
- "rectang"
- (trans (polar ll (* pi 1.25) (setq d (sqrt (+ (* d d) (* d d)))))
- 0
- 1
- )
- (trans (polar ur (* pi 0.25) d) 0 1)
- )
- (setvar 'osmode os)
- (princ)
- )
|