本帖最后由 SunSpring 于 2014-8-10 22:08 编辑
- (defun c:cc (/ center entdata entname fentdata fradius gentdata gradius
- ptlist radiusmax radiusmin subentgrp
- )
- (defun vla-ssname (ss index)
- (vlax-ename->vla-object (ssname ss index))
- )
- (defun gpax:getboundingbox (entgrp / entname entpl entplx entply entpr
- entprx entpry n
- )
- (if (= (type entgrp) 'ename)
- (setq entgrp (ssadd entgrp))
- )
- (repeat (setq n (sslength entgrp))
- (setq entname (vla-ssname entgrp (setq n (1- n))))
- (vla-getboundingbox entname 'entpl 'entpr)
- (setq entplx (cons (vlax-safearray-get-element entpl 0) entplx)
- entply (cons (vlax-safearray-get-element entpl 1) entply)
- entprx (cons (vlax-safearray-get-element entpr 0) entprx)
- entpry (cons (vlax-safearray-get-element entpr 1) entpry)
- )
- )
- (list (trans (list (apply
- 'min
- entplx
- ) (apply
- 'min
- entply
- )
- ) 0 1
- ) (trans (list (apply
- 'max
- entprx
- ) (apply
- 'max
- entpry
- )
- ) 0 1
- )
- )
- )
- (defun ssdelentgrp (ss1 ss2 / n)
- (repeat (setq n (sslength ss1))
- (ssdel (ssname ss1 (setq n (1- n))) ss2)
- )
- )
- (if (setq entgrp (ssget '((0 . "CIRCLE"))))
- (progn
- (setq ptlist (gpax:getboundingbox entgrp))
- (setq dephole (ssadd))
- (while (ssname entgrp 0)
- (setq entname (ssname entgrp 0)
- entdata (entget entname)
- center (cdr (assoc 10 entdata))
- )
- (setq subentgrp (ssget "W" (car ptlist) (cadr ptlist) (list
- (cons 10 center)
- (cons 0 "CIRCLE")
- )
- )
- )
- (if (= (sslength subentgrp) 2)
- (progn
- (setq fentdata (entget (ssname subentgrp 0)))
- (setq gentdata (entget (ssname subentgrp 1)))
- (setq fradius (cdr (assoc 40 fentdata)))
- (setq gradius (cdr (assoc 40 gentdata)))
- (setq radiusmin (min
- fradius
- gradius
- )
- )
- (setq radiusmax (max
- fradius
- gradius
- )
- )
- (if (and
- (= radiusmin 4.5)
- (= radiusmax 7.0)
- )
- (progn
- (ssadd (ssname subentgrp 0) dephole)
- (ssadd (ssname subentgrp 1) dephole)
- )
- )
- )
- )
- (ssdelentgrp subentgrp entgrp)
- )
- )
- )
- (sssetfirst nil dephole)
- )
可能有些复杂但是可以用.
已经更新.再试下.
|